


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



Mathematics Computer Lab oratory - Math 1200 Lab 2 - Mathematica Basics I I
x = 5; y = 12; z = a + b;
Enter all of them in just one cell; you may enter each on a separate line or all on one line. If you typ e in more than one on the same line, b e sure to separate them by semicolons. The nal semicolon in a line suppresses the nal output. If you have used all the semicolons, you should not get any output! Now evaluate the following.
(a) x (This should give the assigned value of x which is 5 .) (b) z (This should give the expression that z stands for: a + b .) (c) x y^2 (Rememb er to insert the space b etween x and y to indicate a pro duct.) (d) Expand[z^x] (This is (a + b)^5 .)
(a) Clear[x,y,z] (b) x (You should get x and not its previous value of 5 .) It is a go o d idea to clear each variable after its use, otherwise its reuse will give unintended results.
(a) f=x^2+3x+2; g=(2x+3)(5x-2);h=2/(x-3)-1/(x-1);k=(x+5)/((x+2)(x+3)); (As b efore, you may enter them on one or more lines.) (b) f (If the output is a numb er, you have forgotten to clear the variable x in the last step.) (c) Factor[f]
(a) Solve[3x-8==4] (If the output is an empty set, either this equation has no solution or you have forgotten to clear the value of x earlier. Check you answer.) (b) Solve[z^2+2z==-2] (Did you clear z earlier? What typ e of numb ers are the solutions? When do es a quadratic equation have two complex conjugate solutions?) (c) Solve[a t-2==3a, t] The t after the comma indicates that the equation should b e solved for t and not a. Simplify your answer; (Simplify[%]).
(a) f = x^2-3x-4; Solve[f==0] (This solves the equation f = 0 where f = x^2 3 x 4. Check your answers.) (b) Clear[f] (c) g = 1/(x-2); h = 4/(x+1); (d) Solve[g==h] (This solves the equation (^) x ^12 =^ x+1^4 .) (e) Clear[g,h]
(a) Solve[{x-2y==4,x-1==5y}, {x,y}] This is the 2 2 linear system of equations: x 2 y = 4 and x 1 = 5 y. To solve two or more equations simultaneously, enter the equations and the variables you want to solve for as lists. In Mathematica's syntax a list is any collection of terms separated by commas and group ed by braces. (b) Solve[{3x-4y==4,x+2y==7}, {x,y}] (c) f = 2x+y; g = 5x+2y; (d) Solve[{f==2, g==3},{x,y}] (This solves the system of equations 2 x + y = 2 and 5 x + 2 y = 3 .) (f ) Clear[f,g]
(a) f[x_]:=-x^2+4x+5; g[x_]:=E^(x) (b) Plot[{f[x], g[x]}, {x,-2,4}] To graph two or more functions on the same co ordinate system, enter them as \lists" which means group ed in braces and separated by commas. (c) Read o the co ordinates of their two p oints of intersections. (Click on the graph, hold down the Ctrl key (the Alt key or equivalent on some machines) and move the cursor over to p oints of intersection) (d) NSolve[f[x]==g[x]] Notice that Mathematica can not solve this equation using the NSolve command, but you were able to read o approximate solutions using the graph in part c. (e) Clear[f,g]
Now use Mathematica and what you have learned so far in the following exercises.
A. Input the expressions f = x x +1^1 ^ x x+1 1 ,^ g^ =^ ^2 x^4 ^11 x^3 ^16 x^2 ^ x^ +^5 and^ h^ =^ (x 2)(2^4 x+1x+3).
(i) Simplify the expression named f. (Use the Simplify function.) (ii) Rewrite f as a single fraction. (Use the Together function.) (iii) Are the answers in the last two parts equivalent? if not, what is the di erence? (iv) Factor g. (v) Rewrite h as sum or di erence of two fractions. (Use the Apart function.) (vi) Clear the variables f , g and h.
B. Solve the following equations using b oth Solve and NSolve functions.
(i) 15 x^4 38 x + 7 = 38 x^3 22 x^2 (ii) The system 2 x = 7 y 4 and 3 x + 2 y = 6. (iii) The system y = x^2 3 x 4 and y + x = 6 x^2.
C. Input the expressions f (x) = x x+1 1 and^ g^ (x)^ =^ x^2 ^2 x^ +^3 and^ p^ erform^ the^ following^ steps.
(i) Draw the graph of y = f (x) form x = 1 to x = 3. (ii) Draw the graphs of y = f (x) and y = g (x) on the same co ordinate system with the same domain. (iii) Redraw these graphs by cho osing an appropriate short domain so that the p oint of intersection of the two graphs is clearly visible. (iv) Read o the co ordinates of the p oint of intersection. (v) Solve the equation f (x) = g (x). Compare the real solution of this equation with the x-co ordinate of the p oint of intersection. (vi) Clear the two functions.