# Items tagged with numericalnumerical Tagged Items Feed

### Is it possible to solve piecewise differential equ...

July 12 2014
1 5

Is it possible to solve piecewise differential equations directly instead of separating the pieces and solving them separately.

like for example if i have a two dimensional function f(t,x) whose dynamics is as follows:

dynamics:= piecewise((t,x) in D1, pde1, pde2); where D1 is some region in (t,x)-plane

now is it possible to solve this system with one pde call numerically?

pde(dynamics, boundary conditions, numeric); doesnot work

### How do I compare solutions from numeric dsolve?...

July 04 2014
2 5

Hello,

This is probably a silly question, but I am trying to compare the difference between two variables in the numerical solution of a system of ODEs. Ideally, I would like a method to find the maximal difference that occurs between two variables.

The following is a highly simplified example of what I'm talking about. In this case I'd like some means to find the timepoint and magnitude of the maximal difference between y2(t) and y3(t) for t>0, which from the plot can be seen to occur at about 1.75 seconds. Note: I realise this particular case admits an analytic solution of y3(t) which could be exploited, but in the general case I'm interested in that won't be true.

 (1)

 (2)

### Solving ODE numerically...

June 17 2014
1 11

Hi. I am trying to identify mode shapes (phi(x)) and natural frequencies  of non-uniform euler-bernoulli beam. There are number of numerical methods to solve ODE with certain boundary conditions (i.e. Runge Kutta method). Problem is that I am newbie here. I am interested in particularly first vibration mode and its frequency. Is there anyone acquainted with it and would be able to help me?  Non-unif.mw

### writing data during iteration...

June 17 2014
0 1

I am writing a big numerical code in maple. I need to write the results in each step in a file. I mean in the first step of loop it writes the results in the first line of a text file, in the second step writes in the second line and to the end. when I use writedata command, it needs to write a complete array or matrix and it is not what i need. In  other words I want to save data for each steps of iteration during the calculation and when it goes to ther next step it writes the result in the next line.

Can you help me to perform it?

Thanks

### How can i improve my nummerical solution?...

June 14 2014
0 11

Hello guys ...

I used a numerically method to solve couple differential equation that it has some boundary conditions. My problem is that some range of answers has 50% error . Do you know things for improving our answers in maple ?

my problem is :

