MaplePrimes Questions

Dear Users!

Hoped everyone fine here. I have three main questions regarding the maple code given bellow:

restart; with(LinearAlgebra); with(plots);

alpha := 1; beta := 1; theta := 1/2;

UU := sinh(x)*sinh(y)*sinh(z)*exp(-1.*t);

NN := 3; L := 0; R := 1; T := 1; N := NN; Mx := NN; My := NN; Mz := NN; `Δx` := (R-L)/Mx; `Δy` := (R-L)/My; `Δz` := (R-L)/Mz; `Δt` := (R-L)/N;

kappa[1] := 1; kappa[2] := 2/x^2; kappa[3] := 1/x^2; kappa[X] := x^2+y^2+z^2+1; kappa[Y] := x^2+y^2+z^2+1; kappa[Z] := x^2+y^2+z^2+1; kappa[4] := 0; NL := 3;

ics := [seq(seq(seq([u[i, j, k, 0] = eval(UU, [x = i*`Δx`, y = j*`Δy`, z = k*`Δz`, t = 0]), u[i, j, k, -1] = eval(u[i, j, k, 1]-2*`Δt`*(eval(diff(UU, t), t = 0)), [x = i*`Δx`, y = j*`Δy`, z = k*`Δz`, t = 0])][], i = 0 .. Mx), j = 0 .. My), k = 0 .. Mz)];

bcs := [seq(seq(seq([u[0, j, k, n] = eval(UU, [x = 0, y = j*`Δy`, z = k*`Δz`, t = n*`Δt`]), u[Mx, j, k, n] = eval(UU, [x = L, y = j*`Δy`, z = k*`Δz`, t = n*`Δt`])][], j = 0 .. My), k = 0 .. Mz), n = 1 .. N), seq(seq(seq([u[i, 0, k, n] = eval(UU, [x = i*`Δx`, y = 0, z = k*`Δz`, t = n*`Δt`]), u[i, My, k, n] = eval(UU, [x = i*`Δx`, y = L, z = k*`Δz`, t = n*`Δt`])][], i = 1 .. Mx-1), k = 0 .. Mz), n = 1 .. N), seq(seq(seq([u[i, j, 0, n] = eval(UU, [x = i*`Δx`, y = j*`Δy`, z = 0, t = n*`Δt`]), u[i, j, Mz, n] = eval(UU, [x = i*`Δx`, y = j*`Δy`, z = L, t = n*`Δt`])][], i = 1 .. Mx-1), j = 1 .. My-1), n = 1 .. N)];
Sol := {u[1, 1, 1, 1] = 0.2366497936e-1, u[1, 1, 1, 2] = 0.7589975856e-2, u[1, 1, 1, 3] = 0.6029906475e-3, u[1, 1, 2, 1] = 0.3778786317e-1, u[1, 1, 2, 2] = 0.7126415819e-2, u[1, 1, 2, 3] = -0.1197885714e-2, u[1, 2, 1, 1] = 0.3778786315e-1, u[1, 2, 1, 2] = 0.7126415820e-2, u[1, 2, 1, 3] = -0.1197885718e-2, u[1, 2, 2, 1] = 0.6038763054e-1, u[1, 2, 2, 2] = 0.4264591907e-2, u[1, 2, 2, 3] = -0.3509477851e-2, u[2, 1, 1, 1] = 0.3171958616e-1, u[2, 1, 1, 2] = -0.1327161715e-1, u[2, 1, 1, 3] = -0.4628647419e-2, u[2, 1, 2, 1] = 0.4979852397e-1, u[2, 1, 2, 2] = -0.3060811899e-1, u[2, 1, 2, 3] = -0.344914876e-4, u[2, 2, 1, 1] = 0.4979852397e-1, u[2, 2, 1, 2] = -0.3060811898e-1, u[2, 2, 1, 3] = -0.3449150010e-4, u[2, 2, 2, 1] = 0.7882396741e-1, u[2, 2, 2, 2] = -0.6192340018e-1, u[2, 2, 2, 3] = 0.1156615222e-1}

Using set of points given in ics, bcs and Sol

1. I want to contruct a vector at any time level (by fixing fourth suffix like u[i,j,k,n]) for i = 0..Mx,j=0..My,k=0..Mz and then find its L2 and L[infinity] norms.

2. Next I want contruct a vector by fixing two suffixes like u[i,j,k,n]) for i = 0..Mx,j=0..My and plot a surface in 3D

