## How to solve and plot system differential equation...

Asked by:

How to solve this problem? I want to display plot of differential equation system

this download link my problem https://drive.google.com/file/d/0B-qKE-5zgVbLeWVMd0xkMFY1Y00/view?usp=sharing

Thank you :)

## how can i draw the plot of solution of Runge–Kutta...

Asked by:

how can i draw the plot of solution of Runge–Kutta methods

@rkt4.mw

## how to solve fourth ordered Initial Value Problem ...

Asked by:

restart;

Digits := 18;
with(LinearAlgebra);
f := proc (n) 3*sin(x[n]) end proc;

g := proc (n) 3*cos(x[n])

end proc;

#problem call.
for n from 0 to 0 do

e1 := expand(-y[n+3/2]+y[n]-3*y[n+1/2]+3*y[n+1]+1/11612160*(5856*h^4*g(n+1/2)-19968*h^4*g(n+3/2)+2343*h^4*g(n)-76356*h^4*g(n+1)-7058*h^4*g(n+2)+608864*h^3*f(n+1/2)+104864*h^3*f(n+3/2)+28489*h^3*f(n)+702864*h^3*f(n+1)+6439*h^3*f(n+2)));

e2 := expand(-y[n+2]+3*y[n]-8*y[n+1/2]+6*y[n+1]+1/5806080*(18768*h^4*g(n+1/2)-32880*h^4*g(n+3/2)+3867*h^4*g(n)-76356*h^4*g(n+1)-2229*h^4*g(n+2)+965728*h^3*f(n+1/2)+461728*h^3*f(n+3/2)+45953*h^3*f(n)+1405728*h^3*f(n+1)+23903*h^3*f(n+2)));

e3 := expand(-z[n]+(1/383201280*(-4207440*h^4*g(n+1/2)-930192*h^4*g(n+3/2)+371973*h^4*g(n)-3631932*h^4*g(n+1)-41259*h^4*g(n+2)+16136096*h^3*f(n+1/2)+3866720*h^3*f(n+3/2)+5752543*h^3*f(n)+5810400*h^3*f(n+1)+367681*h^3*f(n+2))+4*y[n+1/2]-3*y[n]+y[n+1])/h);

e4 := expand(-z[n+1/2]+(1/191600640*(376320*h^4*g(n+1/2)+118896*h^4*g(n+3/2)-29469*h^4*g(n)+532764*h^4*g(n+1)+5079*h^4*g(n+2)-5812112*h^3*f(n+1/2)-508016*h^3*f(n+3/2)-381553*h^3*f(n)-1236168*h^3*f(n+1)-45511*h^3*f(n+2))-y[n]+y[n+1])/h);

e5 := expand(-z[n+1]+(1/383201280*(-31920*h^4*g(n+1/2)-433776*h^4*g(n+3/2)+71547*h^4*g(n)-2519748*h^4*g(n+1)-17493*h^4*g(n+2)+18565216*h^3*f(n+1/2)+1933216*h^3*f(n+3/2)+885665*h^3*f(n)+10391328*h^3*f(n+1)+158015*h^3*f(n+2))-5*y[n+1/2]+y[n]+3*y[n+1])/h);

e6 := expand(-z[n+3/2]+(1/95800320*(250224*h^4*g(n+1/2)-730680*h^4*g(n+3/2)+61266*h^4*g(n)-1526256*h^4*g(n+1)-22044*h^4*g(n+2)+15680504*h^3*f(n+1/2)+4712456*h^3*f(n+3/2)+735469*h^3*f(n)+22576428*h^3*f(n+1)+203623*h^3*f(n+2))-8*y[n+1/2]+3*y[n]+5*y[n+1])/h);

e7 := expand(-z[n+2]+(1/383201280*(3873264*h^4*g(n+1/2)+332976*h^4*g(n+3/2)+497649*h^4*g(n)-1407564*h^4*g(n+1)-720255*h^4*g(n+2)+114710816*h^3*f(n+1/2)+93716192*h^3*f(n+3/2)+5705827*h^3*f(n)+191366496*h^3*f(n+1)+9635389*h^3*f(n+2))-12*y[n+1/2]+5*y[n]+7*y[n+1])/h);

