Carl Love

Carl Love

28055 Reputation

25 Badges

12 years, 356 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are replies submitted by Carl Love

I wrote an application for this (simulated flight of a flock of starlings) and posted it here several years ago. Hopefully someone else can find it. I'm not very good at using the search tools here. If it helps someone search, I used the Explore command. It was in an Answer.

@janhardo You wrote:

  • Interesting, because maybe you has used a instant formulae for the chordal segment, but that is not the case

Some formulae I memorize, some I look up in reference materials, and some I re-derive every time I need them. The chordal segment formula is one the I re-derive.

  • Highlight is the formulae, but what is so special on this formulae ?

The final area is expressed as C*R^2 where is a dimensionless constant (akin to Pi) that depends only on the ratio L/R rather than depending on them individually.

By the way, formulae is the plural for formula. The plural formulas is also acceptable.

 

@janhardo If we're talking about a ratio of sides of a triangle, then sin(theta) = A/B is the same as theta = arcsin(A/B). Since the goal was to get the angle, I used the latter. The final result for the area must include arc-functions---there's no mathematical way around that---but there's no need for it to include non-arc functions such as sin.

Regarding radians vs. degrees: Neither the problem's input (lengths and R) nor its output (an area) involve angles. So the appearance of constants related to angle measure in the final formula would be disconcerting. Consider the sector area formula: A__sector = theta/2*r^2. If theta were in degrees, that would need to be theta/360*Pi*r^2, which is more complicated. Using radians, we avoid having the formulas cluttered up with Pi and arbitrary numbers like 360. Also, Maple's arcsin will return radians.

@mmcdara I find unevaluation quotes very confusing, and I'm not sure of my explanation. I have a general idea of when they'll be needed, but I'm usually not sure whether it'll require one set or two. I once had a situation that required three sets. I just try them until something works. 

@emendes 

That the command index is threadsafe---although it's not listed at ?threadsafe---can be easily verified by reading its super-short code. There seem to be many such commands that are actually threadsafe although they're not listed. (I hope that I'm not missing some detail in ascertaining thread safety.)

I wonder if some extra time is needed for the Grid processes to "wrap things up": garbage collection and final shutdown. I'm just guessing here, but try this:

Grid:-Seq(your code);
t1:= time[real]());
Grid:-Wait();
t2:= time[real]());
print("Wait time:", t2-t1);
#My code from above:
T1:= table(sparse, L1=~[$1..nops(L1)]):
L1:= 'L1': #Optional; use if memory needs to be conserved.
Threads:-Map[2](index, T1, L2);

Then tell me whether the Threads:-Map worked and what value was printed for "Wait time". That's the time that it took Grid to wrap up after the return from Grid:-Seq.

@Carl Love As Acer's Answer shows, my Answer is wrong. I was thinking of the inscribed ellipse of maximal area. I'm demoting the Answer to a Reply.

@janhardo Here is a very basic derivation. I've only used 4 very basic geometry formulas, all pertaining to right triangles and circles:

  • sine of acute angle = (opposite side) / hypothenuse
  • area of circle = Pi * radius^2
  • Pythagorean formula: opposite^2 + adjacent^2 = hypothenuse^2
  • area of right triangle = opposite*adjacent/2


The area of the chordal segment for chord length L is twice the shaded area shown. Clearly it's equal to the area of the radial sector outlined in red minus the area of the right triangle below the shaded region. By using the triangle's top side (L/2) and hypothenuse (R), the central angle of the sector is
theta:= arcsin((L/2)/R);

Thus the area of the sector is 
A__sector:= theta/(2*Pi)*Pi*R^2;

The area of the triangle is
A__triangle:= (L/2)*(sqrt(4*R^2-L^2)/2)/2;

So the area of a chordal segment is
AreaChord:= unapply(2*(A__sector - A__triangle), (L,R));

The rest is pretty much the same as the previous worksheet. Once again, MaplePrimes wouldn't display my worksheet, so please download it. The highlight is this highly symmetric formula for the desired overlap area:

r:= L/R: sq:= sqrt(1 - (r/2)^2):
A:= R^2*(r^2*arcsin(sq) + arcsin(sq*r) - sq*r);

Download Circles.mw

If the ellipse is inscribed in the rectangle, then its axes are necessarily determined by the midpoints of the rectangle's sides. In other words, the four points of tangency will be the midpoints of the sides. This should be enough for you to produce the plot. If you're still stuck, let me know.

@vv I'd recommend including a nonnegativity restriction when solving equations involving factorials:

floor(fsolve(1/(n+1)! = 0.0001, {n= 0..infinity})) + 1

Due to factorial's GAMMA extension, I've often obtained negative results when I forgot to include the restriction.

@rameen hamood Okay, my Answer is still valid.

Please give your Questions different and more-specific titles than "further linear algebra".

Please upload the worksheet by using the green uparrow on the toolbar. That way we can directly download it to our Maple.

@mthkvv 

You can speed up the coefficient arithmetic by exploiting the fact that the modulus is a power of two. Thus, the mod operation is just a bit truncation. Since GMP is open source, I'd start by looking there. It may just require a little tweaking.

I doubt that it's possible to gain any benefit from Schonhage-Strassen at this coefficient size. From my reading, the smallest coefficients that can benefit from S-S are order 2^(2^15).

 

  •  

@Adam Ledger Simply replace the second-to-last line with

ifactor:= ()-> orig_ifactor(({args} minus {':-easy'})[]):

@DarkMath How would it know that there's only one root unless it uses

solve({sin(x), -1 < x, x < 1}, x, explicit, allsolutions)

?

Using fewer options gives incorrect results for the root count (here I've widened the search interval):

solve({sin(x), -4 < x, x < 4}, x);
solve({sin(x), -4 < x, x < 4}, x, explicit);
solve({sin(x), -4 < x, x < 4}, x, allsolutions);

The first two give one root. The third gives countable infinity. So, given this, why would the integrator assume that "one root" was correct on the narrower interval? 

First 182 183 184 185 186 187 188 Last Page 184 of 709