3. Finally I want to construct a vector by fixing three suffixes like u[i,j,k,n]) for i = 0..Mx, and plot a curve in 2D.

I'm waiting for your positive respone. I shall be very thankfull to you in advance.

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

Hello

I have a couple of functions wrapped into a module and want to make them available as a package.  The two modules have been saved as a mpl file.   I read and tried to follow the instructions on the online help (11. Writing packages) but even copying line by line of commands there, they simply did not work at all.    

Problems:

1) After following the instructions on how to add a home dir into libname and saved it .mapleinit (I guess) I issued the commands

restart; libname;

my lib path is not there anymore.  

.mapleinit shows

libname := "mylibdir", libname:

libname:="/Users/eduardo/maple/toolbox/personal/lib", libname:

 

2) After issuing savelib, I did

LibraryTools:-ShowContents(libname[1]);

that returns [];

Could you send me a set of commands showing how to do it, please?  

Many thanks

Ed

PS.  My next step is to write help files for each one of the functions.  

 

j:=500:tp:=0.07*j:Ap:=0.25:Aq:=0.3:tq:=0.03*j:tr1:=0.05*j:Ar:=2:As:=0.4:tr2:=0.04*j:ts:=0.04*j:tt:=0.17*j:At:=0.4:
u1:=0:
u2:=(Ap/2)*(sin((2*Pi*t/tp)+(3*Pi/2))+1);
u3:=0:
u4:=-(Aq/tq)*t:
u5:=(((Ar+ Aq)/tr1)*t)-Aq:
u6:=-(((Ar+ As)/tr2)*t)+Ar:
u7:=((As/ts)*t)- As:
u8:=0:
u9:=(At/2)*(sin((2*Pi*t/tt)+(3*Pi/2))+1):
u10:=0:
     u2 := -0.1250000000 cos(0.1795195802 t) + 0.1250000000


r1:=plot([u1],t=1..0.1*j):
r2:=plot([u2],t=1..tp):
r3:=plot([u3],t=1..0.08*j):
r4:=plot([u4],t=1..tq):
r5:=plot([u5],t=1..tr1):
r6:=plot([u6],t=1..tr2):
r7:=plot([u7],t=1..ts):
r8:=plot([u8],t=1..0.1*j):
r9:=plot([u9],t=1..tt):
r10:=plot([u10],t=1..0.08*j):
with(plots):
display(r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,view=[0..100,-1..3],axes=boxed);

the same above code works in matlab

in maple it isnot

Hi! 

It seem like im not the only one with this problem, but i have a corrupted maple file containing much of my work throughout the semester, and now i cant open it, giving me the error message: "There were problems during the loading process. Your worksheet may be incomplete." It seems like im not the only one with this problem.. So im hoping that there is someone out there who can recover the document, or atleast parts of it. If so i would be very gratefull.. 


Maple Worksheet - Error

Failed to load the worksheet /maplenet/convert/Opgaver_på_klassen_(1).mw .
 

Download Opgaver_på_klassen_(1).mw
 

 

L1:=[1,2,5,6,9]:


L2:=[0,-2,5,6,9]:

fourthNONLINEARBOUD234.mwfourthNONLINEARBOUD234.mw
 

``

NULL

NULL

NULL

[0., 0, 0.]

(1)

restart

with(LinearAlgebra)

``

for i to 1 do for j from 0 by .1 to 1 do Exact[j] := exp(j); Y[0] := proc (x) options operator, arrow; 1+x-(58/9)*x^2-3*x^2*exp(1)+(64/9)*x^2*exp(3/4)+(40/9)*x^3+4*x^3*exp(1)-(64/9)*x^3*exp(3/4) end proc; Ics := Z(0) = 1, (D(Z))(0) = 1, Z(1) = exp(1), Z(3/4) = exp(3/4); exp(-x) := convert(taylor(exp(-x), x = 0, 5), polynom); f := proc (x) options operator, arrow; 0 end proc; p := proc (x) options operator, arrow; 0 end proc; q := proc (x) options operator, arrow; 0 end proc; r := proc (x) options operator, arrow; 0 end proc; u := proc (x) options operator, arrow; 0 end proc; eq[i] := diff(Z(x), `$`(x, 4)) = 0.1e-2*(diff(Y[i-1](x), `$`(x, 4)))+.999*(f(x)+exp(-x)*Y[i-1](x)*Y[i-1](x)); s[i] := dsolve({Ics, eq[i]}, Z(x)); Y[i] := unapply(op(2, s[i]), x); App[j] := evalf(Y[i](j)); Er[j] := abs(App[j]-Exact[j]); A[i] := print([App[j], Exact[j], Er[j]]) end do end do

