imparter

175 Reputation

8 Badges

12 years, 189 days

MaplePrimes Activity


These are questions asked by imparter

Hai

Help required to plot the graphs for system  difference schemes .

 I am attaching the codes and sample graphs and  maple query but still getting  error.

here is the codes 

restart;
restart; Digits := 1;
Pr:=0.01:E:=1:a:=0:N:=10:

`Δt`:=0.01:`Δy`:=0.01:

#Discritization scheme

for i from 1 by 1 while i<=N do;  
end:
for j from 0 by 1 while j<=N do;
end:

eq1[i, j] := (U[i, j+1]-U[i, j])/`&Delta;t` = (1/2)*Gr*(theta[i, j+1]+theta[i, j])+(1/2)*Gc*(C[i, j+1]+C[i, j])+(U[i-1, j+1]-2.*U[i, j+1]-2.*U[i, j]+U[i+1, j])/(2.*`&Delta;y`)^2-(1/2)*M*(U[i, j+1]+U[i, j]):

eq2[i, j] := (theta[i, j+1]-theta[i, j])/`&Delta;t` = (1/Pr)*(theta[i-1, j+1]-2*theta[i, j+1]+theta[i+1, j+1]+theta[i-1, j]-2*theta[i,j]+theta[i+1,j])/(2.*`&Delta;y`)^2-E*((1/`&Delta;y`)^2*(U[i+1, j]-U[i, j])^2):

eq3[i, j] := (C[i, j+1]-C[i, j])/`&Delta;t` = (1/Sc)*(C[i-1, j+1]-2*C[i, j+1]+C[i+1, j+1]+C[i-1, j]-2*C[i,j]+C[i+1,j])/(2*`&Delta;y`)^2-(K/2)*(C[i, j+1]-C[i, j]):
end do;  
Error, reserved word `end` unexpected
end do:
Error, reserved word `end` unexpected

# initial conditions
U[i, 0] := 0:
theta[i, 0]:= 0:
C[i, 0] := 0:
 

NULL;
U[0,j]:=exp(a*j*`&Delta;t`):
theta[0,j]:=(j*`&Delta;t`):
C[0,j]:=j*`&Delta;t`:

U[N,j]:=0:
theta[N,j]:=0:
C[N,j]:=0:

sys := ([seq])(seq(eq[i, j], j = 0 .. N), i = 1 .. N):
nops(sys);
vars:=indets(sys):
nn := Matrix(N+1, N+1,(i, j)-> U[i-1, j-1]):
##
p:=proc(kk) local U_res,A;
  U_res:=solve(eval(sys,k=kk),vars);
  A:=eval(nn,U_res);
  plots:-matrixplot(A)
end proc;

plots:-(U,[M],Y=0..4);

 

https://www.mapleprimes.com/questions/225117-How-To-Solve-This-Error-In-Maple

Dear maple user  any one suggest me how to solve  second order coupled differential equation using galerkin finite element method for 8 elements and 10 elements using maple codes

 

whats wrong with the codes while running the codes in maple 13 it will take memory and time as 41.80M, 9.29s while the same code is running in maple 18 it will take 1492.38M , 911.79s

Why the same codes take different time and memory. The codes are here

 

 

restart:
Digits:=15:
d1:=0.2:d2:=0.6:L1:=0.2:L2:=0.2:F:=0.3:Br:=0.3:
Gr:=0.2: Nb:=0.1:Nt:=0.3:B:=1:B1:=0.7:m:=1:k:=0.1:
Ro:=1:R1:=1:q:=1:alpha:=Pi/4:
h:=z->piecewise( z<=d1,    1,
                 z<=d1+L1,   1-(gamma1/(2*Ro))*(1 + cos(2*(Pi/L1)*(z - d1 - L1/2))), 
                        z<=B1-L2/2,  1 ,          
                    z<=B1,  1-(gamma2/(2*Ro))*(1 + cos(2*(Pi/L2)*(z - B1))),
                 z<=B1+L2/2,  R1-(gamma2/(2*Ro))*(1 + cos(2*(Pi/L2)*(z - B1))),
                 z<=B,    R1):
