Sin (x) = Sin (y) sqrt(2)

walter-

New member
Joined
Aug 31, 2020
Messages
17
I came across this result when checking relations between angles in a cube.

Sin (x) = Sin (y) Sqrt(2)
- sorry don't have a quick proper math functions write-up.

Can I write x in some nice form of y?
Apart from the trivial x = ArcSin (Sin (y).Sqrt(2)).
Is there a nicer solution? x = simple function (y)? Where I don't see Arcsin as a simple function ;-).

While writing this, I was wondering if it could been proven that it is not the case , if it was not the case ;-).

Thanks in advance.

Walter
 
I came across this result when checking relations between angles in a cube.

Sin (x) = Sin (y) Sqrt(2)
- sorry don't have a quick proper math functions write-up.

Can I write x in some nice form of y?
Apart from the trivial x = ArcSin (Sin (y).Sqrt(2)).
Is there a nicer solution? x = simple function (y)? Where I don't see Arcsin as a simple function ;-).

While writing this, I was wondering if it could been proven that it is not the case , if it was not the case ;-).

Thanks in advance.

Walter
Why would you want to do that? What is the actual problem?

If \(\displaystyle sin(\theta) \ = \ \frac{1}{\sqrt{2}}........... \ can \ you \ calculate \ the \ value \ of \ \theta \ in \ radians\)?
 
On the why; because I want to know ;-).
Other reason is that the programming language on a drone doesn't have an arcsin.
 
with the first reaction; does it mean it is not possible?
It simply means that - we do not know what will be "nice form of y" in the environment of "drone programming" language!
 
On the why; because I want to know ;-).
Other reason is that the programming language on a drone doesn't have an arcsin.
Tell us what functions ARE available! Does it have arctan?

Do you see why we ask you to tell us the context and specific issues from the start, to avoid wasting time on other issues?
 
NOTE that in many programming languages the "arcsin" function is called "asin". Is such a function available in the drone environment?

If there really is no asin function, then there are ways to get around it. Here are 3 ways I can think of...

1. an iterative technique, like Newton Raphson, to obtain the answer
2. a series expansion, like the Taylor series
3. polynomial curve fitting

We could help you through the process of choosing/ implementing the above. But first we want more detail to make sure there isn't a simple and quick solution that you've missed. So please tell us more about the programming language that you have available (is there online documentation for this language?)
 
I need to clarify a bit more. The issue on the drone is more a performance issue. Doing both a Sin and a Arcsin could cause too much delay in the calculations (it is not so much functions are not there: they are slow and loading the library could also bring a memory challenge).

So if possible I would like to prevent to first do a Sin(y) and then the ArcSin.

Anyone seeing a simplification possible in the formula?

note: working out the options Cubist is giving I can do; that is not the issue. But most probably we try a different approach in measuring the angles to prevent these calculations.
 
Have you tried switching to the float versions of the trig functions, sinf() and asinf(), if they are available? These might offer some performance increase.

If you don't need too much accuracy then option 2 or 3 in my above post#10 could be made very fast (since you wouldn't require a very high degree polynomial). Also, is there a limited domain of y values for the input?
 
Of course there is a limited domain for y. From the equation you read that it has to have a sin <=1/sqrt(2) which even matches reality ;-).
But don't focus too much on the software part. I can work around that. My main question is if that relation can be simplified - out of an interest.

I try once to post where the problem comes from.
In the attempts I didn't find a way to write X and Y in a more simple formally. I can not manage to get sqrt(2) into the sin(y) in some form so that I could cancel out the sin functions. Or any other way to rewrite the equation that cancel the trigonometric functions.
 
There isn't a simpler way of writing that relationship mathematically. (None that I'm aware of anyway.)

Of course there is a limited domain for y. From the equation you read that it has to have a sin <=1/sqrt(2) which even matches reality ;-).

I was just asking about the domain (in your particular use case) because if you had said -0.1 < y < 0.1 then x=sqrt(2)*y is a great approximation (the error would be less than 0.00024). FYI This is a single term Maclaurin series of asin(sqrt(2)*sin(y)).
 
There isn't a simpler way of writing that relationship mathematically. (None that I'm aware of anyway.)
...
Tnx.
I try to make the drawing once and post it here from where the problem comes.

I am still suprised that I couldn't write the relation easier. But without the drawing I cannot share my surprise here ;-).
 
It would be interesting to see where this comes from, if you get the time.

Here's my attempt at a poly fit solution in the domain 0 to pi/4. On my computer It is 5.1 times faster than the original function (using asinf and sinf). The accuracy is better than 0.0072
C:
// Function is split into three domains
float x;
if (y > 0.78f)
  // Use double accuracy near to pi/4 (no f at the end of these numbers)...
  x = ((879646.8458835964556783*y - 2063049.9811751949600875)*y + 1612844.5215290130581707)*y - 420295.8240858826902695;
else if (y > 0.7f)
  x = ((380.5417042485983075f*y - 820.1819337824732656f)*y + 592.0969234618906967f)*y - 141.9612750399370213f;
else
  x = ((1.0605222435210022f*y - 0.5923191618780694f)*y + 1.5291518738734731f)*y - 0.0042501922992217f;
 
Last edited:
Thanks for the input! That accuracy is probably better then the measurement;-).
Now I am obliged to give the origin of the problem ;-).
 
20200903_194022.jpg
The story: a square OABC can rotate around the Z-axis. His rotation is the angle x. This angle x we want to know.
A measuring device returns the angle y which is between the diagonal AC and line AP.
Based on the measured y i want to know the angle x.
For the calculation of x I use the line CP, share by the right triangles linked to angles x and y. And lets take the length of the side of the square all as 1.
This gives that CP = sin(y) sqrt(2) since AC = sqrt(2) and we also get CP = sin(x). Which gives as a result that sin(x) = sqrt(2) sin(y).

And here I was suprised since i was expecting an 'easier' relation between the 2 angles. And from the few measurements we did the calculation from the measurement seems correct.
And I like to be corrected if I missed somethings. It has been 35 years since i looked into these theories ;-).
 
View attachment 21385
The story: a square OABC can rotate around the Z-axis. His rotation is the angle x. This angle x we want to know.
A measuring device returns the angle y which is between the diagonal AC and line AP.
Based on the measured y i want to know the angle x.
For the calculation of x I use the line CP, share by the right triangles linked to angles x and y. And lets take the length of the side of the square all as 1.
This gives that CP = sin(y) sqrt(2) since AC = sqrt(2) and we also get CP = sin(x). Which gives as a result that sin(x) = sqrt(2) sin(y).

And here I was suprised since i was expecting an 'easier' relation between the 2 angles. And from the few measurements we did the calculation from the measurement seems correct.
And I like to be corrected if I missed somethings. It has been 35 years since i looked into these theories ;-).
How did you get:

PC = \(\displaystyle \sqrt{2} \ \ \)*sin(y) ????
 
Top