1. Plot a function to help determine the location of its zeros.

> f := x -> x^6 - 3*x^5 - 5*x^4 + 15*x^3 + 4*x^2 - 12*x ; 

> plot( f(x), x = -4..4 ) ;  

  1. To solve a function for its zeros, use solve (maple will try to find all zeros, whether real or complex)

> f := x -> x^6 - 3*x^5 - 5*x^4 + 15*x^3 + 4*x^2 - 12*x ; 

> solve( f(x), x ) ;  

  1. To solve a function for its real zeros, use fsolve

> f := x -> x^6 - 3*x^5 - 5*x^4 + 15*x^3 + 4*x^2 - 12*x ; 

> fsolve( f(x), x ) ;  tries to find all real zeros

> fsolve( f(x), x = 0..4 ) ;  tries to find all real zeros between 0 & 4 

  1. Example

> f := x -> x^6 - x^5 + 6*x^4 - 4*x^3 - 29*x^2 + 45*x - 18 ; 

> plot( f(x), x = -2..2 ) ; 

> solve( f(x), x ) ;  result: -2, 3I, -3I, 1, 1, 1

> fsolve( f(x), x ) ;  result: -2., 1., 1., 1.

> fsolve( f(x), x = 0..2 );  result: 1., 1., 1.

NOTE: The complex number i is I 


  1. Example: Point of Intersection of Two Functions. 

> f := x -> cos(x); 

> g := x -> sqrt(x); 

> plot( { f(x), g(x) }, x = 0..1 ) ;  plots f and g on a common graph

> fsolve( f(x) = g(x), x = 0..1 ) ;  determines where functions f and g intersect between x=0 & 1

  1. Example

> f := x -> 2*x^4 - 15*x^3 + 60*x^2 - 115*x + 78 ; 

> plot( f(x), x = 1..3, -2..10 ) ; 

> solve( f(x), x ) ;  result: 2, 3/2, 2+3I, 2-3I

> fsolve( f(x), x ) ;  result: 2.000000000, 1.500000000 

  1. Example: (This function has infinitely many zeros)

> f := x -> exp(-x) - cos(x) ; 

> solve( f(x), x ) ;  result: 0

> fsolve( f(x), x ) ;  result: 0

> fsolve( f(x), x = 1..2 ) ;  result: 1.292695719

> fsolve( f(x), x = -1..1 ) ;  result: 0

NOTE: The above example illustrates that maple might not find all zeros of a function. Thus, you should have a good idea of where the zeros are without trusting maple to find them correctly.


  1. Solving a System of Equations for Several Unknowns. 
    For example, to solve the two equations for two unknowns:

x2 + y2 = 9 
x - y = 1

> eq1 := x^2 + y^2 = 9 ; 

> eq2 := x - y = 1 ; 

> with( plots, implicitplot ) ;  loads the implicitplot command

> implicitplot( { eq1, eq2 }, x = -4..4, y = -4..4 ) ;  
plots both equations in the xy-plane on the specified range

> solve( { eq1, eq2 }, {x,y} ) ;  
tries to solve the system symbolically - it may not succeed

> fsolve( { eq1, eq2 } , {x,y} ) ;  
tries to solve the system numerically, but may give only one solution since no range is specified

> fsolve( { eq1, eq2 } , {x,y} , { x = 0..3, y = 0..3 } ) ;  
solves the system numerically on the specified range

> fsolve( { eq1, eq2 } , {x,y}, { x = -3..0, y = -3..0 } ) ;  
solves the system numerically on the specified range

> ?implicitplot  for more help with the implicitplot command

> ?fsolve  for more help with the fsolve command

Note: As the example shows, solve can have difficulty solving nonlinear equations (this shouldn't be surprising). You might have to use fsolve to approximate the solution using floating point arithmetic. To successfully use fsolve to solve a nonlinear system, you should give a range over which fsolve is to look for the solution.