e8 := expand(-p[n]+(1/191600640*(13423440*h^4*g(n+1/2)+3068304*h^4*g(n+3/2)-1621317*h^4*g(n)+11615292*h^4*g(n+1)+137451*h^4*g(n+2)-32503712*h^3*f(n+1/2)-12664928*h^3*f(n+3/2)-32539039*h^3*f(n)-16869600*h^3*f(n+1)-1223041*h^3*f(n+2))-8*y[n+1/2]+4*y[n]+4*y[n+1])/h^2);

e9 := expand(-p[n+1/2]+(1/191600640*(-3053856*h^4*g(n+1/2)-213216*h^4*g(n+3/2)+98049*h^4*g(n)-509436*h^4*g(n+1)-10191*h^4*g(n+2)-1045120*h^3*f(n+1/2)+831104*h^3*f(n+3/2)+1331083*h^3*f(n)-1207008*h^3*f(n+1)+89941*h^3*f(n+2))-8*y[n+1/2]+4*y[n]+4*y[n+1])/h^2);

e10 := expand(-p[n+1]+(1/63866880*(194160*h^4*g(n+1/2)-373968*h^4*g(n+3/2)+52329*h^4*g(n)-2514924*h^4*g(n+1)-14727*h^4*g(n+2)+14006304*h^3*f(n+1/2)+1695712*h^3*f(n+3/2)+634955*h^3*f(n)+15463008*h^3*f(n+1)+133461*h^3*f(n+2))-8*y[n+1/2]+4*y[n]+4*y[n+1])/h^2);

e11 := expand(-p[n+3/2]+(1/191600640*(1491168*h^4*g(n+1/2)-4758240*h^4*g(n+3/2)+190977*h^4*g(n)-509436*h^4*g(n+1)-103119*h^4*g(n+2)+46274944*h^3*f(n+1/2)+48151168*h^3*f(n+3/2)+2215307*h^3*f(n)+93985056*h^3*f(n+1)+974165*h^3*f(n+2))-8*y[n+1/2]+4*y[n]+4*y[n+1])/h^2);

e12 := expand(-p[n+2]+(1/191600640*(4772688*h^4*g(n+1/2)+11719056*h^4*g(n+3/2)+338619*h^4*g(n)+11615292*h^4*g(n+1)-1822485*h^4*g(n+2)+59770976*h^3*f(n+1/2)+79609760*h^3*f(n+3/2)+3528289*h^3*f(n)+109647648*h^3*f(n+1)+34844287*h^3*f(n+2))-8*y[n+1/2]+4*y[n]+4*y[n+1])/h^2) end do;
M := {e || (1 .. 12)};

y_init := 1;

z_init := 0;

p_init := -2;

x_init := 0; A := 0; B := 1; N := 40;

h := evalf((B-A)/N); count := 1;

X := y[k], y[k+1/2], y[k+1], y[k+3/2], z[k], z[k+1/2], z[k+1], z[k+3/2], p[k], p[k+1/2], p[k+1], p[k+3/2];

step := seq(eval(x, x = n*h), n = 1 .. N);

y_exact := ([seq])(eval(3*cos(x)+(1/2)*x^2-2, x = n*h), n = 1 .. N);

z_exact := ([seq])(eval((1/3*(3*x^2+6*x+3))/(x^3+3*x^2+3*x+1), x = n*h), n = 1 .. N);

p_exact := ([seq])(eval((1/3*(6*x+6))/(x^3+3*x^2+3*x+1)-(1/3)*(3*x^2+6*x+3)^2/(x^3+3*x^2+3*x+1)^2, x = n*h), n = 1 .. N);
vars := seq(X, k = 1);
printf("\n%4s%13s%15s%15s\n", "@", "y_Num", "y_Exact", "y_Error");

for q to N do

for ix to 4 do

x[ix] := h*ix+x_init end do;

result := eval(`<,>`(vars), fsolve(eval(M, [x[0] = x_init, x[1/2] = x_init, x[3/2] = x_init, y[0] = y_init, y[1/2] = y_init, y[3/2] = y_init, z[0] = z_init, z[1/2] = z_init, z[3/2] = z_init, p[0] = p_init, p[1/2] = p_init, p[3/2] = p_init]), {vars}));

for k to 4 do

printf("%5.2f %14.15f", step[count], result[k]);

