Examples:
eq1 := x + 2*y = 3
eq2 := (x+1)^2 – 2y = 2
solve({eq1,eq2},{x,y})
with(plots):
implicitplot([eq1,eq2], x=-5..5, y=-5..5)Comment: Note that there are two solution (x,y) points. The plot shows that the line corresponding to the linear equation intersects the parabola at two points.
eq3 := x^2-y=4
eq4 := -2*x^2-y=-23
with(plots):
implicitplot([eq3, eq4], x=-4..4, y=-10..10)
sol34 := solve({eq3, eq4}, {x, y})Comment: Note that Maple was able to find the intersection points of these two parabolas, both equations being non-linear.
eq5 := y^2=x+2
eq6 := y=x
with(plots):
implicitplot([eq5, eq6], x=-10..10, y=-10..10)
sol56 := solve({eq5, eq6}, {x, y})Comment: Note that Maple solves for the roots of multi-valued functions like the first in this set.
eq7 := y=x^2
eq8 := y=x+4
with(plots):
implicitplot([eq7, eq8], x=-10..10, y=-5..100)
sol78 := solve({eq7, eq8}, {x, y})Comment: The result returned by Maple does not look like a solution and contains RootOf in the result. This means that Maple has created this intermediate result and is asking if it could possibly be true that you are seeking more than one root. Respond by typing the command
allvalues(sol78)
. Maple will then return the two roots. Always try theallvalues(name)
command when you see RootOf in the result generated by Maple. This will usually complete the solution of the problem.eq9 := y=ln(x)
eq10 := y-3=-2*x
with(plots):
implicitplot([eq9, eq10], x=-3.5..10, y=-10..10)
sol910 := solve({eq9, eq10}, {x, y})Comment: The solve command fails to return a solution to this system of equations that includes a non-linear equation involving the logarithm. Use fsolve({eq9, eq10}, {x, y}) to get a decimal value.
eq11 := y^2=ln(x)
eq12 := y+3=2*x
with(plots):
implicitplot([eq11, eq12], x=-3.5..10, y=-10..10)
sol1112 := solve({eq11, eq12}, {x, y})Comment: The solve command fails to give a result. This set of equations will have to be solved using the 'Solve numerically' option. See the next example.
nonlinearEqs:= {y^2=ln(x), y+3=2*x}
fsolve(nonlinearEqs, {x,y}, x=1..1.5, y=-2..0)
fsolve(nonlinearEqs, {x,y}, x=1.5..2, y=0..2)Comment: Use the
fsolve
command to solve numerically rather than the right-click option because there are multiple roots. The first execution offsolve
finds the root below the x-axis and the second execution finds the root above the x-axis by specifying ranges of x and y that bracket that particular root.{eq1,eq2}
Right-click the set of equations and select ‘Solve’ from the menu of options. Note that the solutions are the same as the first example. Right-click the set of equations and plot them.{ x^2-y=4, -2*x^2-y=-23 }
Right-click the set of equations and select ‘Plots->2D implicit plot->x,y’ to see the two curves and where they intersect. Now right-click the set of equations and select ‘Solve’ to find the solutions.Comment: Note that Maple was able to find the intersection points of these two parabolas, both equations being non-linear.
{y^2=x+2, y=x}
Right-click the set of equations and select ‘Plots->2D implicit plot->x,y’ and then right-click and select ‘Solve’ from the menu of options.Comment: Note that Maple solves for the roots of multi-valued functions like the first in this set.
{y=x^2, y=x+4}
Right-click the set of equations and select ‘Plots->2D implicit plot->x,y’ to see that there are two points of intersection and thus two roots. Right-click the set of equations and select ‘Solve’ from the menu of options.Comment: The result returned by Maple does not look like a solution and contains RootOf in the result. This means that Maple has created this intermediate result and is asking if it could possibly be true that you are seeking more than one root. Respond by right-clicking the result and assigning a name to it. Then type the command
allvalues(name)
. Maple will then return the two roots. Always try theallvalues(name)
command when you see RootOf in the result generated by Maple. This will usually complete the solution of the problem.{y=ln(x), y-3=-2*x}
Right-click the set of equations and select ‘Plots->2D implicit plot->x,y’. Right-click the set of equations and select ‘Solve’.Comment: The solve command fails to return a solution to this system of equations that includes a non-linear equation involving the logarithm. Right-click again and use the ‘Solve numerically’ option to get a decimal result.
{y^2=ln(x), y+3=2*x}
Right-click this set of equations and select ‘Plots->2D implicit plot->x,y’ to see that the first equation is multi-valued. Right-click the set of equations again and select ‘Solve’.Comment: The solve command fails to give a result. This set of equations will have to be solved using the 'Solve numerically' option. See example 7.