1 / 32

How to solve ODEs using MATHEMATICA

Plasma Application Modeling POSTECH. EECE490O. How to solve ODEs using MATHEMATICA. 2006. 03. 22. Gan-Young Park and Jae-Koo Lee Department of Electronic and Electrical Engineering, POSTECH. Plasma Application Modeling POSTECH. Contents. Basic usages of MATHEMATICA Solving ODEs

caryn-weber
Download Presentation

How to solve ODEs using MATHEMATICA

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. Plasma Application Modeling POSTECH EECE490O How to solve ODEs using MATHEMATICA 2006. 03. 22 Gan-Young Park and Jae-Koo Lee Department of Electronic and Electrical Engineering, POSTECH

  2. Plasma Application Modeling POSTECH Contents • Basic usages of MATHEMATICA • Solving ODEs • - Euler’s method • - Predictor-Corrector method ( second-order ) • - Forth-order Runge-Kutta method • - Tridiagonal matrix method

  3. Plasma Application Modeling POSTECH References • Textbook • - ‘Numerical and Analytical Methods for Scientists and Engineers Using Mathematica’, Daniel Dubin, Wiley, 2003 • Web Lecture • : http://www.mathought.com/main.htm

  4. Plasma Application Modeling POSTECH Notebook : working window ( *.nb ) Standard Screen Palettes ( File – Palettes - ) : a collection of numerical expressions or characters

  5. Plasma Application Modeling POSTECH Basic Usages (1) • Shift + enter : Execution (shift + enter) (shift + enter) • In[1] indicates input contents in the line. • Out[1] indicates the result of In[1] • % : a symbol indicating the result obtained right before.

  6. Plasma Application Modeling POSTECH • Font size • : Format - Size - Basic Usages (2) • application of Palettes

  7. Plasma Application Modeling POSTECH Basic Usages (3) • The names of most of functions included start with a capital letter. • included constants • - π→ Pi • - ∞ → Infinite • - e → E • - i = → I • ? (function) or ?? (function) • : shows the usage of function or options

  8. Plasma Application Modeling POSTECH Basic Usages (4) • symbol calculation • The symbol “ * ” for a product can be replaced by “ blank”.

  9. Plasma Application Modeling POSTECH Common feature Different feature Basic Usages (5) • == ( equality ), = ( substitution ), := ( definition ) < g[x] = eq. & g[x] := eq. >

  10. Plasma Application Modeling POSTECH Common feature Different feature Basic Usages (6) < g[x_] = eq. & f[x_] := eq. >

  11. Plasma Application Modeling POSTECH Basic Usages (7) • Plot[ function, {variable, a, b}, options] : drawing 2-D graph between a and b

  12. Plasma Application Modeling POSTECH Basic Usages (8) • PlotStyle : a option for coloring • Input - Color Selector

  13. Basic Usages (9) • PlotLabel : a option for labeling at top of graph • AxesLabel : a option for labeling at axes • AspectRatio : a option for adjusting the ratio of vertical to horizontal • PlotRange : a option for restricting range to plot

  14. Plasma Application Modeling POSTECH Basic Usages (10) • DisplayFunction → Identity : a option for not showing a graph, just memorizing it. • Show : a function to display graphs which have been shown or memorized • DisplayFunction -> $DisplayFunction : a option for showing a graph memorized.

  15. Plasma Application Modeling POSTECH • Since path is assigned up to StandardPackages, just sub-paths • should be written. • The symbol ` is used in Mathematica instead of \. Basic Usages (11) • Package

  16. Plasma Application Modeling POSTECH Basic Usages (12) • Table [contents, {range of loop}]

  17. Plasma Application Modeling POSTECH • Since Do, For, While don’t show results and save results, functions such as Print[] should be used for checking results. • That’s a difference among Table and above functions. Basic Usages (13) • Do [exp, {i,min,max,d}] • For [start, test, i++, body] • While [test, body]

  18. Plasma Application Modeling POSTECH Basic Usages (14) • Module [ {local variables}, contents ] • : The variables written at {} in Module[ ] are used as local variables which doesn’t affect global variables with same characters and can’t be used out of Module[ ].

  19. Plasma Application Modeling POSTECH Solving ODEs - Euler’s method - Predictor-Corrector method ( second-order ) - Forth-order Runge-Kutta method - Solving tridiagonal matrix

  20. Plasma Application Modeling POSTECH Euler’s method (1)

  21. Plasma Application Modeling POSTECH Euler’s method (2)

  22. Predictor-Corrector method ( 2nd-order )

  23. Plasma Application Modeling POSTECH Forth-order Runge-Kutta method ( based on the Simpson’s 1/3 rule )

  24. Example 9.1 ( Nakamura )

  25. Plasma Application Modeling POSTECH , y(0)=1, y’(0)=0 Changing 2nd order ODE to 1st order ODE, y(0)=1 (1) z(0)=0 (2) Program 9-1 ( Nakamura )

  26. Plasma Application Modeling POSTECH Program 9-1 ( Nakamura ) To solve 2nd-order ODE using second-order Runge-Kutta method

  27. Plasma Application Modeling POSTECH y(0)=1 y(0)=0 Program 9-2 ( Nakamura ) To solve ODE using fourth-order Runge-Kutta method

  28. Program 10-1 ( Nakamura ) Plasma Application Modeling POSTECH          Solve difference equation, With the boundary conditions, x = 0 1 2 9 10 i = 0 1 2 9 10 known y(0)=1 Especially for i = 1,

  29. Program 10-1 ( Nakamura ) For i = 10, Summarizing the difference equations obtained, we write Tridiagonal matrix

  30. Plasma Application Modeling POSTECH Solution Algorithm for Tridiagonal Equations (1) R2 Based on Gauss elimination R3

  31. Plasma Application Modeling POSTECH Solution Algorithm for Tridiagonal Equations (2)

  32. Plasma Application Modeling POSTECH Program 10-1 ( Nakamura ) To solve boundary-value problem using tridiagonal method

More Related