sarra

270 Reputation

6 Badges

11 years, 132 days

MaplePrimes Activity


These are questions asked by sarra

Dear all;

I have a simple question about round and floor. Please read these line.

I have an interval [0,a].  For a given step size h=a/N; N is an integrer.

all the noeuds in this interval are X[i]:=i*h; must be in the interval [0,a].

If we make a procedure with input h, and a. ANd the oupt put x[i]. I try this

 

sol:=proc(h,a)

local x, N, i;

x[0]:=0;

## My question how we define the N in the next line.  N:=floor(a/N); or N:=round(a/h);

N:=round(a/h);

for i from 0 to N-1 do:

x[i+1]:=x[i]+h;

end do:

seq([[x[i]], i=0..N);

end proc;

 

 

 

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.

 

Dear all

 

Please I need your help to simplify by the coefficient a in this Matrix

I have The matrix A defined by  A:=Matrix(2,2, [[a,a],[3*a,4*a]]);

I want with maple transform A to  A:=a*Matrix(2,2, [[1,1],[3,4]]);

Thanks for your Help.

 

 

Dear all,

Thanks for your answer. I have a simple question:

Let A be a Matrix, X[1] and X[2] two vectors.

I have this equation:  X[2]= X[1]+ A*X[1]+A*X[2];  Using Maple how can I  writte X[2] =P*X[1]; where P is a matrix to be founded.

Here, P:=(Id-A)^(-1)*A; But how using maple.

 

 

 

 

 

 

Dear all;

Please see only the last lines of this procedure,

1)I ask if this procedure give an output epsilon(x0,h). Really, I need your help. Thanks.

2) Can we plot epsilon(x0,h), versus h

 

> heun := proc (x0, h)

local x, y, i, N, k, f, ode, k1, k2, x1, x2, y1, y2;

f :=(x,y)-> 1/(1+cos(y)) ;

ode := diff(y(x), x) = f(x, y);

N := round((1/2)*x0/h);

y2 := Array(0 .. N);

x2 := Array(0 .. N);

y1 := Array(0 .. 2*N);

x1 := Array(0 .. 2*N);

x2[0] := 0; y2[0] := (1/4)*Pi;

for i from 0 to N-1 do

x1[2*i+2] := (2*i+2)*h;  k1[1] := f(x1[2*i], y1[2*i]); 

k1[2] := f(x1[2*i]+h, y1[2*i]+h*k1[1]);

y1[2*i+2] := y1[2*i]+(1/2)*h*(k1[1]+k1[2]);

x2[i+1] := (2*i+2)*h;

k2[1] := f(x2[i], y2[i]);

k2[2] := f(x2[i]+2*h, y2[i]+2*h*k2[1]);

y2[i+1] := y2[i]+h*(k2[1]+k2[2])

end do;

return firstresulat = evalf([seq([x2[i], y2[i]], i = 0 .. N)]);

return secondresulat =evalf([seq([x1[2*i], y1[2*i]], i = 0 .. N)]);

epsilon:=(x0,h)->add((firsttest[i][2]-secondtest[i][2])^2 , i=1..round(x0/(2*h))+1)

end proc;

 

 

First 15 16 17 18 19 20 21 Page 17 of 21