Rearanging trigonomety function

tomwebb64

New member
Joined
Jan 26, 2020
Messages
4
Hi, I've been trying to figure out how to rearrange this equation for A. I will be inputting all other variables, and I want this equation to return the angle A.
y=h-(4.905*(x/(v*cos(a)))^2+(x*tan(a)))
and help would be greatly appreciated.

The equation look like this:
1580052851052.png

I will be using it to find degrees and not radians.
 
Hello, and welcome to FMH! :)

Let's let \(\theta=A\cdot\dfrac{\pi}{180}\) and write:

[MATH]y=h-4.905\left(\frac{x}{v}\right)^2\sec^2(\theta)+\tan(\theta)x[/MATH]
Using a Pythagorean identity, we may write:

[MATH]y=h-4.905\left(\frac{x}{v}\right)^2(\tan^2(\theta)+1)+\tan(\theta)x[/MATH]
Arrange in standard form as quadratic in \(\tan(\theta)\):

[MATH]4.905\left(\frac{x}{v}\right)^2\tan^2(\theta)-x\tan(\theta)+4.905\left(\frac{x}{v}\right)^2+y-h=0[/MATH]
Now, apply the quadratic formula to get the two roots:

[MATH]\tan(\theta)=\frac{x\pm\sqrt{x^2-4\left(4.905\left(\frac{x}{v}\right)^2\right)\left(4.905\left(\frac{x}{v}\right)^2+y-h\right)}}{2\left(4.905\left(\frac{x}{v}\right)^2\right)}[/MATH]
Hence:

[MATH]\theta=\arctan\left(\frac{x\pm\sqrt{x^2-4\left(4.905\left(\frac{x}{v}\right)^2\right)\left(4.905\left(\frac{x}{v}\right)^2+y-h\right)}}{2\left(4.905\left(\frac{x}{v}\right)^2\right)}\right)[/MATH]
[MATH]A=\frac{180}{\pi}\arctan\left(\frac{x\pm\sqrt{x^2-4\left(4.905\left(\frac{x}{v}\right)^2\right)\left(4.905\left(\frac{x}{v}\right)^2+y-h\right)}}{2\left(4.905\left(\frac{x}{v}\right)^2\right)}\right)[/MATH]
 
Hi Mark,
Thank you for the quick response!
I have just implemented this into my work and it seems to be giving me values that are too high as the height of my arc cannot exceed 3
I tested with:
v=10
x=6
y=1.9
h=0.76

and am getting 2 degrees above 70, where there are actually 2 solutions below 40 degrees.
1580059076315.png
these value are also for some reason incorrect, I'm unsure why.

Is there a reason it won't return these lower values?

Or is there a way to return values only under 41 degrees. My velocity (v) is going to remain the same but the other values will be changed to multiple different values.

Thank you for your help!
 
Last edited:
Hello, Tom!

Using the formula I gave above, and the data for the parameters you provided, I find the approximate values:

[MATH]A\in\left\{30.32872901858822^{\circ},70.42923806980177^{\circ}\right\}[/MATH]
 
I must have typed it wrong. I am trying to implement it into a code I am writing for a project.
How would I convert your formula into a string, with only basic text (e.g. brackets, slashes ect.) I'm struggling to find my issue in the code

I have written them like this:
angle = (180/pi)*arctan((x+sqrt(sq(x)-(4*(4.905*sq(x/v))*4.905*sq(x/v)+y-h))/(2*4.905*sq(x/v))));
angle2 = (180/pi)*arctan((x-sqrt(sq(x)-(4*(4.905*sq(x/v))*4.905*sq(x/v)+y-h))/(2*4.905*sq(x/v))));

I have tried to translate back to math so it is easier for you to read. sq is is square, and sqrt is square root.
 
Here are the expressions I used at W|A to find the angles using the data you gave:

Smaller angle:

(180/pi)arctan((6-sqrt(6^2-4(4.905(6/10)^2)(4.905(6/10)^2+1.9-0.76)))/(2(4.905(6/10)^2)))

Larger angle:

(180/pi)arctan((6+sqrt(6^2-4(4.905(6/10)^2)(4.905(6/10)^2+1.9-0.76)))/(2(4.905(6/10)^2)))
 
I must have typed it wrong. I am trying to implement it into a code I am writing for a project.
How would I convert your formula into a string, with only basic text (e.g. brackets, slashes ect.) I'm struggling to find my issue in the code

I have written them like this:
angle = (180/pi)*arctan((x+sqrt(sq(x)-(4*(4.905*sq(x/v))*4.905*sq(x/v)+y-h))/(2*4.905*sq(x/v))));
angle2 = (180/pi)*arctan((x-sqrt(sq(x)-(4*(4.905*sq(x/v))*4.905*sq(x/v)+y-h))/(2*4.905*sq(x/v))));

I have tried to translate back to math so it is easier for you to read. sq is is square, and sqrt is square root.
Have you tried calculating Mark's solution using a calculator?

Since you are at the debugging stage - break up the equation into small chunks and then combine those.
 
I input your first expression into Notepad++ to make sure all the brackets are in the right place, and I find you should instead have:

(180/pi)*arctan((x+sqrt(sq(x)-(4*(4.905*sq(x/v))*4.905*sq(x/v)+y-h)))/(2*4.905*sq(x/v)))

(180/pi)*arctan((x-sqrt(sq(x)-(4*(4.905*sq(x/v))*4.905*sq(x/v)+y-h)))/(2*4.905*sq(x/v)))

You were only dividing the sqrt() function by the denominator.
 
Hi Mark,
I have found the issue, it was because the numbers had no decimal points so were treated as integers and not floats so it would round down the decimals. Thank you for your help, you have saved me a lot of hassle.
 
Top