1. Math formula (sin)

Hi,
I am working on a PHP/MySQL script where i need to apply a math formula.
Code:
sin(a) = m(V - b)
Here m and b are static values, which i already have, V is coming from a sensor live, so i need to calculate 'a' here.
something like:
Code:
a = sin(m(V - b))
But i am not sure, that how to move sin to other side and leave just 'a' on the left side.

Thanks. 2. Global Moderator            Join Date
Jun 2008
Location
Auckland, NZ
Posts
23,710
Blog Entries
1 Re: Math formula (sin)

From memory, I think you want the arcsine function:

a=asin(m(V - b)) 3. Re: Math formula (sin)

Thanks.
As i did like this way, which i know is wrong somehow.
Code:
\$a_x = sin(0.062763 * (\$ch410 - (-0.19564)));
\$a_y = sin(0.062763 * (\$ch411 - (-0.19564)));
The above give the output:

x: 2.52651224568
y: -1.27401076136
Now if i put the asin function:
Code:
\$a_x = asin(0.062763 * (\$ch410 - (-0.19564)));
\$a_y = asin(0.062763 * (\$ch411 - (-0.19564)));
The output is:
x: 2.55217155313
y: -1.27724895412
Which is also wrong. The output in this case would be:
x = 10
y = -5
In this case V is, which is \$ch410 and \$ch411:
x: 2.570
y: -1.585
I am sure, before putting the values in the formula, have to simply the formula 1st, then put values, but the hard part is that for me, to simply the formula 1st.

Any ideas?
Last edited by mmarif4u; 22-Oct-2009 at 02:03. Reason: Adding.. 4. Flux Capacitor Penguin              Join Date
Jun 2008
Location
UTC+10
Posts
9,683
Blog Entries
4 Re: Math formula (sin)

Remember that these trig functions usually expect input and generate output in radians, not degrees. 5. Re: Math formula (sin)

Agree with ken_yap. It's arcsine (sin^-1) you need - working here:

a = sin(m(V - b))

sin^-1 (a) = sin^-1 (sin(m(V-b)))

sin^-1 (a) = m(V-b)

And yeah, you need to use radians, not degrees. Convert degrees to radians like this:

I'd use the math constant pi in php rather than use an approximation. 6. Re: Math formula (sin)

Thanks guys for all your support and help.

PHP Code:
\$a_x asin(\$m * (\$ch410 \$b));
\$a_y asin(\$m * (\$ch411 \$b));

echo 