Hey, I need help to use values from two different textboxes and show the result in the third box.
Box1: 15 (adjacent)
Box2: 115 (hyptotenuse)
Box3: I need the sin angle
Anybody that can help me with the "Math.asin" code for this?
Thank u in advance!!
Why do I have the feeling we are doing your math homework? 🙂
The formula to determine the angle when the adjacent and hyotenuse are given, is cos(alpha) = adjacent/hypotenuse
So alpha = arccos(adjacent/hyponeuse)
var adj = this.getField("Box1").value; var hyp = this.getField("Box2").value; event.value = Math.acos(adj/hyp);
You will use this as the custom calculation script for Box3. This code is not doing any error checking, so you may end up with an exception. I'll leave that up to you to add. Also, the angle is expressed in rad, so you will have to convert to degrees.
Thank You very much for taking the time to answer!
Hehe, This got nothing to do with math homework. Im a studentpilot and we use a navigation pdf form. And it takes so much time by plotting and calculating. Im trying to make the form as much as possible automatic with as few inputs.
I found a code on this support community and made some modifications and it work. The only problem I have is to get the angle from rad to deg. Could you be so kind to take the time to help me again?
The code I found and modified looks like this;
var v1 = Number(this.getField("TextField5").valueAsString);
var v2 = Number(this.getField("TextField6").valueAsString);
var v3 = Math.asin(v2/v1);
if (v3==0) event.value = "";
else event.value = v3;
Change this line "var v3 = Math.asin(v2/v1);" to this:
var v3 = Math.asin(v2/v1) * 180 / Math.PI;
One more thing: When you use asin, you are getting the ange for the opposite side, not the adjacent.
I know, I meant to write opposite side from the start. Thank you for answering and have a nice day!