[1., 1, 0.]

 

[1.105170012, 1.105170918, 0.906e-6]

 

[1.221399998, 1.221402758, 0.2760e-5]

 

[1.349854378, 1.349858808, 0.4430e-5]

 

[1.491819577, 1.491824698, 0.5121e-5]

 

[1.648716753, 1.648721271, 0.4518e-5]

 

[1.822115950, 1.822118800, 0.2850e-5]

 

[2.013751870, 2.013752707, 0.837e-6]

 

[2.225541500, 2.225540928, 0.572e-6]

 

[2.459603808, 2.459603111, 0.697e-6]

 

[2.718281833, 2.718281828, 0.5e-8]

 

[2., 1, 1.]

 

[2., 1.105170918, .894829082]

 

[2., 1.221402758, .778597242]

 

[2., 1.349858808, .650141192]

 

[2., 1.491824698, .508175302]

 

[2., 1.648721271, .351278729]

 

[2., 1.822118800, .177881200]

 

[2., 2.013752707, 0.13752707e-1]

 

[2., 2.225540928, .225540928]

 

[2., 2.459603111, .459603111]

 

[2., 2.718281828, .718281828]

(2)

``

``


 

Download fourthNONLINEARBOUD234.mw

 

Hi everyone, I have a mechanical problem, I solved it using hybrid method (differential transformation method for time and finite difference method for space) I need some help please.

How do i pipe maple output to the clipboard and vice versa (assigning clipboard content to a variable declared in a maple worksheet)?

Hello.

With the Curvefitting[Spline] command I calculate a piecewise function from discrete points. I perform this action 250 times and save the piecewise functions into a matrix. The process takes quite a while. Is it possible to save said matrix to a file such that I may call it from other maple worksheets, instead of re-calculating the matrix every time I want to use it?

Thanks. 

I have a simple proc that generates some arrays based in some input values.

I have a function that uses the proc to do math on the array. I have anoother function that uses that function to do more things. The last function does not evaluate because it says that it is unable to evaluate the sequence in the proc.

 

It seems that because I am summing over the first function and the sum variable is "unknown" the proc cannot create the arrays. Maple is trying to "simply" bottom up rather than top down and craps out.

 

It really has nothing to do with the sequence though but that the input that ultimately gets to the proc involves a negative index. Even though I've attempted to prevent that every possible way such as max(0,j)... even though j is negative higher up in the evaluation maple insists in not clamping it first.

f(max(0,j-1))

 

f cannot deal with negative indicides(even though I also have an if j < 0 then return 0; fi; in the proc)

 

Maple is trying to do some magic annd failing. I've ran in to this problem before and I solved it, I thought, bu using ` ` around the function name... it does not work here.

 

It seems that maple tries to evaluate everything in the proc regardless of the actual inputs used or the if statements before the evaluation(unlike traditional programming which can be sequentially reasoned).

How to stop it from doing this nonsense and just give me what I want?

Error, (in f) out of bound assignment to a list

 

f := proc(i) local A; A := [3,4,5]; if i < 0 then return 0; fi; return A[i]; end;

 

f(-1) works

 

but when used in other things with a variable it fails.

 

 

 

Hi. I'm using the interactive plot builder. I click in add button in the expression section and then enter:

2x+y+2x-15=0

and click the accept button and I get an error message saying "Please enter a valid Maple expression". How am I supposed to enter the equation of the plane?

Thanks in advance!

restart:
with(PDEtools);
PDE :=  diff(y(x,t), t)-diff(y(x,t), x,x,t)-diff(y(x,t), x$2)+ diff(y(x,t), x)+y(x,t)*diff(y(x,t),x)=exp(-t)*(cos(x)-sin(x)+1/2*exp(-t)*sin(2*x));

# Initial/boundary conditions 
  BCs:=y(0,t) = 0, y(Pi,t)=0;
  ICs:=y(x,0) =sin(x) ;

pdsolve(PDE, {BCs,ICs});
exact_solution:=exp(-t)*sin(x);
Test1:=pdetest(exact_solution,[PDE, BCs,ICs]); 

The solution of the PDE is exp(-t)*sin(x).

