Items tagged with ode ode Tagged Items Feed

Perhaps the question is trivial, but I could not find the solution.

I am solving numerically an ODE (e.g., a simple harmonic oscillator) with the righthand side that contains a random part. For example it is

eq:=diff(a(t),t,t) + a(t) = (1+0.01*R(t))*cos(5*t);

where R(t) is a random function of t. How can I make such a function?

The naive attempt: 

eq:=diff(a(t),t,t) + a(t) = 3.*(1+0.1*rand()/1000000000000.)*cos(5.*t);

gave me a fixed (while random) value, e.g.


But, I need this coefficeint to be random each time step.

Any suggestions are very welcome!




I want to plot E with respect to t.

I typed the sys of this equation and try to plot it with DEplot but failed.

This is the code

DEplot([sys], [x(t), y(t), E(t)], t = -25 .. 25, [[x(0) = -.3, y(0) = .2]], scene = [E(t), t], stepsize = 0.5e-1, linecolor = red, arrows = none);

The error is Error, (in DEtools/DEplot/CheckDE) derivatives must be given explicitly.

Eager to know the answer, please help me . Thanks very much.


Dear collagues


I write a code to solve a system of ODE. It solve the ODES in a wide range of parameters but as I decrease NBT below 0.5, it doesnt converge. I do my best but I couldn't find the answer. Would you please help me? Thank you

Here is my code and it should be run for 0.1<NBT<10. the value of NBT is input directly in res1.





eq1:=(diff(u(eta), eta))*a[mu1]*(diff(phi(eta), eta))+2*(diff(u(eta), eta))*b[mu1]*phi(eta)*(diff(phi(eta), eta))+((diff(u(eta), eta))+(diff(u(eta), eta))*a[mu1]*phi(eta)+(diff(u(eta), eta))*b[mu1]*phi(eta)^2)/(eta+EPSILONE)+diff(u(eta), eta, eta)+(diff(u(eta), eta, eta))*a[mu1]*phi(eta)+(diff(u(eta), eta, eta))*b[mu1]*phi(eta)^2+1-phi(eta)+phi(eta)*rhop/rhobf:
eq2:=(1+a[k1]*phi(eta)+b[k1]*phi(eta)^2)*(diff(T(eta), eta))/(eta+EPSILONE) + (a[k1]*(diff(phi(eta), eta))+2*b[k1]*phi(eta)*(diff(phi(eta), eta)))*(diff(T(eta), eta))+(1+a[k1]*phi(eta)+b[k1]*phi(eta)^2)*(diff(T(eta), eta, eta));




GUESS:=[T(eta) =0.0001*eta, u(eta) =0.1*eta, phi(eta) = 0.3*(eta-1)^4];
res1 := dsolve(subs(NBT=0.48,gama1=0.2,phiv=0.06,{eq1,eq2,eq3,u(0)=lambda*D(u)(0),D(u)(1)=0,T(0)=0,phi(1)=phiv,T(1)=1}), numeric,method=bvp[midrich],maxmesh=4000,approxsoln=GUESS, output=listprocedure,continuation=cc):

masst:=evalf(int((1-G0(eta)+G0(eta)*rhop/rhobf)*G1(eta), eta = 0..1));




Thank you



Hello altogether,

I want to plot the numerical result of an ODE, which seems to be pretty simple at first sight, but the difficulty is that the boundaries are depending on the solution.

The following pseudo-code describes what I want to have, but it doesn't work. This code fills the RAM pretty fast and you will have to kill the process.

Is it possible to calculate a solution to this problem numerically (or even analytically) and if yes, how?

Since I am new here, I am sorry for any bad-to-read maple code or any noob errors I have made. I would be very thankful, for any response and help.



EF.3.mwHi, I want to ask that how to find the exact solution of equation without applying any technique

Dear Collegues

I have a system of odes as follows



Teq := N_bt*T(eta)^2*(exp(-(T(eta)-1)/(N_bt*(1+gama1)*(1+gama1*T(eta)))))^2*(diff(T(eta), eta, eta))*gama1^2*b[k1]+N_bt*T(eta)^2*exp(-(T(eta)-1)/(N_bt*(1+gama1)*(1+gama1*T(eta))))*(diff(T(eta), eta, eta))*gama1^2*a[k1]+2*N_bt*T(eta)*(exp(-(T(eta)-1)/(N_bt*(1+gama1)*(1+gama1*T(eta)))))^2*(diff(T(eta), eta, eta))*gama1*b[k1]+N_bt*T(eta)^2*(diff(T(eta), eta, eta))*gama1^2;

