Symbolic solution trigonometric equation

3 vues (au cours des 30 derniers jours)
Selcuk Sakar
Selcuk Sakar le 21 Jan 2020
Commenté : John D'Errico le 21 Jan 2020
Hi, I need to solve the equation below
a * sin(bx) + sin(cx) = 0
is there any solution in matlab ?
  1 commentaire
Star Strider
Star Strider le 21 Jan 2020
There are infinitely many of them!

Connectez-vous pour commenter.

Réponses (1)

John D'Errico
John D'Errico le 21 Jan 2020
Modifié(e) : John D'Errico le 21 Jan 2020
Why not try it?
syms a b c x
>> xsol = solve(a*sin(b*x) + sin(c*x) == 0,x)
Warning: Unable to find explicit solution. For options, see help.
> In solve (line 317)
xsol =
Empty sym: 0-by-1
So no explicit solution, something that leaves me completely un-amazed. We know there is a trivial solution at x==0. And we should expect there are infinitely many solutions. But for completely general a, b, and c, I fully expect there to be no analytical solutions. It is trivially easy to write problems that have no analytical solutions.
However, if you pick some specific values of a, b and c, then you can find some of the infintiely many solutions. There will still probably be no analytical solution for most values of a, b, and c however.
xsol = vpasolve(subs(a*sin(b*x) + sin(c*x) == 0,[a b c],[5 2 3]),x)
xsol =
0
xsol = vpasolve(subs(a*sin(b*x) + sin(c*x) == 0,[a b c],[5 2 3]),x,2)
xsol =
1.4743556987697957311362366207334
xsol = vpasolve(subs(a*sin(b*x) + sin(c*x) == 0,[a b c],[5 2 3]),x,3)
xsol =
3.1415926535897932384626433832795
Change the start point for the search, and vpasolve will (sometimes) find a different solution.
Of course, I could have done the same using fzero. But in no case could I solve the problem for a fully general set of unknown parameters a, b, c. You can always hope for magic to happen, but usually all you get is your computer stifling a computational chuckle, as you give it some impossible problem to solve.
If b anc c are reasonably chosen small integers, then you can sometimes get lucky...
xsol = solve(subs(a*sin(b*x) + sin(c*x) == 0,[b c],[2 3]),x)
xsol =
0
-acos(- a/4 - (a^2 + 4)^(1/2)/4)
-acos((a^2 + 4)^(1/2)/4 - a/4)
acos(- a/4 - (a^2 + 4)^(1/2)/4)
acos((a^2 + 4)^(1/2)/4 - a/4)
So here we see a set of solutions for fixed, known values of b and c, but unknown parametric a. Expect that to get fairly nasty looking even if a solution exists for larger integer values of b and c. If b and c are fully general floating point values, then you should probably give up hope.
xsol = solve(subs(a*sin(b*x) + sin(c*x) == 0,[b c],rand(1,2)),x)
Warning: Unable to find explicit solution. For options, see help.
> In solve (line 317)
xsol =
Empty sym: 0-by-1
  2 commentaires
John D'Errico
John D'Errico le 21 Jan 2020
By the way, please don't use an answer just to make a comment.
Answer by @Selcuk Sakar moved to a comment:
"Hmmm, i see.. it is not straight forward. Thanks for your valuable constribution."
John D'Errico
John D'Errico le 21 Jan 2020
Here is another way to view it. Suppose you knew that b==1, and c==2? How would you go about solving it on paper?
If b and c are small integers, then you can substitute:
u = sin(x)
But what is sin(2*x), in terms of sin(x)? That is, can you now re-write sin(2*x) in terms of u? Yes.
sin(2*x) = 2*sin(x)*cos(x)
therefore we could rewrite the original problem in terms of u, as
a*u + 2*u*sqrt(1-u^2) == 0
by some judicious algebra, we could now solve for all roots of what is now essentially a polynomial equation for u, even though a is unknown. Once you knopw the possible values for u, now you could recover x.
So all would be good in the world if b and c are known and small integers, because you can always do a similar substitution. But even for moderately larger integer values of u, the result will be equivalent to a polynomial equation of degree at least 5. at that point, Abel-Ruffini takes over, preventing us from solving the polynomial equation for u, in any algebraic form. At best, you could use a tool like fzero or vpasolve, as I did.
Worse, when b and/or c are general floating point numbers, all gets far worse. Now you can no longer even easily convert this to a polynomial equation, even if a very high order one.
So, what happens when b and c are completely unknown? All must fail now. No solution will ever be possible. At best you can find numerical solutions for fixed values of the parameters.

Connectez-vous pour commenter.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by