: User manual for Iode
: Running Iode
: Structure of Iode



Reference materials


Mathematical expressions in Matlab, Octave and Iode

For simple expressions, we use the usual keyboard characters:


         2*x                means $ 2x$, 

(x^3-1)/6 means $ (x^3-1)/6$.
Or instead of the usual division /, we can use ``left division'' $ \backslash$.

         pi/3                 means 
$ \frac{\pi}{3},$ 

3 $ \backslash$pi also means $ \frac{\pi}{3}$.

Built-in functions


         exp(x)   exponential, $ e^x$ 

log(x) natural logarithm, $ \ln x$
log10(x) base 10 logarithm, $ \log_{10} x$
abs(x) absolute value, $ \vert x\vert$
sqrt(x) square root, $ \sqrt{x}$
sign(x) signum function, which equals % latex2html id marker 2705
$ \left\{ \begin{array}{rl} +1 & \text{if $x>0$}  0 & \text{if$x=0$}  -1 & \text{if $x<0$} \end{array} \right.$
        sin(x) sinh(x)
cos(x) trigonometric cosh(x) hyperbolic
tan(x) functions tanh(x) trigonometric
cot(x) ($ x$ in radians) coth(x) functions
sec(x) sech(x)
csc(x) csch(x)

asin(x) asinh(x)
acos(x) inverse acosh(x) inverse
atan(x) trigonometric atanh(x) hyperbolic
acot(x) functions acoth(x) trigonometric
asec(x) asech(x) functions
acsc(x) acsch(x)
        besselj(nu,z) Bessel function ofthe first kind
bessely(nu,z) Bessel function of the second kind
besseli(nu,z) Modified Bessel function of the first kind
besselk(nu,z) Modified Bessel function of the second kind

Example C.1  

 

        sin(exp(y))^4                 means $ \sin^4(e^y)$,
acos(exp(1)^(-1)) means $ \arccos(e^{-1})$.

No matter whether you're using Octave or Matlab, you can always find more information on a function by typing help function.

Additional Iode functions

The installation of Iode includes the following functions, useful for studying Fourier series and for creating initial values for partial differential equations.

hat(x,a,b): equals 0 for $ x \leq a$ and $ x \geq b$, and equals $ 1$ for $ a < x < b$. To make sense, hat requires $ a<b$.

triangle(x,a,b,m): a triangular-shaped function, equalling 0 for $ x \leq a$, then rising linearly to height $ 1$ at $ x=m$ and falling back linearly to zero at $ x=b$, then equalling zero for $ x \geq b$. To make sense, triangle requires $ a<m<b$. The parameter $ m$ is optional and defaults to the midpoint $ \frac{a+b}{2}$.

bump(x,a,b,m): is a continuously differentiable function that equals 0 for $ x \leq a$ and $ x \geq b$, is positive for $ a < x < b$, has a maximum of $ 1$ at $ x=m$, and is strictly increasing between $ a$ and $ m$ and strictly decreasing between $ m$ and $ b$. To make sense, bump requires $ a<m<b$. The parameter $ m$ is optional and defaults to $ \frac{a+b}{2}$.


Logical expressions in Matlab, Octave and Iode

Expressions like x>=2 are treated as logical functions, and return a value of either $ 1$ (true) or 0 (false). So x>=2 is the ``step'' function that equals \begin{displaymath}
% latex2html id marker 2776
\left\{
\begin{array}{rl}
1 & \text{if $x \geq 2$}  0 &
\text{otherwise}
\end{array} \right.\end{displaymath}.

Example C.2   Logical functions help us create functions defined in pieces:

         (t^2)*(t<4)                 means 
% latex2html id marker 2783
$ \left\{\begin{array}{ll} t^2 & \text{if $t < 4$}  0 & \text{otherwise}\end{array} \right.$ ,
because (t<4) equals $ 1$ if $ t<4$ and equals 0 otherwise.

Color codes recognized by Matlab, Octave and Iode


         b         blue 

g green
r red
c cyan
m magenta
y yellow
k black
Note that yellow plots are usually hard to see due to lack of contrast.

Some solver codes recognized by Iode


         euler         Euler method for (systems of) first orderequations 

rk Runge-Kutta for (systems of) first order equations

In addition to the pre-installed solvers listed above, you can also create your own. For example, if you devise a new method for solving differential equations, then you could program it in a new file called my_algorithm.m, in your Iode directory. The structure of my_algorithm.m should follow that of euler.m. You will simply need to change the ``update'' steps, which in euler.m are:
\begin{lstlisting}{}
k1=feval(fs,x,tc(i));
x=x+h*k1;
\end{lstlisting}

Then after creating the file my_algorithm.m, you can input my_algorithm when Iode prompts you for a numerical method.


: User manual for Iode : Running Iode : Structure of Iode
平成16年11月7日