Items tagged with differential-equation

Feed

   ,Hello friends

  .I want to plot a coupled differential equation numerically  but I dont know whats wrong with the loops


 

 


 

numeric4.mw  .pdfnumeric4.pdf

 

ode1a := diff(y1(tt),tt) = round(rhs(odeparm1[1][1]))*y1(tt) + round(rhs(odeparm1[1][2]))*y2(tt) + round(rhs(odeparm1[1][3]))*y3(tt);
ode2a := diff(y2(tt),tt) = round(rhs(odeparm1[1][4]))*y1(tt) + round(rhs(odeparm1[1][5]))*y2(tt) + round(rhs(odeparm1[1][6]))*y3(tt);
ode3a := diff(y3(tt),tt) = round(rhs(odeparm1[1][7]))*y1(tt) + round(rhs(odeparm1[1][8]))*y2(tt) + round(rhs(odeparm1[1][9]))*y3(tt);
sys := subs(y3(tt)=1,[ode1a,ode2a]);
print(DEplot(sys, [y1(tt), y2(tt)], tt = 0 .. 16, y1 = -16 .. 16, y2 = -16 .. 16, color = magnitude, title = `Stable Limit Cycles`, arrows = curve, dirfield = 800, axes = none));

 

how to mirror the vector field graph mathematically?

mirror the graph about x=0 this line,

so that the graph looked flip

i find curl can do, but how to do ?

 

restart;
with(VectorCalculus):
SetCoordinates('cartesian'[x(t), y(t), z(t)]);
Curl((x(t),y(t),z(t)),(Diff(x(t),t) - a11*x(t) - a12*y(t) - a13*z(t),Diff(x(t),t) - a21*x(t) - a22*y(t) - a23*z(t),Diff(x(t),t) - a31*x(t) - a32*y(t) - a33*z(t)));
Error, (in VectorCalculus:-SetCoordinates) coordinate system `cartesian[x(t), y(t), z(t)]` does not exist
Error, (in Vector) dimension parameter is required for this form of initializer

 

hey... can u help me how to solve my problem using the Implicit Crank Nicolson Finite different Method. 1_ques_crank.mw..... problem in variable name A and u .. how to solve this 

 

restart

with(LinearAlgebra):

for i from 0 while i <= N+1 do u[i, 0] := 1 end do:

``

for i while i <= N do A[i, 0] := u[i-1, 0]+u[i+1, 0] end do:

 

for j from 0 while j <= N do A[0, j] := u[1, j]-.1*u[0, j]; A[10, j] := u[9, j]-.1*u[10, j] end do:

 

 

c := Matrix(10, 10, {(1, 1) = 2.1, (1, 2) = -1, (1, 3) = 0, (1, 4) = 0, (1, 5) = 0, (1, 6) = 0, (1, 7) = 0, (1, 8) = 0, (1, 9) = 0, (1, 10) = 0, (2, 1) = -1, (2, 2) = 4, (2, 3) = -1, (2, 4) = 0, (2, 5) = 0, (2, 6) = 0, (2, 7) = 0, (2, 8) = 0, (2, 9) = 0, (2, 10) = 0, (3, 1) = 0, (3, 2) = -1, (3, 3) = 4, (3, 4) = -1, (3, 5) = 0, (3, 6) = 0, (3, 7) = 0, (3, 8) = 0, (3, 9) = 0, (3, 10) = 0, (4, 1) = 0, (4, 2) = 0, (4, 3) = -1, (4, 4) = 4, (4, 5) = -1, (4, 6) = 0, (4, 7) = 0, (4, 8) = 0, (4, 9) = 0, (4, 10) = 0, (5, 1) = 0, (5, 2) = 0, (5, 3) = 0, (5, 4) = -1, (5, 5) = 4, (5, 6) = -1, (5, 7) = 0, (5, 8) = 0, (5, 9) = 0, (5, 10) = 0, (6, 1) = 0, (6, 2) = 0, (6, 3) = 0, (6, 4) = 0, (6, 5) = -1, (6, 6) = 4, (6, 7) = -1, (6, 8) = 0, (6, 9) = 0, (6, 10) = 0, (7, 1) = 0, (7, 2) = 0, (7, 3) = 0, (7, 4) = 0, (7, 5) = 0, (7, 6) = -1, (7, 7) = 4, (7, 8) = -10, (7, 9) = 0, (7, 10) = 0, (8, 1) = 0, (8, 2) = 0, (8, 3) = 0, (8, 4) = 0, (8, 5) = 0, (8, 6) = 0, (8, 7) = -1, (8, 8) = 4, (8, 9) = -1, (8, 10) = 0, (9, 1) = 0, (9, 2) = 0, (9, 3) = 0, (9, 4) = 0, (9, 5) = 0, (9, 6) = 0, (9, 7) = 0, (9, 8) = -1, (9, 9) = 4, (9, 10) = -1, (10, 1) = 0, (10, 2) = 0, (10, 3) = 0, (10, 4) = 0, (10, 5) = 0, (10, 6) = 0, (10, 7) = 0, (10, 8) = 0, (10, 9) = -1, (10, 10) = 4})

