270 likes | 598 Views
Plasma Application Modeling POSTECH. How to solve ODEs using MATHEMATICA. 2005. 09. 13. G. Y. Park and J.K. Lee Department of Electronic and Electrical Engineering, POSTECH. Plasma Application Modeling POSTECH. Contents. Basic usages of MATHEMATICA Solving ODEs - Euler’s method
E N D
Plasma Application Modeling POSTECH How to solve ODEs using MATHEMATICA 2005. 09. 13 G. Y. Park and J.K. Lee Department of Electronic and Electrical Engineering, POSTECH
Plasma Application Modeling POSTECH Contents • Basic usages of MATHEMATICA • Solving ODEs • - Euler’s method • - Predictor-Corrector method ( second-order ) • - Forth-order Runge-Kutta method
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
Plasma Application Modeling POSTECH Notebook : working window ( *.nb ) Standard Screen Palettes ( File – Palettes - ) : a collection of numerical expressions or characters
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.
Plasma Application Modeling POSTECH • Font size • : Format - Size - Basic Usages (2) • application of Palettes
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
Plasma Application Modeling POSTECH Basic Usages (4) • symbol calculation • The symbol “ * ” for a product can be replaced by “ blank”.
Plasma Application Modeling POSTECH Common feature Different feature Basic Usages (3) • == ( equality ), = ( substitution ), := ( definition ) < g[x] = eq. & g[x] := eq. >
Plasma Application Modeling POSTECH Common feature Different feature Basic Usages (3) < g[x_] = eq. & f[x_] := eq. >
Plasma Application Modeling POSTECH Basic Usages (4) • Plot[ function, {variable, a, b}, options] : drawing 2-D graph between a and b
Plasma Application Modeling POSTECH Basic Usages (3) • PlotStyle : a option for coloring • Input - Color Selector
Basic Usages (3) • 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 resticting range to plot
Plasma Application Modeling POSTECH Basic Usages (3) • 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.
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 (3) • Package
Plasma Application Modeling POSTECH Basic Usages (3) • Table [contents, {range of loop}]
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 (3) • Do [exp, {i,min,max,d}] • For [start, test, i++, body] • While [test, body]
Plasma Application Modeling POSTECH Basic Usages (3) • 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[ ].
Plasma Application Modeling POSTECH Solving ODEs - Euler’s method - Predictor-Corrector method ( second-order ) - Forth-order Runge-Kutta method
Plasma Application Modeling POSTECH Euler’s method (1)
Plasma Application Modeling POSTECH Euler’s method (2)
Plasma Application Modeling POSTECH Forth-order Runge-Kutta method ( based on the Simpson’s 1/3 rule )