I want to check whether it is right or not by Maple. 

I wrote the code. You can download the code.mw  

But, the code doesn' t work. What is the problem?

Thanks.

 

  1. The member() function doesn't find the value in a table if that value is associated with the key (aka index)  '0'
  2. Doesn't seem to matter if the table is created explicitly (ie by calling table()) or implicitly (ie by simple indexed assignment)
  3. member() doesn't seem to have the same issue with a zero-based Array()
  4. I'm pretty sure that this is a bug, but I'd like some opinions before I report it
  5. This behaviour has been around for a while: same thing happens all the way back to Maple 18. (I can't check anything earlier)

Check the ouput of member(10,t1) in the attached

  restart:

  interface(version);

`Standard Worksheet Interface, Maple 2019.1, Windows 7, May 21 2019 Build ID 1399874`

(1)

#
# Explicit table creation: same thing
# happens if table is created "implicitly"
#
  t1:=table([0=10, 1=12]);
  member(10,t1);
  member(12,t1);

table( [( 0 ) = 10, ( 1 ) = 12 ] )

 

false

 

true

(2)

#
# Zero-based Array
#
  A:=Array(0..1, [10, 12]);
  member(10,A);
  member(12,A);

Array(%id = 18446744074528920750)

 

true

 

true

(3)

 

Download memberProp.mw

This is a solution to a PDE. I solved this by hand and got a much simpler solution. Maple solution is also correct but very complicated. They are both the same, as when I plot them  for different t values, they match. I am sure they are the same. 

How would one simplify Maple solution to the simpler one? Tried number of options to simplify, but can't get Maple to simplify it to the hand solution. Also tried different assumptions on t and x (real, positive etc..) nothing helps.

Maple 2019.1 on windows 10. Physics 436

restart;
pde := diff(u(x,t), t) +1/(x^2+4)*diff(u(x,t),x) =0:
ic:=u(x,0)=exp(x^3+12*x):
maple_sol:=rhs(pdsolve([pde,ic],u(x,t)));

exp(((1/2)*(4*x^3+48*x-12*t+4*(9*(-(1/3)*x^3-4*x+t)^2+256)^(1/2))^(1/3)-8/(4*x^3+48*x-12*t+4*(9*(-(1/3)*x^3-4*x+t)^2+256)^(1/2))^(1/3))*(((1/2)*(4*x^3+48*x-12*t+4*(9*(-(1/3)*x^3-4*x+t)^2+256)^(1/2))^(1/3)-8/(4*x^3+48*x-12*t+4*(9*(-(1/3)*x^3-4*x+t)^2+256)^(1/2))^(1/3))^2+12))

hand_sol:=exp(x^3 - 3*t + 12*x); #this is much simpler

exp(x^3-3*t+12*x)

simplify(maple_sol)

exp(3*((4*x^3+48*x-12*t+4*(x^6-6*t*x^3+24*x^4+9*t^2-72*t*x+144*x^2+256)^(1/2))^(1/3)-4)*((-(1/3)*x^3+t-4*x-(1/3)*(x^6-6*t*x^3+24*x^4+9*t^2-72*t*x+144*x^2+256)^(1/2))*(4*x^3+48*x-12*t+4*(x^6-6*t*x^3+24*x^4+9*t^2-72*t*x+144*x^2+256)^(1/2))^(1/3)-(4/3)*(4*x^3+48*x-12*t+4*(x^6-6*t*x^3+24*x^4+9*t^2-72*t*x+144*x^2+256)^(1/2))^(2/3)-64/3)*((4*x^3+48*x-12*t+4*(x^6-6*t*x^3+24*x^4+9*t^2-72*t*x+144*x^2+256)^(1/2))^(1/3)+4)/(-8*x^3+24*t-96*x-8*(x^6-6*t*x^3+24*x^4+9*t^2-72*t*x+144*x^2+256)^(1/2)))

plot([subs(t=0.1,maple_sol),subs(t=0.1,hand_sol)],x=-1..0.3)

plot([subs(t=5,maple_sol),subs(t=5,hand_sol)],x=-1..0.3)

 

 

Download how_to_simplify.mw

Recently I discovered you can get the wolfram language and Mathematica for free if you buy a Raspberry Pi. 

Will there be something similar with Maple?

I'm guessing since Mathematica has secured a contract with Raspberry Pi, that would exclude competitors, ie Maple

First 632 633 634 635 636 637 638 Last Page 634 of 2425