# Math formula (sin)

Hi,
I am working on a PHP/MySQL script where i need to apply a math formula.

``````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:

``````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.

Any ideas about this math formula.
Thanks.

From memory, I think you want the arcsine function:

a=asin(m(V - b))

Thanks.
As i did like this way, which i know is wrong somehow.

``````\$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:

``````\$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?

Remember that these trig functions usually expect input and generate output in radians, not degrees.

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:

radians = degrees * (pi/180).

I’d use the math constant pi in php rather than use an approximation.

Thanks guys for all your support and help.
That rad2deg did the job.

``````\$a_x = asin(\$m * (\$ch410 - \$b));
\$a_y = asin(\$m * (\$ch411 - \$b));

echo rad2deg(\$a_x).'<br />';
echo rad2deg(\$a_y).'<br />';
``````

Thanks again Kenyap and weighty_foe and deano_ferrari.