a*Φ''''(x)+b*Φ''(x)+c*Φ(x)+d*Ψ''(x)+e*Ψ(x):=0

d*Φ''(x)+e*Φ(x)+j*Ψ''(x)+h*Ψ(x):=0

suggestion method by preben Alsholm:

a,b,c,d,e,j,h are constants.suppose some numbers for these constants . I used this code:

VR22:=0.1178*diff(phi(x),x,x,x,x)-0.2167*diff(phi(x),x,x)+0.0156*diff(psi(x),x,x)+0.2852*phi(x)+0.0804*psi(x);
VS22:=0.3668*diff(psi(x),x,x)-0.0156*diff(phi(x),x,x)-0.8043*psi(x)-0.80400*phi(x);
bok:=evalf(dsolve({VR22=0,VS22=0}));

PHI,PSI:=op(subs(bok,[phi(x),psi(x)]));
Eqs:={eval(PHI,x=1.366)=1,eval(diff(PHI,x),x=1.366)=0,eval(PHI,x=-1.366)=1,eval(diff(PHI,x),x=-1.366)=0,
eval(PSI,x=1.366)=1,eval(PSI,x=1.366)=1};
C:=fsolve(Eqs,indets(%,name));
eval(bok,C);
SOL:=fnormal(evalc(%));

I used digits for my code at the first of writting.

### solve a nonlinear differential equation by numeric...

June 10 2014
0 6

hi,I want to solve this equation with the following boundary condition numerically by maple:

### Error, (in f) unable to store .......................

May 27 2014
0 2

Hello Hello everybody
I have to solve the following differential equation numerically

 > restart:with(plots):
 > mb:=765 : mp:=587 : Ib:=76.3*10^3 : Ip:=7.3*10^3 : l:=0.92 : d:=10: F:=490: omega:=0.43 :
 > eq1:=(mp+mb)*diff(x(t),t$2)+mp*(d*cos(theta(t))+l*cos(alpha(t)+theta(t)))*diff(theta(t),t$2)+mp*l*cos(alpha(t)+theta(t))*diff(alpha(t),t$2)+mp*(d*diff(theta(t),t)^2*sin(theta(t))+l*(diff(theta(t),t)+diff(alpha(t),t))^2*sin(alpha(t)+theta(t)))-F*sin(omega*t)=0;  (1)  > eq2:=(mp+mb)*diff(z(t),t$2)-mp*d*(sin(theta(t)+alpha(t))+sin(theta(t)))*diff(theta(t),t$2)-mp*l*sin(alpha(t)+theta(t))*diff(alpha(t),t$2)+mp*(d*diff(theta(t),t)^2*cos(theta(t))+l*(diff(theta(t),t)+diff(alpha(t),t))^2*cos(alpha(t)+theta(t)))+9.81*(mp+mb)-F*sin(omega*t)=0;
 (2)
 > eq3:=mp*(d*cos(theta(t))+l*cos(alpha(t)+theta(t)))*diff(x(t),t$2)-mp*(l*sin(theta(t)+alpha(t))+d*sin(theta(t)))*diff(z(t),t$2)+(Ip+Ib+mp*(d^2+l^2)+2*mp*d*l*cos(alpha(t)))*diff(theta(t),t$2)+[Ip+mp*l^2+mp*d*l*cos(alpha(t))]*diff(alpha(t),t$2)-mp*sin(alpha(t))*(l*d*diff(alpha(t),t)^2-l*d*(diff(alpha(t),t)+diff(theta(t),t))^2)+mp*9.81*l*sin(alpha(t)+theta(t))+mp*9.81*d*sin(theta(t))=0;
 (3)
 > eq4:=mp*l*cos(alpha(t)+theta(t))*diff(x(t),t$2)-mp*l*sin(alpha(t)+theta(t))*diff(z(t),t$2)+(Ip+mp*l^2+mp*d*l*cos(alpha(t)))*diff(theta(t),t$2)+(Ip+mp*l^2)*diff(alpha(t),t$2)-mp*9.81*l*sin(alpha(t)+theta(t))+l*d*mp*diff(theta(t),t$1)^2*sin(alpha(t))=0;  (4)  > CI:= x(0)=0,z(0)=0,theta(0)=0,alpha(0)=0,D(x)(0)=0,D(alpha)(0)=0,D(z)(0)=0,D(theta)(0)=0;  (5)  > solution:=dsolve([eq1,eq2,eq3,eq4, CI],numeric);  Error, (in f) unable to store '[0.]/(0.17571268341557e16+[-0.25659510610770e15])' when datatype=float[8] I don't know why it says : Error, (in f) unable to store '[0.]/(0.17571268341557e16+[-0.25659510610770e15])' when datatype=float[8] Help pleaase! thank you !!! ### Change Boundary condition from Dirichlet to Neuman... April 27 2014 1 0 Hi, Please I need help in this subject. I would like to compare the numerical solution obtained by finite difference and pdsolve/numeric. The equation considred is diffusion Equation using Forward-time centered-space (FTCS) stencil The code work well with Dirichlet boundary condition, but I want to let x=-1 Dirichlet boundary condition but on x=1, we put a Neumann condition likeeval( diff(u(t,x),x),x=1)=1. Thank you very much to put the necessary in the attached code the changment. Many thinks. ### Finding zeroes of a numerical solution of an ODE i... April 22 2014 2 4 I have numerically solved a system of ODEs and plotted the graphs of a[j](t) for each j=0..21. It was clear from the picture that each a[j] has a unique zero. Is there a maple command to locate these zeroes? ### comparison numerical and analytic... April 05 2014 1 11 Dear all; Please how can I plot the error between the two function. ### plot numerical solution explicite schemae... March 25 2014 0 1 Dear All, I need your help to plot the numerical solution. many thanks. The variable t in [0,T], x in [0,1], b in [0,2]. Difference finie for waves equation is : pde:=diff(u(x, y,t), t$2) = c^2*(diff(u(x, y,t),x$2)+diff(u(x,y,t),y$2));

i: according to x, j according to y, and k according to t.

u[i,j,k+1]=2*u[i,j,k]-u[i,j,k-1]+(c*dt/dx)^2*(u[i-1,j,k]-2*u[i,j,k]+u[i+1,j,k])+ (c*dt/dy)^2*(u[i,j-1,k]-2*u[i,j,k]+u[i,j+1,k])

Boundary condition: u(t=0)=1, diff(u(x,y,t),t=0)=0, and the normal derivative on the boundary of Omega =0.

How can solve this problem and plot the numerical solution.

### Numerical integration...

March 21 2014
1 4

I am trying to numerically evaluate the following integral

$\int_{-1}^0\int_{-\infty}^y&space;e^{10(-2y^2+y^4)}e^{-10(-2z^2+z^4)}dzdy$

I have currently used the maple commands

int(exp(10*(-2*y^2+y^4))*exp(-10*(-2*z^2+z^4)), [z = -infinity .. y, y = -1 .. 0], numeric)

evalf(int(exp(10*(-2*y^2+y^4))*exp(-10*(-2*z^2+z^4)), [z = -infinity .. y, y = -1 .. 0]))

evalf(Int(exp(10*(-2*y^2+y^4))*exp(-10*(-2*z^2+z^4)), [z = -infinity .. y, y = -1 .. 0]))

but all of them return the integral unevaluated. Any help?

### Order of error ...

March 17 2014
0 2

HI.

I need your remarks in this problem.

I have ode. diff(y(x),x)=f(x,y);  x in [0,a]; h:=a/(2*N); stepsize.

When the the true solution is not Known, we can test the rate of convergence, of numerical solution. The Numerical solution generated when the stepsize is 2*h denoted by y_i^(2h) and the numerical solution with step size h will be denoted by y_i^(h).

if we define the epsilon(h):=sqrt (  1/(N+1)*add(  (y_i^(2h) -y_(2i)^(h) )^2, i=0..N));

If we useForward Euler ( it's Known that the golbal error isof order 1 and local error of order 2) in the case when the exact solution is know.

But, If we use epsilon(h), and for the same method can some one know the order of Error =h^?????.

Thank you.

### how do i solve a nonlinear differential equation i...

March 10 2014
2 2

hi, I am new here I want to solve these toe coupled equations with the following boundary condition numerically:

1)  diff(f(eta),eta$3)+(1)/(2)*f(eta)*diff(f(eta),eta$2)-xi*(2*f(eta)*(diff(f(eta),eta))*

(diff(f(eta),eta,eta))+f(eta)^2*(diff(f(eta),eta,eta,eta))+eta*(diff(f(eta),eta))^2*(diff(f(eta),eta\$2)))-K*

(diff(f(eta),eta)-1)=0

2)   diff(theta(eta),eta,eta)+(1)/(2)*Pr*f(eta)*(diff(theta(eta),eta))=0

boundary conditions: 1)  f(0) = 0   2)  D(f)(0) = 0   3)  D(f)(infinity=10) = 1

1) theta(infinity=10) = 1      2) theta(0)=0

xi=0.2 ... 1    K=0.2     pr=0.7

### Deviation between solve and fsolve ...

March 03 2014
1 3

Dear All,

I analyzed some example of linear equation systems and tried to distinguish the difference between the solve and fsolve in these cases.

1. In general case, the deviation between solve and fsolve is less than 10^-8, for example:

But, in some case, the deviation is more than 10^-7, for example:

how to reduce the error of solving the problem by fsolve?

2. It seems that solve will automatically translate the answer into numerical result while the system is composed with decimals, for example, we redo the second case with no decimals:

Is it possible to get the exact solution while the decimal is involved in the system?

The related file is attached. I'd appreciate any help on this topic. Thank a lot.

solve_and_fsolve.mw

 1 2 3 4 5 6 7 Page 1 of 7
﻿