How do I find all the solutions of an equation, if more than one solution exists?

22 views (last 30 days)
For example:
sin(x) = 0;
The above equation has infinite number of solutions. How can I get all of them?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
You cannot use MATLAB to generate all of the solutions of an equation. However, if you have the Extended Symbolic Math Toolbox (access to Maple), then you can do this in Maple.
You can do this by using the SOLVE fuction from Maple in the following manner:
maple('_EnvAllSolutions:= true;')
solve('sin(x) = 0')
The above commands set the the variable '_EnvAllSolutions' to true. This allows that all inverse transcendental functions are forced to return the entire set of solutions. This usually requires additional system-created variables, which take integer values. Normally such variables are named with prefix '_Z' for integer values, '_NN' for non-negative integer values and '_B' for binary values (0 and 1).
Thus, in the above situation,
solve('sin(x) = 0')
will return the generic solution
pi*_Z1
Here _Z1 represents all integer values. For every integer value, there exists a solution. The principal solution is when _Z1 is zero, or "pi * 0".
More information on the above can be found by typing 'mhelp solve' at the MATLAB command prompt.

More Answers (0)

Categories

Find more on Symbolic Math Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!