MaplePrimes Questions

Dear Users!
Hope everyone fine here. I tried (as given bellow) to find the solution of nonlinear system of PDEs via FDM. To solve system of nonlinear equations I used newton raphson method and for higher value of like Mx > 8 the matrix G and G1 (mentioned as red) take alot of time. Can anyone help me to reduce the computational time? Becuase I have to evealuate the solution for Mx = 50.


restart; Digits := 30; with(LinearAlgebra);
T := 1; L := 3; N := 30; Mx := 5; `Δx` := L/(1.*Mx); `Δt` := T/(1.*N);
for i from 0 while i <= Mx do
u[i, 0] := 0.; u[i, -1] := u[i, 1]; tau[i, 0] := 0.; theta[i, 0] := 0.; theta[i, -1] := theta[i, 1]
end do;
for n from 0 while n <= N do u[0, n] := 0.; u[Mx, n] := 0.; theta[0, n] := 1.; theta[Mx, n] := 0.
end do;
for n from 0 while n <= N-1 do
print("Simulation in proccess at time-level n", n+1);
for i while i <= Mx-1 do
Ru[i, n] := simplify((u[i+1, n+1]-u[i+1, n])/`&Delta;t`+(u[i+1, n+1]-2*u[i+1, n]+u[i+1, n-1])/`&Delta;t`^2-(u[i+1, n+1]-2*u[i, n+1]+u[i-1, n+1])/`&Delta;x`^2+25.*(u[i+1, n+1]+(u[i+1, n+1]-u[i+1, n])/`&Delta;t`)-1.5*(theta[i, n]+(theta[i, n+1]-theta[i, n])/`&Delta;t`));
`R&theta;`[i, n] := simplify((theta[i+1, n+1]-theta[i+1, n])/`&Delta;t`+(theta[i+1, n+1]-2*theta[i+1, n]+theta[i+1, n-1])/`&Delta;t`^2-(theta[i+1, n+1]-2*theta[i, n+1]+theta[i-1, n+1])/((15.)*`&Delta;x`^2)-((u[i, n+1]-u[i-1, n+1])/`&Delta;x`)^2/(3.)) end do;
for i while i <= Mx-1 do
`R&tau;`[i, n] := simplify(tau[i+1, n+1]+(tau[i+1, n+1]-tau[i+1, n])/`&Delta;t`-1.5^(-1/4)*(u[i+1, n+1]-u[i, n+1])/`&Delta;x`)
end do;
Sys := `<,>`(seq(Ru[i, n], i = 1 .. Mx-1), seq(`R&tau;`[i, n], i = 1 .. Mx-1), seq(`R&theta;`[i, n], i = 1 .. Mx-1));
V := `<,>`(seq(u[i, n+1], i = 1 .. Mx-1), seq(theta[i, n+1], i = 1 .. Mx-1), seq(tau[i, n+1], i = 2 .. Mx));
G := Matrix(3*(Mx-1), proc (i, j) options operator, arrow; diff(Sys[i], V[j]) end proc); G1 := MatrixInverse(G);
X[n, 0] := Vector(1 .. 3*(Mx-1), 1);
for k1 from 0 to r do
X[n, k1+1] := eval(V-G1 . Sys, Equate(V, X[n, k1]))
end do;
Sol[n] := Equate(V, X[n, r+1]); assign(op(Sol[n]));
if n > 0 then
U := eval(`<,>`(seq(u[i1, n+1], i1 = 1 .. Mx)-seq(u[i1, n], i1 = 1 .. Mx))); Noru[n+1] := Norm(%, 2); print("L[&infin;] norm of &tau;(x,y,t) at time level = ", %);
Theta := eval(`<,>`(seq(theta[i1, n+1], i1 = 0 .. Mx)-seq(theta[i1, n], i1 = 0 .. Mx))); `Nor&theta;`[n+1] := Norm(%, 2); print("L[&infin;] norm of &theta;(x,y,t) at time level = ", %) else print("n < 0")
end if end do

Special request to:
@acer @Carl Love @Kitonum @Preben Alsholm

Hey, im new to maple and have a few questions.

1. Sometimes, when i type e.g. a:=10 the blue evaluate line shows "a = 10" and sometimes it just shows "10"

is there a way to get that straight?

Hello,

I am little confused about the help file regarding the VectorCalculus:-PositionVector function. 

In the help file the first argument "comps" is defined as 
"list(algebraic); specify the components of the position Vector"

In spherical coordinates, the position vector is

r e_r

So, if the position vector to be entered is given in terms of the components (in spherical coordinates), the VectorCalculus:-PositionVector function should be called as

VectorCalculus:-PositionVector([r,0,0],spherical)

But this returns

[0,0,r]

(in the cartesian frame). This would make sense if r coordinates is r, theta coordinate is 0 and phi coordinate is 0. 

However, if I call it as

VectorCalculus:-PositionVector([a,b,c],spherical)

Then I end up with

[a*sin(b)*cos(c),a*sin(b)*sin(c),a*cos(b)]

