Try <.@%: .
I believe it returns extended results on extended arguments.

Cheers,
Louis

> On 27 Feb 2018, at 20:56, Don Kelly <[email protected]> wrote:
> 
> I agree with the series approach but the final result depends on division 
> which has limited accuracy. I would suggest using the following which uses 
> 100*L%R as a rational fraction
> 
> (10^_2)*(1r2)* 175r637816300
> 
> 1.37187e_9
> 
> 
> However, the solution is wrong in any case. It is the result of using a 
> circle and a line parallel to the tangent line at any point. In other words, 
> looking at the earth from a great distance.
> 
> The right answer (for a perfect sphere) is 0 as the curvature of the earth is 
> the same in every direction from the observer.  There is no "arch"   It seems 
> that the old Greeks had it right- as ships went off into the distance, they 
> didn't just shrink and remain whole but would also disappear gradually from 
> the  bottom up. What Patrick Harrington said is at the core of what is 
> actually observed.
> 
> 
> Don Kelly
> 
> 
>> On 2018-02-26 10:10 PM, J. Patrick Harrington wrote:
>> The way to avoid loss of accuracy is to expand in a binomial series:
>>  D = R - √(R²-L²) = R[ 1 - (1 - (L/R)^2)^(1/2)]
>>    = R[ 1 - (1 -(1/2)(L/R)^2 + ...)] = (1/2) L*L/R
>> and thus
>>  ]D=. -:L*L%R
>>      1.76384e_9
>> 
>>> On Tue, 27 Feb 2018, Ian Clark wrote:
>>> In "The Curious Incident of the Dog in the Night-Time", Mark Haddon has his
>>> young autistic hero verify that the earth is not flat by holding up a steel
>>> straight-edge to the horizon.
>>> 
>>> In the course of private research into public gullibility, I tried to
>>> replicate Haddon's thought-experiment – and failed! Try as I might, I could
>>> not see the slightest discrepancy between the horizon and my straight-edge.
>>> 
>>> I strongly suspect that Haddon hasn't performed the experiment himself, but
>>> simply written down what he thought one "ought" to see.
>>> 
>>> So what am I to conclude?
>>> (a) The earth is flat.
>>> (b) The curvature is too small to be seen this way.
>>> (c) Don't believe everything you read in novels.
>>> 
>>> Let's go with (b), and try to calculate the height D of the "arch" of the
>>> horizon over the ruler's edge, and show it's too small to observe by the
>>> naked eye.
>>> 
>>> There's a diagram at:
>>> 
>>> https://whitbywriters.wordpress.com/2018/02/26/the-curious-incident-of-the-dead-flat-horizon
>>>  
>>> where I discuss the matter for non-mathematical readers. There I baldly
>>> state that D is given by the formula:
>>> 
>>>   D = R * (1 – cos arcsin L/R)
>>> 
>>> where L is the half-length of the straight-edge and R the radius of the
>>> earth.
>>> 
>>> Have I got it right?
>>> 
>>> I calculated D = 1.4 nm, but omit to say how. (I used J of course).
>>> 
>>>   R=: 6378163  NB. equatorial radius of earth (m)
>>>   L=: 0.15     NB. half-length of metal ruler (m)
>>>   cos=: 2&o.
>>>   arcsin=: _1&o.
>>>   smoutput D=: R * (1 - cos arcsin L%R)
>>> 1.41624e_9
>>> 
>>> Now 1.41624e_9 m is roughly 1.4 nm, less than the width of a DNA molecule.
>>> 
>>> But I suspect that my estimate of D is unreliable. Moreover it could be out
>>> by several orders of magnitude. Why? Because I'm calculating the arcsin of
>>> a very small number, and then calculating the cosine of the resulting very
>>> small angle, which may be pushing (o.) beyond its limits.
>>> 
>>> Now I could use Pythagoras instead of trigonometry:
>>> 
>>>   D = R - √(R²-L²)
>>> 
>>> which avoids using (o.) and may perform the entire calculation in extended
>>> precision without conversion to (float). I'll also work in nanometres (nm),
>>> not metres (m):
>>> 
>>>   R=: 6378163000000000x   NB. (nm)
>>>   L=: 150000000x                  NB. (nm)
>>>   smoutput D=: R - %:(R*R)-(L*L)
>>> 2
>>> 
>>> I thought I was getting 6-figure accuracy, so this result worries me.
>>> 2 nm differs significantly from the result of the trig formula: 1.4 nm.
>>> 
>>> Now (R*R)-(L*L) is extended precision, but (%:) is returning (float) not
>>> (extended). Is it also corrupting the result? Is "2" just an artefact of
>>> its algorithm?
>>> 
>>> So let's work in picometres, to see if the "2" holds up under greater
>>> precision:
>>> 
>>>   R=: 6378163000000000000x
>>>   L=: 150000000000x
>>>   smoutput D=: R - %:(R*R)-(L*L)
>>> 2048
>>> 
>>> It does. This is encouraging. But (%:) still returns (float).
>>> 
>>> Let's try different ways of calculating the square root of an extended
>>> precision result:
>>> 
>>>   sq=: ^&2
>>>   sqr=: %:
>>>   smoutput D=: R - sqr (sq R)-(sq L)
>>> 2048
>>>   sqr=: ^&0.5
>>>   smoutput D=: R - sqr (sq R)-(sq L)
>>> 2048
>>>   sqr=: ^&1r2
>>>   smoutput D=: R - sqr (sq R)-(sq L)
>>> 3072
>>> …which is even more worrying!
>>> 
>>> So which is the most dependable approximation to D?
>>>  3 nm
>>>  2 nm
>>>  1.4 nm
>>>  none of the above?
>>> 
>>> Is it robust enough to warrant my original deduction?
>>> 
>>> Have I made a logical error somewhere?
>>> ----------------------------------------------------------------------
>>> For information about J forums see http://www.jsoftware.com/forums.htm
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
> 
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to