C := MatrixInverse(c):

for l from 0 while l <= N+1 do Known[l] := Matrix(N+1, 1, proc (i, j) options operator, arrow; A[i-1, l] end proc) end do:

for l from 0 while l <= N+1 do Known[l+1] := evalm(abs(Typesetting:-delayDotProduct(C, Known[l]))) end do:

``

``

 


 

Download 1_ques_crank.mw

 

 

 

 

Hey!

 

I have the following Diff. EQ. which I wish to solve:

 

EQ:=(3*x)*(diff(y(t),t,t)+y(t)=0

 

Where y(t) = sum(c[n]*x^n,n=0..infinity)

 

The result should be the following c[n+1] = -c[n]/(3*(n+1))

 

How would I solve this in Maple? Is there any package which can do this? Thank you! 

A new code based on higher derivative method has been implemented in Maple. A sample code is given below and explained. Because of the symbolic nature of Maple, this method works very well for a wide range of BVP problems.

The code solves BVPs written in the first order form dy/dx = f (Maple’s dsolve numeric converts general BVPs to this form and solves).

The code can handle unknown parameters in the model if sufficient boundary conditions are provided.

This code has been tested from Maple 8 to Maple 2017. For Digits:=15 or less, this code works in all of the Maple versions tested.

Most problems can be solved with Digits:=15 with atol = 1e-10 or so. This code can be used to get a tolerance value of 1e-20 or any high precision as needed by changing the number of Digits accordingly. This may be needed if the original variables are not properly sacled. With arbitrarily high Digits, the code fails in Maple 18 or later version, etc because Maple does not support SparseDirect Solver at high precision in some of the versions (hopefuly this bug can be removed in the future versions).

For simple problems, Maple’s dsolve/numeric is superior to the code developed as it is implemented in hardware floats. For large scale problems and stiff problems, the method developed is much more superior to Maple and comparable to (and often times better than) state of the art codes for BVPs - bvp4c (MATLAB), COLSYS,TWPBVP, etc.

The code, as written, cannot be used for problems with a singularity at end points (doable in the future). In addition, mixed boundary conditions are not supported in this version of the code (for example, y1(1)=y2(0)). Future updates will include the application of this approach for DAE-BVPs, currently not supported by Maple’s dsolve/numeric command.

A paper has been submitted to JCAM. I welcome feedback on the code and solicit input from Mapleprimes members if they are able to test (and break this code) for any BVP.

 

PDF of the paper submitted, example maple code and the solver as a text file needed are uploaded here. Additional examples are hosted on my website at http://depts.washington.edu/maple/HDM.html


 

 

##################################################################################

Troesch's problem
This is an inherently unstable, difficult, nonlinear, two-point BVP formulated by Weibel and Troesch that describes the confinement of a place column by radiation pressure. Increasing epsilon increases the stiffness of the ODE.
1. E.S. Weibel, On the confinement of a plasma by magnetostatic fields, Phys. Fluids. 2 (1959) 52-56.
2. B. Troesch, A simple approach to a sensitive two-point boundary value problem, J. Comput. Phys. 21 (1976) 279-290.

Introduction
The package HDM solves boundary value problems (BVPs) using higher derivative methods (HDM) in Maple®. We explain how to solve BVPs using this package. HDM can numerically solve BVPs of ordinary differential equations (ODEs) of the form shown is the fowllowing example.

###################################################################################

 

 

Reset the program to clear the memory from previous execution command.

restart:

 

Read the txt file which contains the HDM solver for BVPs.

read("HDM.txt");

 

Declare the precision for the entire Maple® sheet.

Digits:=15;

Digits := 15

(1)

 

Enter the first-order ODEs into EqODEs list.

EqODEs:=[diff(y1(x),x)=y2(x),diff(y2(x),x)=epsilon*sinh(epsilon*y1(x))];

EqODEs := [diff(y1(x), x) = y2(x), diff(y2(x), x) = epsilon*sinh(epsilon*y1(x))]

(2)

 

Define the left boundary condition (bc1), and the right boundary condition (bc2). One should collect all the terms in one side.

bc1:=evalf([y1(x)]);

bc1 := [y1(x)]

(3)

bc2:=evalf([y1(x)-1]);

bc2 := [y1(x)-1.]

(4)

 

Define the range (bc1 to bc2) of this BVP.

Range:=[0.,1.];

Range := [0., 1.]

(5)

 

List any known parameters in the list.

pars:=[epsilon=2];

pars := [epsilon = 2]

(6)

 

List any unknown parameters in the list. When there is no unknown parameter, use [ ].

unknownpars:=[];

unknownpars := []

(7)

 

Define the initial derivative in nder (default is 5 for 10th order) and the number of the nodes in nele (default is 10 and distributed evenly across the range provided by the user). The code adapts to increase the order. For many problems, 10th order method with 10 elements are sufficient.

nder:=5;nele:=10;

nder := 5

nele := 10

(8)

 

Define the absolute and relative tolerance for the local error. The error calculation is done based on the norm of both the 9th and 10th order simulation results.

atol:=1e-6;rtol:=atol/100;

atol := 0.1e-5

rtol := 0.100000000000000e-7

(9)

 

Call HDMadapt procedure, input all the information entered above and save the solution in sol. HDMadapt procedure does not need the initial guess for the mesh.

sol:= HDMadapt(EqODEs,bc1,bc2,pars,unknownpars,nder,nele,Range,atol,rtol):

 

Present some details of the solution.

sol[4]; # final derivative

5

(10)

sol[5]; # Maximum local RMSE

0.604570329905172e-8

(11)

 

Store the dimension of the solution (after adjusting the mesh) to NN.

NN:=nops(sol[3])+1;

NN := 11

(12)

 

Plot the interested variable (the ath ODE variable will be sol[1][i+NN*(a-1)] )

node:=nops(EqODEs);
odevars:=select(type,map(op,map(lhs,EqODEs)),'function');

node := 2

odevars := [y1(x), y2(x)]

(13)

xx:=Vector(NN):

xx[1]:=Range[1]:

for i from 1 to nops(sol[3]) do xx[i+1]:=xx[i]+sol[3][i]: od:

for j from 1 to node do
  plot([seq([xx[i],rhs(sol[1][i+NN*(j-1)])],i=1..NN)],axes=boxed,labels=[x,odevars[j]],style=point);
end do;

 

 


 

Download Example_3_Troesch.mws

 

my problem is how to put the third order IVP in derivate code for solving third order problems

the problem is y'''+2y"-9y'-18y=18x^2-18x+22

 

Digits := 18;
with(LinearAlgebra);
f := proc (n) -----;

derivative

g := proc (n)----- ;

please i need to know to to reresent it in the f := proc (n) and g := proc (n) where g := proc (n) is the derivative of f(x).

please any help 

 i need a help on how to find the local truncation error of a hybird block method of three order IVP. here is the one of the discrete methods i need to find the local truncation error. please any solution should put here thanks 

hi...

how I can dsolve this differential equations. parameter p is unkown.

I want to gain w(x) and u(x) and psi(x) and p.

thanks

sade.mw
 

restart; eq1 := (diff(psi(x), x))^2+(diff(u(x), x)+(8*(1/2))*(diff(w(x), x))^2)((diff(psi(x), x))^2)+3*(diff(w(x), x, x))+5*(diff(w(x), x, x))*(diff(psi(x), x))-7*(diff(u(x), x, x, x)+(8*(1/2))*(diff(w(x), x, x))^2+(3/2)*(diff(w(x), x, x, x))*(diff(w(x), x)))+3 = p

(diff(psi(x), x))^2+(diff(u(x), x))((diff(psi(x), x))^2)+4*(diff(w(x), x))((diff(psi(x), x))^2)^2+3*(diff(diff(w(x), x), x))+5*(diff(diff(w(x), x), x))*(diff(psi(x), x))-7*(diff(diff(diff(u(x), x), x), x))-28*(diff(diff(w(x), x), x))^2-(21/2)*(diff(diff(diff(w(x), x), x), x))*(diff(w(x), x))+3 = p

(1)

eq2 := (51-31)(diff(psi(x), x, x))+(52-2)(diff(w(x), x, x, x))+8*(diff(psi(x), x, x, x, x))-7*(diff(w(x), x)-psi(x)) = 0

70+8*(diff(diff(diff(diff(psi(x), x), x), x), x))-7*(diff(w(x), x))+7*psi(x) = 0

(2)

eq3 := 4*(diff(w(x), x, x)-(diff(psi(x), x)))+(23+11)(diff(psi(x), x, x, x))+(14+12)*(diff(w(x), x, x, x, x)) = 0

4*(diff(diff(w(x), x), x))-4*(diff(psi(x), x))+34+26*(diff(diff(diff(diff(w(x), x), x), x), x)) = 0

(3)

dsys3 := {eq1, eq2, eq3, psi(0) = 0, psi(1) = 0, u(0) = 0, u(1) = 0, w(0) = 0, w(1) = 0, ((D@@1)(psi))(0) = 0, ((D@@1)(psi))(1) = 0, ((D@@1)(w))(0) = 0, ((D@@1)(w))(1) = 0}; dsol5 := dsolve(dsys3, 'maxmesh' = 1200, numeric, abserr = .1, output = array([.5]))

Error, (in dsolve/numeric/bvp/convertsys) too few boundary conditions: expected 12, got 10

 

dsolve({eq2, eq3}, {psi(x), w(x)}):

with(PDEtools, casesplit, declare);

[casesplit, declare]

(4)

 


 

Download sade.mw

 

hi...

how i can dsolve this differential equations and obtain w(x) and U(x) and phi(x) analytical or numerically?

thanks

zah.mw
 

``

restart; L := 100; h := 1; eq1 := 1130*(diff(U(x), x, x))+1130*(diff(W(x), x))*(diff(W(x), x, x))+1130*(diff(U(x), x, x, x, x))

1130*(diff(diff(U(x), x), x))+1130*(diff(W(x), x))*(diff(diff(W(x), x), x))+1130*(diff(diff(diff(diff(U(x), x), x), x), x))

(1)

eq2 := 1130*(diff(W(x), x))*(diff(U(x), x, x)+(diff(W(x), x))*(diff(W(x), x, x)))+(diff(W(x), x, x))*(1130*(diff(U(x), x))+565*(diff(W(x), x))^2-2.2*(int(diff(varphi(z), z), z = -5/2 .. 5/2)))+(14125/6)*(diff(W(x), x, x, x, x, x, x))+(10405/6)*(diff(W(x), x, x, x, x))+10

1130*(diff(W(x), x))*(diff(diff(U(x), x), x)+(diff(W(x), x))*(diff(diff(W(x), x), x)))+(diff(diff(W(x), x), x))*(1130*(diff(U(x), x))+565*(diff(W(x), x))^2-2.2*(int(diff(varphi(z), z), z = -5/2 .. 5/2)))+(14125/6)*(diff(diff(diff(diff(diff(diff(W(x), x), x), x), x), x), x))+(10405/6)*(diff(diff(diff(diff(W(x), x), x), x), x))+10

(2)

eq3 := diff(varphi(z), z, z)-.35*(diff(W(x), x, x))

diff(diff(varphi(z), z), z)-.35*(diff(diff(W(x), x), x))

(3)

dsys3 := {eq1, eq2, eq3, U(0) = 0, U(L) = 0, W(0) = 0, W(L) = 0, `&varphi;`(-(1/2)*h) = 0, `&varphi;`(-(1/2)*h) = 2, ((D@@1)(W))(0) = 0, ((D@@1)(W))(L) = 0, ((D@@2)(W))(0) = 0, ((D@@2)(W))(L) = 0}; dsol5 := dsolve(dsys3, 'maxmesh' = 1200, numeric, abserr = .1, output = array([.5]))

Error, (in dsolve/numeric/process_input) input system must be an ODE system, got independent variables {x, z}

 

``


 

Download zah.mw

 

this equation is complicated

how to dsolve for this equation for function f ?

f(t,x,diff(x,t)) - f(t,x,p) - (diff(x,t)-p)*diff(f(t,x,p), p) = tan(t)
 

Hey. I have the following Diff. Equation:

diffeq := diff(y(t),t,t,t,t)+10*diff(y(t),t,t)+169*y(t)=0

and I have the conditions y(0) = 0, y'(0) = 1, and y(t) -> 0 for t -> infinity 

I know how to do with the first two conditions, but how do you do it with a boundary? I've read the posts made earlier on here, but I can't seem to figure it out. I've tried:

dsolve({diffeq,y(0)=0,D(y)(0)=1,D(y)(infinity)=0},y(t))
 

Returns nothing.

Any help would be appreciated.

 

#first_question :how can i solve set of nonlinear ODEs,faster or using any packages ?
#second_question :what can be some boundary conditions for this type of nonlinear ODEs? how many BCs are required for this set of nonlinear ODEs? ( to use numeric solution)

 


 

restart:with(DEtools):with(DifferentialAlgebra):

eq[1]:=diff(N(r),r$2)+2/r*diff(N(r),r)+diff(phi(r),r)/phi(r)*diff(N(r),r)-mu^2/(32*phi(r))*N(r);

diff(diff(N(r), r), r)+2*(diff(N(r), r))/r+(diff(phi(r), r))*(diff(N(r), r))/phi(r)-(1/32)*mu^2*N(r)/phi(r)

(1)

eq[2]:=diff(phi(r),r$2)+2/r*diff(phi(r),r)-1/2*diff(phi(r),r)^2/phi(r)-8*diff(N(r),r)^2/(omega*(1-2*G*M/r))*phi(r);

diff(diff(phi(r), r), r)+2*(diff(phi(r), r))/r-(1/2)*(diff(phi(r), r))^2/phi(r)-8*(diff(N(r), r))^2*phi(r)/(omega*(1-2*G*M/r))

(2)

dsolve({eq[1],eq[2]});

``


 

Download nonlinear_ODE.mw

the Initial value problem is well defined but i could not find solution of the problem. A number of method have been used but all are useless. How to obtained graph of the all equations. Also can we find the value of R (radius) where P is zero.coupled_IVP.mw

What would be the IBC conditions for the 1D heat equation describing the temperature distribution along a circular rod with a heat source at its base?

Dear Community,

I try to solve the following very simple ODE symbolically with the ODE Analyzer assistant, yet Maple says "unble to obtain solution". :-/

If I try to slove it with dsolve, nothing happens. Is it really so difficult?

diff(p(h),h)=A/(B+C*p(h)), p(h0)=p1

A, B, C, h0 and p1 are constants. I use Maple 2016.

Tx in advance,

best egards

Andras

1 2 3 4 5 6 7 Last Page 1 of 12