Thus, the "components" given in PositionVector are not the components but the coordinates r=a, theta=b, and phi=c.

Am I missing something here or the help file is misleading? 

I appriciate your help. 

Thanks a lot.

 

Hi erverybody:
How can I get the Laurent serie for function f(x)=1/(1-x^2) about x=1 with condition: abs(x-1)<2
tnx...

I have a problem with evaluation. The eval(s, eqns) does not evaluate s before evaluation with eqns.

How do I do this?

vars := indets(eqns);

lprint(vars)

{exp(-2*t), exp(1/4*(-11+73^(1/2))*t), exp(-1/4*(11+73^(1/2))*t), i[C1](t), i[R1](t), i[R2](t), i[R3](t), i[V1](t), v[1](t), v[2](t), v[3](t),    v[4](t), v[L1](t), v[R1](t), v[R2](t), v[R3](t), v[V1](t)}

for s in indets(others) do
    if has(s, i) or has(s, v) then print(s);eval(s, eqns); end if;
end do:

Hi!

 

I am trying to construct multiple math plots within one procedure, however, only one is displayed at a time, and it is always at the end of the outputs. I searched for that peculiar behaviour and eventually found on

https://de.maplesoft.com/support/help/Maple/view.aspx?path=DataFrame/Tabulate

the line

This command inserts the assembly of Tables and Embedded Components into the worksheet using the InsertContent facility. The inserted content is placed after any usual output of the Execution Group in which this command is called. Each Execution Group allows for only one inserted result to exist at any given time. Multiple calls to commands which utilize the InsertContent facility made within the same Execution Group will result in each successive inserted assembly replacing any assembly inserted earlier for that Execution Group.

 

Is there a workaround for this issue? I cannot find one, e.g. on

https://de.maplesoft.com/support/help/Maple/view.aspx?path=DocumentTools%2fInsertContent

Thank you in advance. :)

Hi!

I have trouble using ArrayTools, specifically Extend, to create a DataFrame. DF1 and DF2 are, even though awkwardly, created correctly, DF 3 does not work. My code is this:

with(ArrayTools):

with(DocumentTools):

nOben:=10;

nUnten:=3;

InitialisierungDF:=Vector(nOben-nUnten+1); #Initialisierung des Dataframes für die Tabelle
InitialisierungSpalte:=Vector[row](nOben-nUnten+1);
for i from 1 to nOben-nUnten+1 do
 InitialisierungDF(i):=oE;
 InitialisierungSpalte(i):=n=i;
end do;
print(InitialisierungDF);
print(InitialisierungSpalte);
DF1:= DataFrame( < InitialisierungDF | InitialisierungDF | InitialisierungDF | InitialisierungDF>,
            columns = [ GK, PZP, PZM, PY],
            rows = InitialisierungSpalte);  
DF2:= DataFrame( < InitialisierungDF | InitialisierungDF | InitialisierungDF | InitialisierungDF>,
            columns = [ GK, PZP, PZM, PY],
            rows = InitialisierungSpalte);
Tabulate(DF1);

print(InitialisierungSpalte);
print(Extend(InitialisierungDF,[oE]));
print(Extend(InitialisierungSpalte,[RMSE]));
InitialisierungDF:=Extend(InitialisierungDF,[oE]);
InitialisierungSpalte:=Extend(InitialisierungSpalte,[RMSE]);  
DF3:= DataFrame( < InitialisierungDF | InitialisierungDF | InitialisierungDF | InitialisierungDF>,
            columns = [ GK, PZP, PZM, PY],
            rows = InitialisierungSpalte);

 

The result is supposed to be a math table of the form

           GK   PZP    PZM   PY

n=1     oE     oE       oE     oE

n=2     oE     oE       oE     oE

...

RMSE  oE    oE      oE       oE

 

I have run into multiple problems, potentially bugs. First, I have to initialize awkwardly with

 

InitialisierungDF:=Vector(nOben-nUnten+1); #Initialisierung des Dataframes für die Tabelle
InitialisierungSpalte:=Vector[row](nOben-nUnten+1);
for i from 1 to nOben-nUnten+1 do
 InitialisierungDF(i):=oE;
 InitialisierungSpalte(i):=n=i;
end do;

 

because InitialisierungDF:=Vector(1..nOben-nUnten+1,oE) doesn't work and produces entries like oE(1) for whatever reason.

Then, creating the data frame DF3 does not work at all with the above mentioned code.

 

InitialisierungDF:=Vector(nOben-nUnten+1); #Initialisierung des Dataframes für die Tabelle
InitialisierungSpalte:=Vector[row](nOben-nUnten+1);
for i from 1 to nOben-nUnten+1 do
 InitialisierungDF(i):=oE;
 InitialisierungSpalte(i):=n=i;
end do;
print(InitialisierungDF);
print(InitialisierungSpalte);
DF1:= DataFrame( < InitialisierungDF | InitialisierungDF | InitialisierungDF | InitialisierungDF>,
            columns = [ GK, PZP, PZM, PY],
            rows = InitialisierungSpalte);  
