Download presentation
Presentation is loading. Please wait.
Published byNathan Floyd Modified over 8 years ago
1
How to solve ODEs using MATHEMATICA Plasma Application Modeling POSTECH Gan-Young Park and Jae-Koo Lee Department of Electronic and Electrical Engineering, POSTECH 2006. 03. 22 EECE490O
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.htmhttp://www.mathought.com/main.htm
4
Plasma Application Modeling POSTECH Standard Screen Notebook : working window ( *.nb ) Palettes ( File – Palettes - ) : a collection of numerical expressions or characters
5
Plasma Application Modeling POSTECH Basic Usages (1) Shift + enter : Execution (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 Basic Usages (2) application of Palettes Font size : Format - Size -
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 Basic Usages (5) == ( equality ), = ( substitution ), := ( definition ) Common feature Different feature
10
Plasma Application Modeling POSTECH Basic Usages (6) Common feature Different feature
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. DisplayFunction -> $DisplayFunction : a option for showing a graph memorized. Show : a function to display graphs which have been shown or memorized
15
Plasma Application Modeling POSTECH Basic Usages (11) Package Since path is assigned up to StandardPackages, just sub-paths should be written. The symbol ` is used in Mathematica instead of \.
16
Plasma Application Modeling POSTECH Basic Usages (12) Table [contents, {range of loop}]
17
Plasma Application Modeling POSTECH Basic Usages (13) Do [exp, {i,min,max,d}] For [start, test, i++, body] While [test, body] 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.
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
Euler’s method (2) Plasma Application Modeling POSTECH
22
Predictor-Corrector method ( 2 nd -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
Program 9-1 ( Nakamura ), y(0)=1, y’(0)=0 Changing 2 nd order ODE to 1 st order ODE, (1) (2) y(0)=1 z(0)=0 Plasma Application Modeling POSTECH
26
Program 9-1 ( Nakamura ) Plasma Application Modeling POSTECH To solve 2 nd -order ODE using second-order Runge-Kutta method
27
Program 9-2 ( Nakamura ) Plasma Application Modeling POSTECH y(0)=0 y(0)=1 To solve ODE using fourth-order Runge-Kutta method
28
Solve difference equation, With the boundary conditions, x = 012 i = 012 910 9 Especially for i = 1, known y(0)=1 Plasma Application Modeling POSTECH Program 10-1 ( Nakamura )
29
For i = 10, Summarizing the difference equations obtained, we write Tridiagonal matrix Program 10-1 ( Nakamura )
30
Solution Algorithm for Tridiagonal Equations (1) R2R2 R3R3 Based on Gauss elimination Plasma Application Modeling POSTECH
31
Solution Algorithm for Tridiagonal Equations (2) Plasma Application Modeling POSTECH
32
Plasma Application Modeling POSTECH Program 10-1 ( Nakamura ) To solve boundary-value problem using tridiagonal method
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.