A:=(-m^2/4)-(1/4*k):
S1:=(h(z)^2)/4*A-ln(A*h(z)^2+1)*(1+h(z)^2)/4*A:
a2:=Int((1/S1),z=0..1):
b2:=Int((sin(alpha)/F),z=0..1):
c2:=(1/S1)*(-h(z)^6/(6912*A)-h(z)^4/(9216*A)+h(z)^2/(4608*A^3)+ln(1+A*h(z)^2)*(h(z)^6/(576*A)+h(z)^4/(512*A^2)-1/(4608*A^4))):
c3:=Int(c2,z=0..1):
c4:=2*Gr*(Nb-Nt)*c3:
e2:=(1/S1)*(-7*h(z)^4/(256*A)-h(z)^2/(128*A^2)+ln(1+A*h(z)^2)*(3*h(z)^4/(128*A)+h(z)^2/(32*A^2)+1/(128*A^3))):
e3:=Int(e2,z=0..1):
e4:=2*(Nt/Nb)*Br*e3:
l1:=-a2:
l2:=-b2-c4+e4:
Dp:=q*l1+l2:

igRe:=subsindets(Dp,specfunc(anything,Int),
                         u->Int(Re(op(1,u)),op(2,u),
                                   method=_d01ajc,epsilon=1e-6)):

plot([seq(eval(igRe,gamma2=j),j=[0,0.02,0.06])],gamma1=0.02..0.1,
     adaptive=false,
     legend = [gamma2 = 0.0,gamma2 = 0.02,gamma2 = 0.04],
     linestyle = [solid,dash,dot],
     color = [black,black,black],
     labels=[gamma1,'Re(Dp)'],
     gridlines=false, axes=boxed);

igIm:=subsindets(Dp,specfunc(anything,Int),
                         u->Int(Im(op(1,u)),op(2,u),
                                   method=_d01ajc,epsilon=1e-6)):

plot([seq(eval(igIm,gamma2=j),j=[0,0.02,0.06])],gamma1=0.02..0.1,
     adaptive=false,
     legend = [gamma2 = 0.0,gamma2 = 0.02,gamma2 = 0.04],
     linestyle = [solid,dash,dot],
     color = [black,black,black],
     labels=[gamma1,'Im(Dp)'],
     gridlines=false, axes=boxed);
 

 

Hi, all i am unable to plot the graphs ,can any one help me to overcome the error in plotting the graphs.I am using the maple 13. I am attaching the codes

restart:
with(plots):
with(IntegrationTools):
d1:=0.2:L1:=0.2:L2:=0.2:B1:=0.7:B:=1:beta:=0.01:
d2:=0.6:m:=0.1:k:=0.1: 

h:=z->piecewise( z<=d1,    1,
                z<=d1+L1,   1-(gamma1/(2))*(1 + cos(2*(Pi/L1)*(z-d1-L1/2))), 
                z<=B1-L2/2,  1 ,          
                z<=B1,  1-(gamma2/(2))*(1 + cos(2*(Pi/L2)*(z - B1))),
                z<=B1+L2/2,  1-(gamma2/(2))*(1 + cos(2*(Pi/L2)*(z - B1))),
                 z<=B,    1):
                
A:=(-m^2/4)-(1/(4*k)):
S1:=(h(z)^2)/(4*A)-ln(A*h(z)^2+1)*(1+h(z)^2)/(4*A):
b1:=evalf((1/S1)):               
c1:=evalf(Int(b1,z=0..1)):

plot([seq(eval(c1,gamma2=j),j in[0,0.02,0.06])],gamma1=0.02..0.1,legend = [gamma2 = 0.0, gamma2 = 0.02,gamma2 =0.04],linestyle = [solid,dash,dot],color = [black, black,black],axes=boxed); 
 

Hai, any one can help me to rectify my error

 I have evaluate the codes in maple and got different answer.

restart:
epsilon:=0.2:z:=0.9:m:=10:k:=0.8:
A:=(-m^2/4)-(1/(4*k)):
h(z):=1+epsilon*sin(2*Pi*z):
S1:=(h(z)^2)/(4*A)-ln(A*h(z)^2+1)*(1+h(z)^2)/(4*A):  
g1:=evalf((1/S1));

g1 := 8.821345336-11.12386331*I

but in mathematica i am getting  answer as (27.8647 + 35.2042 I)

ClearAll;
\[Epsilon] = 0.2;
h[z_] = 1 + \[Epsilon]*Sin[2*Pi*z];
m = 10;
k = 0.8;
A = -(m^2/4) - (1/4 k);
S1[z_] = (h[z]^2/4*A) - ((1 + h[z]^2)/4*A)*
    Log[(A*h[z]^2) + 1] /. {z -> 0.9}

 

3 4 5 6 7 8 9 Last Page 5 of 16