Undergrad Newton's approximation of inverse trig

Click For Summary
The discussion centers on deriving the inverse trigonometric functions for a unit-hypotenuse triangle, specifically focusing on arcsin, arccos, and arctan. The user seeks to implement high-precision calculations for a model of the sun and Earth, expressing concerns about differentiation and integration in relation to angle calculations. Key relationships are established using the unit circle, with the user emphasizing the need for accurate methods to derive trig functions for programming purposes. There is a debate about the precision of floating-point implementations versus exact methods, with suggestions to consider libraries that offer higher precision. The conversation highlights the complexity of accurately calculating arc lengths and angles within specific quadrants.
Invutil
Messages
24
Reaction score
0
Given a unit-hypotenuse triangle, how do we get the inverse sin/cos/tan equations? I'm trying to program a high-precision fixed-fraction model of the sun and Earth and I've forgotten how the equations are derived. I know there's differentiation and integration. And I'm stuck on how to express the relation between opp/adj as angle.
 
Physics news on Phys.org
Invutil said:
Given a unit-hypotenuse triangle, how do we get the inverse sin/cos/tan equations? I'm trying to program a high-precision fixed-fraction model of the sun and Earth and I've forgotten how the equations are derived. I know there's differentiation and integration. And I'm stuck on how to express the relation between opp/adj as angle.
Trig.png

##\cos(\theta) = x##, ##\sin(\theta) = y##, and ##\tan(\theta) = \frac y x##
So ##\theta = \cos^{-1}(x)## and ##\theta = \sin^{-1}(x)## and ##\theta = \tan^{-1}(\frac y x)##
That seems to be what you're looking for. No differentiation or integration involved, just the relationships in the unit circle and inverse functions.
 
I think I remembered, to state asin/acos/atan as an approach to the arc (part of circumference) length formed by the triangle, so all that's needed is to set up those triangles touching the perimeter and approaching the arc length exactly as the measuring intervals become smaller and approach zero. I needed the exact methods to do this so I could derive my own trig functions (complicated c++ reason).
 
Invutil said:
I think I remembered, to state asin/acos/atan as an approach to the arc (part of circumference) length formed by the triangle, so all that's needed is to set up those triangles touching the perimeter and approaching the arc length exactly as the measuring intervals become smaller and approach zero.
I don't understand what you're saying here.
Invutil said:
I needed the exact methods to do this so I could derive my own trig functions (complicated c++ reason).
Possibly you were referrring to formulas such as this one:
##\tan^{-1}(x) = \int \frac{dx}{x^2 + 1}##. There's a related formula for ##\sin^{-1}(x)##.
 
I really appreciate your help. Here is what I was looking for:

Find: asin(o) = Φ

Given: o
o = yf
xf = √(1 - yf2)
0≤Φ≤π/2
x0 = 1
y0 = 0

Then:

lim n→∞ ( Σi=1n ( √( (xi - xi-1)2 + (yi - yi-1)2 ) ) )

y(i) = y0 + yfi/n

x(i) = √( 1 - y(i)2 )
trigasin.jpg
 
Last edited by a moderator:
Invutil said:
I really appreciate your help. Here is what I was looking for:

Find: asin(o) = Φ

Given: o
I have no idea what you're trying to do here, and the picture doesn't help any.
From the two lines above, you are apparently trying to find ##\Phi## and are given o. (BTW, it's a bad idea to use a variable named o or O, because both look like the number 0.)
Invutil said:
o = yf
?
What's the purpose of bringing in another variable?
Invutil said:
xf = √(1 - yf2)
0≤Φ≤π/2
x0 = 1
y0 = 0
As I said, the picture doesn't help much. For example, what is TA? It looks like it's the center of the circle, which should be at the origin. From your earlier comment, this is the unit circle, so the hypotenuses of both of your right triangles are 1 unit in length. Neither of the two right triangles has its angle at the origin identified, which makes things much more complicated than they need to be.
For the triangle with the solid lines, with the one vertex at ##(x_2, y_2)##, if its angle at the left vertex is ##\alpha##, then ##x_2 = \cos(\alpha)## and ##y_2 = \sin(\alpha)##. For the triangle with dotted lines, assuming its angle at the left vertex is ##\beta##, then ##x_0 = \cos(\beta)## and ##y_0 = \sin(\beta)##, NOT 1 and 0, respectively, that you show above.
Invutil said:
Then:

lim n→∞ ( Σi=1n ( √( (xi - xi-1)2 + (yi - yi-1)2 ) ) )
= what?
And what are you trying to do?
Invutil said:
y(i) = y0 + yfi/n

x(i) = √( 1 - y(i)2 )
View attachment 113685
 
I was trying to find arc length given an x or y of a unit length circle (full arc happens to be 2π so arc length corresponds to angle in radians). This is how asin etc work "under the hood" in calculators and computers. I needed the exact method instead of the floating point implementation, which doesn't have enough precision. The attached illustration isn't correct as I was trying to do it from memory but it would have overlapping triangles and all we really care about is the distances between successive points along the perimeter. Using this method I can plug in n=100+ to get as much precision as needed. It only works within the given quadrant because otherwise you can't interpolate the y coordinate between 0 and 1. For other quadrants, adjust the equation accordingly. "o" is opposite (over hypotenuse, which is 1).
 
Invutil said:
I was trying to find arc length given an x or y of a unit length circle (full arc happens to be 2π so arc length corresponds to angle in radians). This is how asin etc work "under the hood" in calculators and computers.
I don't believe that's true. My understanding is that calculators, especially, use an algorithm called CORDIC, which uses a combination of look up tables and shifts in the angles to do the calculations. Here's a link to one implementation in C: http://people.sc.fsu.edu/~jburkardt/c_src/cordic/cordic.c
If you scroll down you'll find an implementation of the arcsin function.
Invutil said:
I needed the exact method instead of the floating point implementation, which doesn't have enough precision.
Any summation you do, as in the limit you showed, will necessarily be inexact. If the floating point implementation isn't precise enough, look for a library that uses a larger representation for floating point numbers. In generatl, you're not going to get an exact value when a computer is doing the calculations.
Invutil said:
The attached illustration isn't correct as I was trying to do it from memory but it would have overlapping triangles and all we really care about is the distances between successive points along the perimeter. Using this method I can plug in n=100+ to get as much precision as needed. It only works within the given quadrant because otherwise you can't interpolate the y coordinate between 0 and 1. For other quadrants, adjust the equation accordingly. "o" is opposite (over hypotenuse, which is 1).

http://people.sc.fsu.edu/~jburkardt/c_src/cordic/cordic.c
 

Similar threads

  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 15 ·
Replies
15
Views
3K
  • · Replies 13 ·
Replies
13
Views
3K
  • · Replies 17 ·
Replies
17
Views
6K
Replies
8
Views
2K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K