Introduction to Mathematica

Introduction to Mathematica - Introduction to Mathematica...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
Introduction to Mathematica Seth F. Oppenheimer The purpose of this handout is to familiarize you with Mathematica. The Mathematics and Statistics Department computer lab is on the fourth floor of Allen Hall and is open most afternoons and evenings. You will need your netID and password to log on. What you will now see is a printout of an actual Mathematica session. Mathematica can act as a scientific calculator as in the examples below: 2+3.6 In order to evaluate this, you must hold the shift key and while holding the shift key, press enter or return. 5.6 Sin[Pi/4] 1 ------- ------ Sqrt[2] Now that is an exact answer! We can use the notation %25 to indicate output 25. The command N[ ] yields a numerical approxi- mation for what is in the square brackets. N[ , 100] would give that approximation to 100 places. %25 1 ------- ------ Sqrt[2] N[%25] 0.707107 N[%25,100] 0.707106781186547524400844362104849039284835937688474\ 0365883398689953662392310535194251937671638207864 N[Pi] 3.14159
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
N[Pi,30] 3.14159265358979323846264338328 Cool, huh? Case matters in Mathematica. All built in functions such as Sin, Cos, Exp, Sqrt, and so on are started with upper case letters. When you define your own functions, make sure you spell them with lower case letters. Let us define a function f that takes a number squares it and adds three to that square. f[x_]:= x^2 + 3 We may now evaluate f at a variety of numbers: f[2] 7 f[47] 2212 f[-32] 1027 We can now plot f, differentiate it with respect to x, find the indefinite integral of f with respect to x. Plot[f[x],{x,-3,4}] -3 -2 -1 1 2 3 4 2.5 5 7.5 10 12.5 15 17.5 -Graphics- D[f[x],x] 2 x 2 intro1c.nb
Background image of page 2
Integrate[f[x],x] 3 x 3 x + -- - 3 Notice that you have to provide the arbitrary constant. Now we can take definite integrals as well, say from 1 to 3: Integrate[f[x],{x,1,3}] 44 -- - 3 We can even do three dimensional graphs and parametric plots in one and two dimensions: g[x_,y_] := x^2 - y^2 Plot3D[g[x,y],{x,-2,2},{y,-2,2}] -2 -1 0 1 2 -2 -1 0 1 2 -4 -2 0 2 4 -SurfaceGraphics- Now let us plot the parametric curve of (Sin[t],t Cos[t]) as t goes from 0 to 4 Pi. intro1c.nb 3
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
ParametricPlot[{Sin[t], t Cos[t]},{t,0,4 Pi}] -1 -0.5 0.5 1 -10 -5 5 10 -Graphics- Or how about the helix in three dimensions given by (Cos[4 t],Sin[4 t],t) for t from 0 to Pi?
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 08/21/2008 for the course DE 3253 taught by Professor Oppenheimer during the Spring '08 term at Mississippi State.

Page1 / 11

Introduction to Mathematica - Introduction to Mathematica...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online