UEQ:=(a[mu1]*(-(diff(T(eta), eta))/(N_bt*(1+gama1)*(1+gama1*T(eta)))+(T(eta)-1)*gama1*(diff(T(eta), eta))/(N_bt*(1+gama1)*(1+gama1*T(eta))^2))*exp(-(T(eta)-1)/(N_bt*(1+gama1)*(1+gama1*T(eta))))+2*b[mu1]*(exp(-(T(eta)-1)/(N_bt*(1+gama1)*(1+gama1*T(eta)))))^2*(-(diff(T(eta), eta))/(N_bt*(1+gama1)*(1+gama1*T(eta)))+(T(eta)-1)*gama1*(diff(T(eta), eta))/(N_bt*(1+gama1)*(1+gama1*T(eta))^2)))*(diff(u(eta), eta))+(1+a[mu1]*exp(-(T(eta)-1)/(N_bt*(1+gama1)*(1+gama1*T(eta))))+b[mu1]*(exp(-(T(eta)-1)/(N_bt*(1+gama1)*(1+gama1*T(eta)))))^2)*(diff(u(eta), eta, eta))+1-exp(-(T(eta)-1)/(N_bt*(1+gama1)*(1+gama1*T(eta))))+exp(-(T(eta)-1)/(N_bt*(1+gama1)*(1+gama1*T(eta))))*rhop/rhobf;

I want to solve them with the following boundary conditions

T(0)=0, T(1)=1

u(0)=L*D(u)(0), D(u)(1)=0

However I tried, I cannot find the solution in a closed form. I want to know that is there a closed form solution for the above odes?

Thank you


When solving ODE with dsolve, I don't want to use "_C1" as the name of constant, I want to specify by myself, how can I do?


In line with my previous questions

I write a code with different variables and odes. However I tried to get the solution, I cannot get the results. I think it should be some problems with my Guess procedure. The code is attached. I would be most grateful if you help me on this problem.

Thank you.


I am trying to solve a PDE which is converted to ODE when we assign one of the  variables some value. The boundary conditions given to the PDE are numerical values given for fixed numerical values to the two independent variables. I am trying to solve the PDE with the staandard syntax:

pds := pdsolve(pde,[ibc],numeric,time=z,range=0..beta);

The error message I get is:  

Error, (in pdsolve/numeric/process_PDEs) PDEs can only contain dependent variables with direct dependence on the independent variables of the problem, got {theta(z, 0)}

The pde and boundary conditions are as follows:

PDE:   pde := diff(theta(z, 0), z, z)+theta(z, 0)

Where zero is the fixed value for an independent variable

Boundary Condition:  ibc:={theta(0,0)=beta,D[1](theta)(0,0)=0};

When I try to solve it as an ODE the error is:

Error, (in dsolve) not an ODE system, please try pdsolve


I am attempting to solve a system of second order ODEs. I place conditions on the solutions and use the solve command to figure the correct constants for the general solutions of the ODEs; however, the conditions do not appear to hold after I substitute the constants back into the general solutions. Any help would be greatly appreciated. Here's the code and an explanation:

First some constants

> A := 1; B := 9/10;
> j := 1-1/B;

 This is our homogeneous odes. I will give the general solutions of the inhomogeneous system momentarily 

> eqnv1 := diff(v1(x), `$`(x, 2)) = (1-1/(j+1))*v1(x)+v2(x)/(j+1);
> eqnv2 := diff(v2(x), `$`(x, 2)) = -v1(x)/(A*(j+1))+(B/A+1/(A*(j+1)))*v2(x);

Next we get the general solution of this sytem of odes.

> soln := dsolve([eqnv1, eqnv2])

Next we have our solutions of the inhomogeneous problem1. Basically solution v1neg, v2neg on [0,xi] and v1pos, v2pos on [xi,1]. We will assume v1,v2 are C^1 across xi; however, the location of xi is not known at this time so they must remain split.

> v1neg := op([1, 2], soln)-1;
> v2neg := op([2, 2], soln)-1/B;
> v1pos := op([1, 2], soln)+1;
> v2pos := op([2, 2], soln)+1/B;

There's probably a better way to do this, but I relabeled the constants:

> v1negc := subs([_C1 = a[1], _C2 = a[2], _C3 = a[3], _C4 = a[4]], v1neg);
> v2negc := subs([_C1 = a[1], _C2 = a[2], _C3 = a[3], _C4 = a[4]], v2neg);
> v1posc := subs([_C1 = a[5], _C2 = a[6], _C3 = a[7], _C4 = a[8]], v1pos);
> v2posc := subs([_C1 = a[5], _C2 = a[6], _C3 = a[7], _C4 = a[8]], v2pos);