printf("%20.15f %10.18G \n", y_exact[count], abs(result[k]-y_exact[count]));

count := count+1;

P := [result[k]]

end do;

x_init := x[ix-1];

y_init := result[4];

z_init := result[8];

p_init := result[12]

end do;

please that is the code i write to solve the problem after using the matrix form to generate the value but is given me error of the form

@        y_Num        y_Exact        y_Error
Error, invalid input: eval received fsolve({-6398.00004614630940+6400.00000000000000*y[1], -6397.99992849910140+6400.00000000000000*y[1], -6397.99909739580050+6400.00000000000000*y[1], -199.999989717789185+200.000000000000000*y[1], -40.0000000791700798+40.0000000000000000*y[1], -2.99999993737911015+3*y[1], 39.999999768462113+40.0000000000000000*y[1], -p[1]-6399.99961623646730+6400.00000000000000*y[1], -p[2]-6399.99798489466010+6400.00000000000000*y[1], -y[2]-4.99999972458202552+6*y[1], -z[1]-159.999999048856193+120.000000000000000*y[1], -z[2]-279.999973921987948+280.000000000000000*y[1]}, {p[1], p[2], p[3/2], p[5/2], y[1], y[2], y[3/2], y[5/...

## What is causing this error with InitialValueProble...

Asked by:

I'm trying to approximate the solution of an IVP using Euler's method in the InitialValueProblem command and I keep getting this error (see attached worksheet). Can someone explain why? Thanks!

Download ivp_error.mw

## Initial value problem - dsolve does not give parti...

Asked by:

Trying to solve this IVP of the SHO  (second order linear costant-coefficient).

Everything works fine until I come to the solving even after using dsolve with initial conditions (even using the differential operator D in the initial conditions)  , the answer still contains _C1, an unknown constant.

The full worksheet is below.  The code for dsolve is:

sol3 := dsolve(subs(par1, {de1, D(x)*0 = 0, x(0) = 1}), x(t));

Hoping you can help with a solution.

## Numerical solution of ODE...

Asked by:

Hi

Dear friends

I use the command "dsolve(`union`(deq, initial), numeric, method = lsode)" for solving a fourth order ODE.

But for some numerical values of the parameters the bellow error is occurred:

" an excessive amount of work (greater than mxstep) was done ".

I have three questions:

1- how can I increase the mxstep from default amount (i.e. 500) to a greater value?

2- how can I ensure that the absolute error is less than 10E-6?

3- when I use lsode which way of numerical solution is applied (Euler,midpoint, rk3, rk4, rkf, heun, ... )?

Thanks a lot for your help

## How do I solve a differential equation in Maple?...

Asked by:

Hi everyone, I'm a new one to Maple. I've just learnt some basic tools :)

This is my task. I tried to record in Maple but I had errors. I don't know why I had problems but I hope you will help me and I will do it.

tkanks

## varying initial conditions...

Asked by:

PLEASE HELP ME. I NEED HELP REALLY BAD.

Restrict calculation to real numbers.

Using y' = u, express the oscillator equation: y" + 3y' + 2y = cos(t) as a first order system.

Plot an approximate solution curve for the specified initial conditions.

[x0=5, y0=1],[x0=-2, y0=-4],[x0=0, y0=.1],

This is what i have so far but i am not sure if its correct.

Eulers modified method:

with(RealDomain);

x[0] := 0;

y[0] := 5;

t[0]=0

h := .1;

for n to 100 do

x[n] := x[n-1]+h*(x[n-1]+y[n-1]);

k1 := x[n-1]+y[n-1];

k2 := h*k1+x[n]+y[n-1];

k := 1/2*(k1+k2);

y[n] := h*k+y[n-1]

end do;

data := [seq([x[n], y[n]], n = 0 .. 100)];
G1 := plot(data, style = point, color = "blue");
G1;

## Maple Help ASAP...

Asked by:

I am new to maple and I need help.

Let x=x(t) and y=y(t) be functions in t. Suppose that x'=2x−5y+t and y'=4x+9y+sint such that x(0)=y(0)=0. Find y(1).

How do I go about doing this question?

Thanks

## Maple Euler's method help...

Asked by:

This is the simplest method to explain numerically solving an ODE, more precisely, an IVP.

Using the method, to get a fell for numerics as well as for the nature of IVPs, solve the IVP numerically with a PC, 10steps.

Graph the computed values and the solution curve on the same coordinate axes.

y'=(y-x)^2, y(0)=0 , h=0.1

Sol. y=x-tanh(x)

I don't know well maple.

I study Advanced Engineering Math and using maple, but i am stopped in this test.

I want to know how solve this problem.

please teach me~

IT IS EULER's method

## Please Help me!...

Asked by:

Hi there. I'm Student

i want to know how solve this problem.

please teach me!

y'=(y-x)^2, y(0)=0, h=0.1

sol.y=x-tanh(x)

how solve this problem for maple?

please teach me~

## solving system of differential equations with init...

Asked by:

I've got the following four differential equations :

v_x:=diff(x(t),t);
v_y:=diff(y(t),t);
d2v_x:=-((C_d)*rho*Pi*(r^2)*(v_x)*sqrt((v_x)^2 +(v_y)^2))/(2*m);
d2v_y:=-((C_d)*rho*Pi*(r^2)*(v_y)*sqrt((v_x)^2 +(v_y)^2))/(2*m)-g;

and the following initial value conditions:

x(0)=0,y(0)=0,v_x(0)=v0/sqrt(2),v_y(0)=v0/sqrt(2) given v0=65

I need to solve these using the numeric type and then draw overlaid plots

(i) setting C_d=0

(ii) leaving C_d as a variable

before plotting y(t) vs x(t). The hint for this last part is that the path can be seeing using [x(t),y(t)] instead of [t,y(t)]

I've tried to do it but seemed to have several syntax errors.

## solving a diff.eq numerically given an initial con...

Asked by:

I've got the following diff.eq

y'(x)=sin(x*y(x)) given y(0)=1

and need to solve it numerically which is why I've used:

dy4:=diff(y(x),x);
eqn4:=dy4=sin(x*y(x));
ic1:=y(0)=1;
ans3:=dsolve({eqn4,ic1},y(x),type=numeric);

This code doesn't return a value though and in fact, ans3 is being displayed as a procedure

"ans3:=proc(x_rkf45) ... end proc"

I don't quite understand why and what I need to do to get the required numerical solution

## Solve IVP with complex coefficients...

Asked by:

Solve IVP with complex coef. with compplex varables numerically..

the sys. is x'=-iDelta1x(t)+y(t)+epsilon

y'=-iDelta2y(t)+x(t)z(t)

z'=-2(x*(t)y(t)+x(t)y*(t)), where * means complex conjugate

I solve it as:

epsilon:=5:Delta1:=4:Delta2:=4:assume(z(t),real):

var:={x_R(t),y_R(t),z_R(t),x_I(t),y_I(t),z_I(t)}:
dsys :={diff(x(t),t)=-I*Delta1*x(t)+y(t)+epsilon, diff(y(t),t)=-I*Delta2*y(t)+x(t)*z(t), diff(z(t),t)=-2*(conjugate(x(t))*y(t)+conjugate(y(t))*x(t))}:
functions := indets(dsys, anyfunc(identical(t))):
redefinitions := map(f -> f = cat(op(0, f), _R)(t) + I*cat(op(0,f), _I)(t), functions):
newsys := map(evalc @ Re, redefinitions) union map(evalc @ Im, redefinitions):

incs := {x_R(0)=0, x_I(0)=0, y_R(0)=0, y_I(0)=0,z_R(0)=-1/2, z_I(0)=0}:
dsol1 :=dsolve({newsys,incs},var,numeric, output=listprocedure, abserr=1e-9, relerr=1e-8,range=0..1):

but it seems there is not runing propebly

## How to plot numerical solution of ODE system?...

Asked by:

Hallo. I'm solving a initial value problem for system of 7 ODE:

dsn := dsolve({expand(maineq[1, 1]), expand(maineq[1, 2]), expand(maineq[1, 3]), expand(maineq[1, 4]), expand(maineq[1, 5]), expand(maineq[1, 6]), expand(maineq[1, 7]), T(0) = .5, u(0) = u0, Y[1](0) = .8, Y[2](0) = .2, Y[3](0) = 0, Y[4](0) = 0, Y[5](0) = 0}, numeric, method = lsode[backfull])

Is there easy way how to plot result?

 1 2 Page 1 of 2
﻿