Message Boards Message Boards

How to limit variables in Solve[ ]?

Posted 1 month ago

Hello swarm intelligence,

I ran into an issue while trying to solve a problem.
Starting point is, that I have two 2D polar coordinate systems, that are offset to each other in x/y and are are turned by an unknown value and want to setup a calculation to find these three values.

Now I have two points of which I know the radial and and angular values for both systems. With these 4 values I did some trigonometry and came to the following equation, which I want to solve to x, with x being the angle difference between the two systems:

sin(a1 + x) s11)^2 + (s21 - cos(a1 + x) s11)^2 = (sin(a2 + x) s12)^2 + (s22 - cos(a2 + x) s12)^2

Which works with the command: solve (sin(a1 + x) s11)^2 + (s21 - cos(a1 + x) s11)^2 = (sin(a2 + x) s12)^2 + (s22 - cos(a2 + x) s12)^2 for x

But gives a multitude of solutions, since without limiting the values there are a multitude of solutions. Since I know that all my values are real numbers and my angles are within 0 to 2pi, I tried to limit the values through using assumptions. https://reference.wolfram.com/language/ref/Solve.html

But switching through multiple types of syntax found there, it screwed up the solving that the calculation wasn't recognized anymore.

tldr: how do I limit my variables and values to reduce the number of possible solutions?

POSTED BY: Reinhard Müller
4 Replies
Posted 1 month ago

The usual method of limiting variables in solve in WolframAlpha is

solve x^2=4,x>0 for x

You can try that with and without the ,x>0 and see the difference.

But I haven't been able to get that to work on your problem yet.

I stared at your problem for a while and think I was able to simplify it to

s11^2+s21^2+2*s12*s22*cos(a2+x) = s12^2+s22^2+2*s11*s21*cos(a1+x)

and that might help some, but doesn't seem like it is enough yet

POSTED BY: Bill Nelson

I'll Do some tinkering tomorrow again, I have an alternative calculation without the square but with tan, problem with that one was it didn't go though at all, Currently on the road, will post it tomorrow.

(s21-cos(a1+x)*s11)/cos(arctan(sin(a1)*s11/(s21-(cos(a1+x)*s11))))== (s22-cos(a2+x)*s12)/cos(arctan(sin(a2)*s12/(s22-(cos(a1+x)*s1))))
POSTED BY: Reinhard Müller

Thanks for your reply, when I Insert your equation into Wolfram alpha it calculated the sin(cos(x)). Am I missing something?

POSTED BY: Reinhard Müller

I found a symbolic solution with the change of variables Cos[x] -> u, Sin[x] -> v:

eq = Simplify[(Sin[a1 + x]  s11)^2 +
     (s21 - Cos[a1 + x]  s11)^2 ==
    (Sin[a2 + x]  s12)^2 +
     (s22 - Cos[a2 + x]  s12)^2];
Solve[{TrigExpand[eq] /. {Cos[x] -> u, Sin[x] -> v},
   u^2 + v^2 == 1},
  {u, v}] // Simplify
POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract