Maple 16 Questions and Posts Maple 16 Questions and Posts Feed

These are Posts and Questions associated with the product, Maple 16

I've been poking around with convolutions on Maple, and some weird behavior came up---if I let it compute the convolution of a piecewise function, then take the convolution of that, it comes out differently than if I enter a function from scratch as the middle step---file attached (PiecewiseProblem.mw).  I'm not really a Maple pro, so am I'm doing something crazy here?

Thanks!

Dear all;

 

I want to plot the error defined in the last line.   the error is defined by the difference entre step h and step 2h for Heun method.

The code for Heun1 work well ( stepsize 2h),

Heun2 don't working. Please, I need a Help, maybe there is somethong missing.

here the code with maple code, without pciture.

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

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

## Heun Method with stepsize 2*h

Heun1 := proc(f, x0, h)
local x, y, i, N, k;
N := round((1/2)*x0/h);
y := Array(0 .. N);
x := Array(0 .. N);
x[0] := 0;
y[0] := (1/4)*Pi;
for i from 0 to N-1 do
x[i+1] := (i+1)*2*h;
k[1] := f(x[i], y[i]);
k[2] := f(x[i]+h, y[i]+h*k[1]);
y[i+1] := y[i]+(1/2)*h*(k[1]+k[2]);
 end do;
 evalf([seq([x[i], y[i]], i = 0..N)])
 end proc

 

## Heun Method with stepsize h

Heun2 := proc(f, x0, h)
local x, y, i, N, k;
N := round((1/2)*x0/h);
y := Array(0 .. 2*N);
x := Array(0 .. 2*N);
x[0] := 0;
y[0] := (1/4)*Pi;
for i from 0 to 2*N-1 do
x[i+1] := (i+1)*h;
k[1] := f(x[i], y[i]);
k[2] := f(x[i]+h, y[i]+h*k[1]);
y[i+1] := y[i]+(1/2)*h*(k[1]+k[2]);
 end do;
 evalf([seq([x[2*i], y[2*i]], i = 0..N)])
 end proc


 Heun1((x,y)->f(x, y), 1,1e-2);  ## Heun1 work very well


 Heun2((x,y)->f(x, y), 1,1e-2); ## Dont working...

## The error

x0:=1;

epsilon:= (x0,h)->sqrt(1/(( round(x0/(2*h))+1))*add(( Heun1((x,y)->f(x,y),x0,round(x0/(2*h)))[i][2]-Heun2((x,y)->f(x,y),x0,  round(x0/(2*h)))[i][2])^(2),i=1..N+1));

data[Heun] := [seq([h,epsilon(x0,h)], h =1e-2..1)];

loglog(epsilon(1,h),h=1e-2..1);

 

Dear all,

Thank you for your Help.

h: stepsize;

x in [0,x0];

I give all the step of my code, but I think there is a mistake. I wait for your Help.

I would like to compute the error between  Method Huen with step size h and step size 2h using the definition of epsilon given below:

 ## The error written epsilon(x0,h)= sqrt(1/(N+1) * sum_i=0^N  (y_i^{2h}-y_(2i)^h)^2 ), where y_i^(2h) is the approximation of y(i*2*h).

 ## We want : loglog epsilon versus h.

  epsilon:=(x0,h)->sqrt( 1/(N+1)*add( (Heun1(f,x0,i)-Heun2(f,x0,i))^2,i=0..N ) );

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

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

ic:=y(0)=1;  h:=x0/(2*N);

## Method Heun with step size 2h

> Heun1 := proc (f, x0,)

local x, y, i, h, k;

y := Array(0 .. N);

x := Array(0 .. N);

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

x[0] := 0;

y[0] := 1;

for i from 0 to N do

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

k[1] := f(x[i], y[i]);

k[2] := f(x[i]+h, y[i]+h*k[1]);

y[i+1] := y[i]+h*((1/2)*k[1]+(1/2)*k[2]);

end do;

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

end proc;

### Now Heun with step size h  ( the same h)

> Heun2 := proc (f, x0,)

local x, y, i, h, k;

y := Array(0 .. N);

x := Array(0 .. N);

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

x[0] := 0;

y[0] := 1;

for i from 0 to N do

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

k[1] := f(x[i], y[i]);

k[2] := f(x[i]+h, y[i]+h*k[1]);

y[i+1] := y[i]+h*((1/2)*k[1]+(1/2)*k[2]);

end do;

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

end proc;

 

 

Thanks you for your help.


                                

                        

 

Hi There,

 

Could you let me know how to tell Maple to use the ln simplification to give -ln(x)+ln(y) = ln(y/x).

 

I tried following command.

simplify(-ln(x)+ln(y), ln)

 

However, it is not able to give the required simplification.

Hi,

I wrote the following code which is properly run

 


restart:

# parametrs

MUR:=(1-phi)^2.5:
RhoUR:=(1-phi+phi*rho[p]/rho[f]):
RhoCPR:=(1-phi+phi*rhocp[p]/rhocp[f]):
BetaUR:=(phi*rho[p]*beta[p]+(1-phi)*rho[f]*beta[f])/(RhoUR*rho[f])/beta[f]:

dqu3:=diff(h(x),x$1)-RhoUR*BetaUR*T(x);
dqu2:=5*diff(T(x),x$2)+k[f]/k[nf]*Pr*RhoCPR*f(x)*diff(T(x),x$1);
dqu1:=5/(MUR)*diff(f(x),x$3)
+ 2*(diff(h(x),x$1)*x-h(x))
+RhoUR*(3*f(x)*diff(f(x),x$2)-diff(f(x),x$1)^2);
rho[f]:=998.2: cp[f]:=4182: k[f]:=0.597:   beta[f]:= 2.066/10000:
rho[p]:=3380: cp[p]:=773: k[p]:=36:   beta[p]:= 8.4/1000000:

k[nf]:=((k[p]+2*k[f])-2*phi*(k[f]-k[p]))/((k[p]+2*k[f])+phi*(k[f]-k[p])):
rhocp[nf]:=rho[p]*cp[p]*phi+rho[f]*cp[f]*(1-phi):
rhocp[p]:=rho[p]*cp[p]:
rhocp[f]:=rho[f]*cp[f]:

phi:=0.00:
binfinitive:=6: Pr:=7: lambda:=0:


with(plots):
pppe:=dsolve( {dqu1=0,dqu2=0,dqu3=0,T(0)=1,T(binfinitive)=0,f(0)=0,D(f)(0)=lambda,D(f)(binfinitive)=0,h(binfinitive)=0}, numeric );
-pppe(0);
print(odeplot(pppe,[x,diff(f(x),x)],0..binfinitive,color=black,numpoints=400));
print(odeplot(pppe,[[x,diff(f(x),x)]],0..binfinitive,color=black,numpoints=400));
print(odeplot(pppe,[[x,T(x)]],0..binfinitive,color=black,numpoints=400));


However, in some range of parameters, I must increase the value of binfinitive (for example binfinitive=50). however, my code is doesnt converge for higher values of 10 (at most). Can anyone change this algorithm in a way that it insensitive to the value of binfinitive?

Many thanks for your attention in advance

 

Amir

I plot a curve with "plot" command, how to export the figure to .emf format file?

Hi, the title isn't great as I didn't know how to describe this really. I need to solve the following equation for b:

y = (1-exp(-x*b))/(1-exp(-50*b))

When I put a value for y in, this is fine and fsolve gives me a numeric real solution. However, even when using RealDomain, it does not give me a real solution if I leave y as it is, and instead gives a 'RootOf' solution, which I don't really understand. This is the same whether using solve or isolate:

b=-(1/50)RootOf(_Zx-50ln(-y+ye^(_Z)+1))

I have the values of x and y for multiple data points and can put them in an nx1 matrix. Is there a way to replace x and y with matrices (with real numbers in) and solve for each set of points for b (ie there would be n values of b)? Obviously I could go through and put in each value of x and y but this would take ages, so was just wondering if there's a quick way to do this.

I have tried by simply putting matrices instead of the letter but get the error:

Error, invalid input: exp expects its 1st argument, x, to be of type algebraic, but received Vector(50, {(1) = -50*b, (2) = -49*b,...

Thanks for your time

James

I suppose you would have to programme this, because I couldn't find anything relating to vector spaces in my Maplesoft Linear Algebra tutor or package.

My question really is, you have a problem like, the set of all pairs of real numbers of the form (1,x) with the operations (1,y)+(1,y')=(1,y+y') and k(1,y)=(1,ky) 

( ^ taken straight out of my homework haha)

and you run through the 10 vecctor space axioms to determine whether it fails and it not a vector space, or it passes all and it is a vector space.

 

Is there a way to do this in Maplesoft?

 

Hell

I write this code and didn't work , I have some erorrs as

Warning, The use of global variables in numerical ODE problems is deprecated, and will be removed in a future release. Use the 'parameters' argument instead (see ?dsolve,numeric,parameters)
Warning, cannot evaluate the solution past the initial point, problem may be complex, initially singular or improperly set up

also I have question " How I can change the scale of plot"

parameters := [z = 0, Omega = 2.2758, tau = 13.8, T2 = 200, omega0 = 1, r = .7071, s = 2.2758, H = 1.05457173*10^(-34), omega = .5, k = 1666666.667, Delta = 1.7758]

 

sys1 := {diff(u(t), t) = s*v(t)-u(t)/T2, diff(v(t), t) = -s*u(t)-2*Omega*exp(-r^2/omega0^2-t^2*1.177^2/tau^2)*cos(kz-`ωt`)*w(t)-v(t)/T2, diff(w(t), t) = 2*Omega*exp(-r^2/omega0^2-t^2*1.177^2/tau^2)*cos(kz-`ωt`)*v(t)}; ICs1 := {u(-20) = 0, v(-20) = 0, w(-20) = -1}

 

ans1 := dsolve(`union`(eval(sys1, parameters), ICs1), numeric, output = listprocedure); plots:-odeplot(ans1, [[t, u(t)], [t, v(t)], [t, w(t)]], t = -20 .. 20, legend = [w, v, u])

 

U := eval(u(t), ans1); F := eval(((-2*10^33*Omega*H*r*U(t))*(1/omega0^2))*exp(-r^2/omega0^2-t^2*1.177^2/tau^2)*cos(kz-`ωt`), parameters)

 

plot(F, t = -20 .. 20)

Hi,

Please help me in solving system consist the three differential equations with three unknowns. I did already a few attempts, but I can not finish. Once in the final result was got RootOf and do not know what to do. I tried also numerically. I very very ask for some suggestions: ( 

with the boundary condition

parameters A,B,C are constans

 

1)

qa1 := A1*(diff(Tg(x), x, x))+A2*(diff(Tg(x), x))+(A3+A4)*Tg+A3*Tz+A4*Tw = 0;

eqa2 := B1*(diff(Tw(x), x, x))+B2*(diff(Tw(x), x))+(B3+B4)*Tw+B3*Tz+B4*Tg = 0;

eqa3 := C1*(diff(Tz(x), x, x))+(C3+C4)*Tz+C3*Tg+C4*Tw = 0

2)

On paper, the system of three equations with three unknowns I changed to system of two equations with two unknowns but still nothing. 

A[1] := 2, 

eqa1 := A[1]*C[1]*(diff(z(x), x, x, x, x))/C[3]+A[2]*C[1]*(diff(z(x), x, x, x))/C[3]+(A[1]*C[3]+A[1]*C[4]+A[3]*C[1]+A[4]*C[1])*(diff(z(x), x, x))/C[3]+(A[1]*C[3]+A[1]*C[4])*(diff(z(x), x))/C[3]+(A[3]*C[3]+A[3]*C[4]+A[4]*C[3]+A[4]*C[4]+A[3]*C[3])*z(x)/C[3]+A[1]*C[4]*(diff(y(x), x, x))/C[3]+A[2]*C[4]*(diff(y(x), x))/C[3]+(A[3]*C[4]+A[4]*C[4]+A[4]*C[3])*y(x)/C[3] = 0;

eqa2 := B[4]*C[1]*(diff(z(x), x, x))/C[3]+(B[4]*C[3]+B[4]*C[4]+B[3]*C[3])*z(x)/C[3]+B[1]*(diff(y(x), x, x))+B[2]*(diff(y(x), x))+(B[4]*C[3]+B[4]*C[4]+B[3]*C[3])*y(x)/C[3] = 0;

row := eqa1, eqa2;

sol := dsolve({row}, {y(x), z(x)});

 

Thank you very much for your help.

Ewa.

Dear Maple users,

 

i have a set of 2 Lines: L1 (determined by the intersection of plane x + y -1=0 and plane x - z - 1=0), 

L2 ( intersection of plane x + y-7=0 and plane x-y+1 = 0 ).

which functions or commands of maple should I use "visualize" those 2 lines L1 and L2?

 

thanks for your help,

 

JJ

Hallo guys,

I am newbie in Mapple, i could not solve the problem yet, here is my little function. I want to estimate beta with the Maximum Likelihood Estimation with Weibull: 

> MaximumLikelihoodEstimate(Weibull(beta, eta), F1); F1 := Vector([1500, 1750, 2250, 4000, 4300, 5000, 7000]);
print(`output redirected...`); # input placeholder
[beta = HFloat(HFloat(undefined)), eta = HFloat(HFloat(undefined))

]

 

May someone help me why i just get HFloat(undefined)  ?

 

Kind regards

Solve This Equation...

February 14 2014 Ratch 211

Can anyone tell me how to solve the equation above using Maple.  I know that there is a solution around x=0.995, y=0.743, but I cannot induce Maple to find it.  Any help or suggestions would be appreciated.

Ratch

 

I'm simplifying this Reynolds Equation starting from here:

Reynolds:=Diff(p(x)*h(x)^3/(12*mu)*Diff(p(x),x),x)-u(x)/2*Diff(p(x)*h(x),x)+Diff(p(x)*h(x)^3/(12*mu)*Diff(p(x),z),z)=Diff(p(x)*h(x),t):

 

Then I apply the dchange command:

dchange({p(x)=P(X)*Pa,x=Lx*X,h(x)=H(X)*h2},Reynolds,{P,h,X,u,H});

 

The problem is that it expands the new derivatives and I need the equation in its compact form.

How do I tel Maple only to make the substitution but not to expand the result?

I know that it expands by default, can I modify that?

 

 

In ode solve command i generated a large array data. The output shows a large order matrix of this form

 

[110001x6 Matrix

Datatype:Anything

Storage:rectangular

order:Fortran_order].

 

I want to export this matrix into a notepad. Which can then be used for plotting in TecPlot. 

 

Looking for good response

 

 

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