1 / 91

Symbolic Software Lab Fall Semester 2010 Dr. Stefan Maubach

Symbolic Software Lab Fall Semester 2010 Dr. Stefan Maubach. What is this course about?. Part I: Three weeks of Mathematica Part II: One week of. evaluation. 4 weekly assignmenets, each 25% each due on the Wednesday 23:59 of the following week. late homeworks policy.

malia
Télécharger la présentation

Symbolic Software Lab Fall Semester 2010 Dr. Stefan Maubach

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Symbolic Software LabFall Semester 2010Dr. Stefan Maubach

  2. What is this course about? • Part I: Three weeks of Mathematica • Part II: One week of

  3. evaluation • 4 weekly assignmenets, each 25% • each due on the Wednesday 23:59 of the following week. • late homeworks policy

  4. Story of Mathematica • Steven Wolfram • born 1959 in London • received Ph.D. from Caltech at the age of 20 • Mathematica released in 1988 • Interest in cellular automata • A New Kind of Science released in 2002 • Computational knowledge engine: • Wolfram Alpha • More on http://en.wikipedia.org/wiki/Wolfram_Alpha

  5. What can I do with Mathematica? • Computer algebra system • 2D and 3D visualization • statistical analysis • image processing • tons of other things!

  6. Two parts • Front End interface • Kernel calculator

  7. front end

  8. Kernel Kernel interpretes the Mathematica expressions and return the result

  9. Notebook cells

  10. Arithmetic • In[1]: = 2+(3*4) • Press Shift + Enter • Out[1]= 14 • In[2]:=Sqrt[16] • Out[2]=4 • In[3]=a a • Out[3]=a^2

  11. Library of Math Functions • Constants: PiE • Trigonometric : Sin[x] Cos[x] Tan[x] • Exponential/ Logarithm: Exp[x] Log[x] • Number theoretic functions: GCD[x,y] Prime[n] • Numerical functions: Abs[x] Floor[x]

  12. Sin[x]

  13. sin[x]

  14. Sin(x)

  15. Formula Manipulation

  16. Solving equations

  17. Solving equations

  18. Calculus

  19. Basic Graphics

  20. Exercises Look up the following functions: RGBColor Dashing Thickness AxesRatio

  21. Graphics I • Plot[Sin[x]+Exp[x],{x,0,1}] • Plot[Cos[x],{x,0,1}] • ParametricPlot[{Sin[t],t},{t,-1,1}] • Plot[{E^x,x^E},{x,0,6}] • Plot[{E^x,x^E},{x,0,6},PlotStyle->{{..},{..}}]

  22. Options • AspectRation -> 1 • Axes --> Automatic • Thickness • RGBColor[0.8,0.2,0.2] • Dashing[{0.04}] • Experiment! Options[Plot]

  23. define your own function • f [ x_ ]=Sin[x]+Cos[x] • f[Pi]=-1

  24. Lists • a={2,3,5,7,11} • b={{2,3},{4,5},6}

  25. accessing a list myprimes={2,3,5,7,11,13} myprimes[[ 2]] 3 myprimes[[-1]] myprimes[[{2,4}]]

  26. accessing a list p={24,56,radio,5,7,11,13} First[p] Last[p] Drop[p,3] myprimes[[{2,4}]]

  27. manipulating a list mll={2,{3,5},7,{11,x},13} Flatten[mll] {2,3,5,7,11,x,13}

  28. manipulating a list Check the following functions: Append Prepend Insert Delete Drop

  29. creating a list Table[x^2,{x,2,5}] {4,9,16,25}

  30. Listable functions Sqrt[{1,4,9}] {1,2,3}

  31. Other Listable functions {1,2,3}^2 {1,4,9}

  32. non-listable functions Map[f,{a,b,c,d}] {f[a],f[b],f[c],f[d]}

  33. Other useful functions Select Select[{1,2,3,4,6},PrimeQ] {2,3}

  34. Other useful functions Length Length[{1,2,3,4,6}] 5

  35. Other useful functions Count Count[{1,2,1,4,1},1] 3

  36. Defining functions f[x_]:=x^3-1 f[2] 7

  37. Boolean functions PrimeQ TrueQ

  38. anonymous functions (#^2-1)&[5] 24

  39. anonymous functions PrimeQ[#!+1]&[3] True

  40. anonymous functions (#1^2+#2^2)&[1,2] 5

  41. Graphics Graphics Plot[Sin[x],{x,Pi,2 Pi}]

  42. Graphics Graphics Plot[{Sin[x],Cos[x]},{x,Pi,2 Pi},Frame->True, FrameStyle->Thick,Background->LightGreen,PlotLabel->Graphs ]

  43. Functional Programing Any program is a function

  44. Examples • Consider {{a,1},{b,2},{c,3},{d,4}} • Question: How to transpose it?

  45. Solution 1 • temp=lis • Do[{temp[[i,1]],temp[[i,2]}={lis[[i,2]],lis[[i,1]]},{i,1,Length[lis]}]; • temp

  46. Solutions 2 • Table[{lis[[i,2]],lis[[i,1]]},{i,1,Length[lis]}]

  47. Solution 3 • Map[Reverse,lis]

  48. Everything is a function! Everything is a function! • {1,2,3} List[1,2,3] • a+b Plus[a,b] • c^2 Power[c,2]

  49. Examples • Times[a,b] • FullForm[a+b] • Plus[a,b]

More Related