Next we have eight conditions the solutions must satisfy. Namely v1, v2 are C^1 across xi and v1',v2' are 0 at {0,1}.

> syscon1 := subs(x = xi, v1negc) = subs(x = xi, v1posc);
> syscon2 := subs(x = xi, v2negc) = subs(x = xi, v2posc);
> syscon3 := subs(x = xi, diff(v1negc, x)) = subs(x = xi, diff(v1posc, x));
> syscon4 := subs(x = xi, diff(v2negc, x)) = subs(x = xi, diff(v2posc, x));
> syscon5 := subs(x = 0, diff(v1negc, x)) = 0;
> syscon6 := subs(x = 0, diff(v2negc, x)) = 0;
> syscon7 := subs(x = 1, diff(v1posc, x)) = 0;
> syscon8 := subs(x = 1, diff(v2posc, x)) = 0;

We solve to get the constants for the solutions.

> constants := simplify(evalf(solve({syscon1, syscon2, syscon3, syscon4, syscon5, syscon6, syscon7, syscon8}, {a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8]})));

We substitute the values for the constants.

> a[1] := op([1, 2], constants); a[2] := op([2, 2], constants); a[3] := op([3, 2], constants); a[4] := op([4, 2], constants); a[5] := op([5, 2], constants); a[6] := op([6, 2], constants); a[7] := op([7, 2], constants); a[8] := op([8, 2], constants);

Lastly we try to verify that the conditions from earlier hold:

> evalf(subs(xi = .2, subs(x = xi, v1negc-v1posc)));
> evalf(subs(xi = .2, subs(x = xi, v2negc-v2posc)));
> evalf(subs([x = 0, xi = .2], diff(v1negc, x)));

They should hold for any xi, but they don't appear to. All of these should be 0. For a large xi, the numbers get very large so I was thinking perhaps roundoff error, but even when I do an exact solution and then evalf just at the end, I still have large error so I'm not sure what the problem is. Sorry for the long question. Thanks so much for the help.

I want to extract information  about an ODE.

For example, having the next ODE:

ode := cos(x)*(diff(y[1](x), x, x))+sinh((1/10)*x+1)*y[2](x)+y[1](x)+exp(-x)-1:

extract information as:

the inputs system are :


the independent variable is:



Some suggestion? I am tried with: indets, DEtools[odeadvisor], whattype, evaluating the function, convert it into a table and using the "indices". Probably the answer is related to dsolve/numeric/process_input


Bad title, I know. 

Suppose I have solved an ODE numerically, say for a function f(x). Now, I want to solve another ODE numerically, given by

diff(g(x),x) = f(x)*g(x)

I want to solve for g(x), and I only know f(x) from the numerical solution I obtained in the first ODE. How do I implement this in Maple?

I attached a worksheet with my naive attempt with this simple example. Basically I do not know how to set up the differential equation which I would then input to dsolve.


Hi everyone

I'm trying to solve the following system of ODE equations for my end paper and since I'm new with maple I couldn't find a way to do it. Can anyone Plz help me? I need to fit a curve to the result and gain a symbolic equation.

Here are the equations I need to solve

d^2*Y(x)/dt^2 = 500000*Y(x)*exp(-10/T(x))+d*Y(x)/dt

d^2*T(x)/dt^2 = 10*(-100000*Y(x)*exp(-10/T(x)))+d*T(x)/dt

with the follwoing boundary conditions:

Y(0)=1 , Y'(0)=0, T(0)=0 , T'(0)=0

I need to plot Y and T and then find then do the curve fitting thing.

I really appreciate your help.

Here it is:





I'd like to input it as 2-D and solve for x as a function of t.


and show whether there is sink or source?

ode1:=a(t)*(diff(a(t), t))+c(t)*(diff(c(t), t))=3*t;
ode2:=a(t)*(diff(a(t), t))+a(t)*(diff(a(t), t))*b(t)*(diff(b(t), t))*c(t)*(diff(c(t), t))=3*t;
ode3:=a(t)*(diff(a(t), t))+a(t)*(diff(a(t), t))*c(t)*(diff(c(t), t))+a(t)*(diff(a(t), t))*b(t)*(diff(b(t), t))*c(t)*(diff(c(t), t))=2*t;

DEtools[DEplot3d]({ode1,ode2,ode3},[a(t),b(t),c(t)],t=0.5..1.4,a=0..1.4,b=0..1.4,c=0..1.4,[[a(1)=1,b(1)=2,c(1)=3]],scene=[a(t),b(t),c(t)], arrows=medium);


unable to convert to explicit first order system, do not understand this error message

5 6 7 8 9 10 11 Last Page 7 of 29