1 / 11

DIFFERENTIAL EQUATIONS, INTEGRATION, POLYNOMIALS, RANDOM NUMBERS

DIFFERENTIAL EQUATIONS, INTEGRATION, POLYNOMIALS, RANDOM NUMBERS. MEKANIKA SOFTWARE SEMINARS. ODE INITIAL VALUE PROBLEMS. ODE solvers handle the following types of first-order ODE’s: Explicit ODEs Linearly implicit ODEs Fully implicit ODEs ODE IVP solvers include:

Télécharger la présentation

DIFFERENTIAL EQUATIONS, INTEGRATION, POLYNOMIALS, RANDOM NUMBERS

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. DIFFERENTIAL EQUATIONS, INTEGRATION, POLYNOMIALS, RANDOM NUMBERS MEKANIKA SOFTWARE SEMINARS

  2. ODE INITIAL VALUE PROBLEMS • ODE solvers handle the following types of first-order ODE’s: • Explicit ODEs • Linearly implicit ODEs • Fully implicit ODEs • ODEIVP solvers include: • ode45, ode23, ode113 (non-stiff DE’s) • ode23t, ode23tb (moderately stiff DE’s) • ode15s, ode23s (stiff DE’s) • ode15i (fully implicit DE’s) • All ODE’s must be reduced to first order DE’s by substitutions before MATLAB can actually solve them.

  3. ODE IVP SYNTAX • ODE syntax : • [t,y] = solver (odefun , tspan , y0) • [t,y] = ode15i (odefun , tspan, y0, yp0) • The odefun is generally given as a function handle: e.g. @function, where function defines the ODE. • Another parameter may be included in certain cases in the syntax, viz. options • For ode15i one must endeavor to use the decic function in MATLAB to compute consistent initial conditions. [y0mod,yp0mod] = decic (odefun,t0,y0,fixed_y0,yp0,fixed_yp0)

  4. ODE BOUNDARY VALUE PROBLEMS • Just as IVP’s require the initial conditions to be explicitly specified, BVP’s require boundary conditions to be specified. • While solving BVP’s we must give MATLAB a consistent and continuous initial solution from where to begin its iterations. To do this, we use the bvpinit function as: solinit = bvpinit( x, yinit, parameters) • This generates an initial mesh from which bvpinit can form a good starting point for the BVP solver • The BVP solver is bvp4c, which solves 2-point BVP’s using a 3-stage finite difference Lobatto-Illa formula which is 4th order uniformly accurate.

  5. ODE BVP SYNTAX • sol = bvp4c(odefun,bcfun,solinit) • bcfun is a function that computes the residual in the boundary conditions. • res = bcfun (ya,yb) • solinit is a structure containing the initial guess for a solution.

  6. PARTIAL DIFFERENTIAL EQUATIONS • c * δu/δt = x-m * f + s • c : coupling matrix; diagonal • m : symmetry of the problem • f : flux vector • s : source vector • all of the above are expressed as some function of (x, t, u, δu/δx) • The PDE holds for t0<t<tfand a<x<b and must satisfy : • IC :u(x, t0) = u0(x) • BC : p(x,t,u) + q(x,t)*f = 0

  7. PDE SOLVER SYNTAX • sol = pdepe (m,pdefun,icfun,bcfun,xmesh,tspan) • [c,f,s] = pdefun (x,t,u,dudx) • u = icfun(x) • [pl,ql,pr,qr] = bcfun(xl,ul,xr,ur,t) • Vector [x0, x1, ..., xn] • Vector [t0, t1, ..., tf] • sol is a 3-dimensional vector where sol(i , j , k) gives component k of the solution at time tspan(i) and the mesh point xmesh(j) • [uout ,DuoutDx] = pdeval (m,x,u(j,:),xout)

  8. NUMERICAL INTEGRATION • Numerically evaluate with adaptive Simpson quadrature • q = quad(fun,a,b,tol) • Numerically evaluate with adaptive Lobatto quadrature • q = quadl(fun,a,b,tol) • Double integration • q = dblquad(fun,xmin,xmax,ymin,ymax,tol) • Triple Integration • triplequad(fun,xmin,xmax,ymin,ymax,zmin,zmax)

  9. IMPORTANT TRANSFORMS • FOURIER TRANSFORM : F = fourier(f) • LAPLACE TRANSFORM : L = laplace(F) • Z-TRANSFORM : F = ztrans(f) • INVERSE FOURIER : F = ifourier(f) • INVERSE LAPLACE : L = ilaplace(F) • INVERSE Z-TRANSFORM : F = iztrans(f)

  10. POLYNOMIAL MANIPULATION • CONVOLUTION : w = conv(u,v) • DECONVOLUTION : [q,r] = deconv(v,u) • RESIDUE : [r,p,k] = residue(b,a) • DERIVATIVE : k = polyder(p) • INTEGRATION : polyint(p,k) • CURVE FITTING : [p,S,mu] = polyfit(x,y,n) • EVALUATION : [y,delta] = polyval(p,x,S,mu)

  11. RANDOM NUMBER GENERATION • UNIFORM RANDOM NUMBERS : Y = rand(m,n) • NORMAL RANDOM NUMBERS : Y = randn(m,n) • RANDOM PERMUTATION : p = randperm(n)

More Related