Solving equations > q := 3*x^2 -5*x +2; 2 q := 3 x - 5 x + 2 > solve(q=0); 2/3, 1 1. Use subs to check your result: > subs(x=1,q); 0 Sometimes solutions are irrational numbers: > solve(x^2 -3=0); 1/2 1/2 3 , -3 > solve(3*x^2 -5*x +1=0); 1/2 1/2 5/6 + 1/6 13 , 5/6 - 1/6 13 2. You may wish to have decimal approximation for these solutions: > fsolve(3*x^2 -5*x +1=0); .2324081208, 1.434258546 3. You acess the student package using the with statement: > with(student); [D, Diff, Doubleint, Int, Limit, Lineint, Product, Sum, Tripleint, changevar, combine, completesquare, distance, equate, extrema, integrand, intercept, intparts, isolate, leftbox, leftsum, makeproc, maximize, middlebox, middlesum, midpoint, minimize, powsubs, rightbox, rightsum, showtangent, simpson, slope, trapezoid, value] > 3*x^2 -5*x +1=0; 2 3 x - 5 x + 1 = 0 > completesquare(",x); 2 13 3 (x - 5/6) - -- = 0 12 > isolate(",x-5/6); 2 x - 5/6 = RootOf(36 _Z - 13) > isolate(",x); 2 x = RootOf(36 _Z - 13) + 5/6 3. Some equations have complex solutions: > solve(x^2 +1=0); I, -I > solve(3*x^2 -5*x +7=0); 1/2 1/2 5/6 + 1/6 I 59 , 5/6 - 1/6 I 59 > fsolve(3*x^2 -5*x +7=0); The fsolve command finds only real numbers solutions. > solve(3*x^2 -5*x +7=0); 1/2 1/2 5/6 + 1/6 I 59 , 5/6 - 1/6 I 59 > s := "; 1/2 1/2 s := 5/6 + 1/6 I 59 , 5/6 - 1/6 I 59 4. The variable s is a sequence with two elements. You can acess each solution separetely: > eval(s[1]); 1/2 5/6 + 1/6 I 59 > evalf(s[1]); .8333333333 + 1.280190958 I > eval(s[2]); 1/2 5/6 - 1/6 I 59 > evalf(s[2]); .8333333333 - 1.280190958 I 5. You can solve polynomial equations of higher degree than 2.: > q := 6*x^4 -35*x^3 +22*x^2 +17*x -10; 4 3 2 q := 6 x - 35 x + 22 x + 17 x - 10 > solve(q=0); 1, -2/3, 5, 1/2 > solve(q=1); 4 3 2 RootOf(6 _Z - 35 _Z + 22 _Z + 17 _Z - 11) > fsolve(q=1); -.6814339806, .5708552757, .9422797802, 5.001632258 > plot(q-1, x=-1..2); Other Types of Equations 1. You can solve many trigonometric equations: > p := cos(x) -sin(x); p := cos(x) - sin(x) > solve(p=0); 1/4 Pi 2. The solve command usually returns a single solution to nonpolynomial equations even if there are many solutions. > plot(p,x=0..2*Pi); > fsolve(p=0, x=1.5..4); 3.926990817 > fsolve(p=0,x, 1.5..4); 3.926990817 > evalf("/Pi); 1.250000000 3. You ca solve logarithmic equations also: > solve(ln(x) + ln(x+1) = ln(2)); 1 > solve(2^x=5); ln(5) ----- ln(2) > fsolve(2^x=5); 2.321928095 4. You can solve inequalities: > solve(x^2 -5*x < 0); RealRange(Open(0), Open(5)) > solve(x^2 -5*x >=0); RealRange(-infinity, 0), RealRange(5, infinity) 5. You can also solve systems of equations: > s := solve ({x+y=5, x-y=2},{x,y}); s := {y = 3/2, x = 7/2} > subs(",x+y=5); 5 = 5 > plot({5-x,x-2},x=-4..4); > solve({x+y=5., x-y=2},{x,y}); {x = 3.500000000, y = 1.500000000} >