Further Examples: Solve
Polynomial equations in one variable
These are standard formulas for the solutions of normalized quadratic and cubic equations.
Here are two simple equations of higher degree with solutions in terms of powers. They can be rewritten in terms of trigonometric functions that sometimes automatically reduce to radicals.
For some equations, Mathematica produces the result in terms of Root objects (or algebraic numbers). The first argument of Root is an irreducible polynomial expressed as a pure function and the second argument identifies the choice of root.
We can get a numerical result by applying N.
This pulls all of the rules for x out of the result.
Polynomial equations in more than one variable
Here we solve for x and y.
In this case we eliminate y first and then solve for x.
Here we solve two simultaneous algebraic equations. The spurious potential solution is rejected.
Here are three simultaneous algebraic equations; y and z must be paired up correctly with x.
Here Solve returns an empty list, indicating no solution. Every potential solution forces an equation in the parameter z alone, so there are no generic solutions.
We can get solutions by solving for z as well as x and y.
We eliminate e, s, and t to get d in terms of the remaining variables.
Verification is not done by default for polynomial systems. The purported solutions to this system are nowhere near correct.
When there is numeric instability, setting VerifySolutions to True will take longer but will make the result more reliable.
In radical equations, Solve discards parasite solutions.
To see all candidate solutions, including parasites, set VerifySolutions to False.
If you can be sure that zero denominators will not affect the solution set, clearing them often makes Solve faster.
In:= expr =.
The equations that follow in the rest of this notebook come from various papers and from questions submitted by users.
Solve generates warning messages for many non-polynomial equations.
To improve readability, we will now suppress warning messages about inverse functions. These messages will be turned back on at the end of this set of examples.
Equations involving trigonometric or hyperbolic functions, or their inverses
Equations involving exponentials and logarithms
Equations or solutions that involve ProductLog
This last example comes from a typo in a quadratic.
Getting infinite solution sets for some equations
To each inverse of a trig or hyperbolic function Generalize adds n times the period of the corresponding trig or hyperbolic function. The second argument, n, indicates any integer.
Log and ProductLog are treated similarly.
Anything else is left alone.
GeneralizedSolve tries to give an infinite solution set indexed by n for an equation or set of equations in the variables vars.
This gives the generalized solution set for the equation.
This checks the results.
GeneralizedSolve fails when an inverse trigonometric function evaluates.
This is in contrast to the case when the inverse trig function remains unevaluated.
GeneralizedSolve can also give spurious solutions.
Here the solutions for x are wrong when n is .
When Solve gives a wrong answer
Here is a function.
There are purported solutions.
If Solve cannot determine that parametrized solutions are always incorrect, it will not remove them. The first solution is generally incorrect.
Using TrigToExp gives the right answers by converting ff to an equivalent exponential form.
There are correct solutions.
Turning messages back on
We will now turn the inverse function warning messages back on that were turned off earlier in this set of examples.