DF2:= DataFrame( < InitialisierungDF | InitialisierungDF | InitialisierungDF | InitialisierungDF>,
            columns = [ GK, PZP, PZM, PY],
            rows = InitialisierungSpalte);

print(InitialisierungSpalte);
print(Extend(InitialisierungDF,[oE]));
print(Extend(InitialisierungSpalte,[RMSE]));
 
DF3:= DataFrame(<Extend(InitialisierungDF,[oE])|Extend(InitialisierungDF,[oE])|Extend(InitialisierungDF),[oE]|Extend(InitialisierungDF,[oE])>,
            columns = [ GK, PZP, PZM, PY],
            rows = Extend(InitialisierungSpalte,[RMSE]));  


doesn't work either, however, this time a different error occurs. Looking at the vectors the dimensions seem to be correct in each case, though. Any suggestions on how to fix these things?

Hello everyone

Please help me about IntegrationTools:-Change does not transform x to u

IntegrationTools:-Change(int(3*x*sqrt(x+8), x)) 

I want to convert that primitive to a primitive like this: (2/3)*(Int(u^2*(u^2-8), u)) and Error, (in IntegrationTools:-Change) invalid boolean expression: 1
 

Please help me

Help_integrationTools.mw

Hello there, 

When I tried to solve an equation using the 'solve' command in Maple, I got an answer. 

However, I could not understand how Maple got to the answer. Would you tell me what steps Maple might have gone through in order to come to the answer?

Here is my worksheet:

q20210130.mw

Maple Worksheet - Error

Failed to load the worksheet /maplenet/convert/q20210130.mw .
 

Download q20210130.mw

PS) Perhaps this editbox began to dislike Google Chrome.

 

 

Dear Maple Users,

I appreciate your help with the previous 1D PDE problem that I posted.

Now I have another 2D axisymmetric diffusion PDE, looking for u(r,z,t), no variation in the theta direction:

PDE: u't = alpha*(u"r + (1/r)*u'r + u"z); a < r < b, 0 < z < L, 0 < t < infinity

BC1: u| z = L = Psi_s

BC2: -alpha*u'zz = 0 = 0

BC3: -alpha*u'r| r = a = 0

BC4: -alpha*u'r| r = b = flux_b

IC: u(r,z,0) = (z/L)*Psi_s

a, b, L, alpha, Psi_s, flux_b are given.

My attempt at a solution is attached, following the solution path that you provided for the previous 1D PDE problem.

2D_CCS_PDE_Sol.mw

I have run into an error message that I am unable to resolve. I would greatly appreciate your taking a look at this.

Perhaps, there is no closed form solution to this problem and a numerical solution may have to be attempted.

Please advise. Thanks.

Joseph Thodiyil 

How do I print the body of a procedure.  In older versions, verboseproc controlled this.

restart

interface(verboseproc = 3)

interface(prettyprint = 1)

print(int)

                  _m140116321288416, [_m140116321288416]

print(type);
                 proc () option builtin = type; end proc,

                   [proc () option builtin = type; end proc]

 

 

Can I make something like it using codegen (dinamically set parameters and default arguments freely)?
proc( a , b::integer , c:=0 , d::integer:=1 , { e:=2 , f::integer:=3 } ) return a, b, c, d, e, f end proc

eq1 := diff(h(t), [`$`(t, nu)])+(1/4)*h(t) = 8/3*(1/(sqrt(Pi)*t^(1/2))-(3/32)*t^2+(3/16)*exp(-t)-1);


with ics h^k (0)=0 for k=0..n

 

 

 

 

 

 

Dear Maple Users,

This particular question is example problem 8.4.1 in the textbook: "PDE & BVP with MAPLE", 2nd Edition by George A. Articolo.

I shall paraphrase the problem here and attach the Maple Worksheet solution as detailed in the textbook.

We seek the temperature distribution u(x,t) in a thin rod whose lateral surface is insulated over the interval I = {x | 0 <x<1}. The left end of the rod is held at a fixed temperature of 10, and the right end is held at the fixed temperature of 20. There is no internal heat source. The thermal diffusivity of the rod is k = 1/20, and the rod has an intitial temperature distribution u(x,0) = f(x) given as follows.

The nonhomogeneous diffusion equation is:

ut'(x,t) = k*ux"(x,t) +h(x,t)

The BCs are nonhomogeneous:

u(0,t) = 10

u(1,t) = 20

The IC is:

u(x,0) = 60x -50x2+10

The internal heat source term is:

h(x,t) = 0

I have typed in the MAPLE commands exactly as in the textbook (attached), but it does not execute in my Student 2020 version of MAPLE.

Could you please take a look at the attached MAPLE worksheet and let me know if something can be done to make it work.

Thank you for your help.

Joe Thodiyil

George_A_Articolo_2ndEdition_Ex_8.4.1_PDE.mw

Dear all

I solve a given pde with some conditions given, but I get 

unable to handle PDE problem subject to boundary conditions 

solution_pdes.mw

many thanks for your help

 

 

First 193 194 195 196 197 198 199 Last Page 195 of 2177