MaplePrimes Questions

If I do 

      Grid:-Run(0,foo,[n])

in worksheet, where foo is proc() defined in same worksheet before, which just prints something, but I do not see anything on the screen printed when running. It seems to run, since the Grid:-Wait() seems to take 1-2 second to finished, so I am sure the proc foo() was called. It is just the print output seem not to show.

When changing the above to

      Grid:-Run(0,foo,[n],'assignto'='ans0')

now I see the print on the screen but only when evaluating ans0. Actually the print does not show, had to evaluate ans0 to see the print string and also the return value.

In my code, I do not need to return anything, I just want to print to the screen. 

How to make the first one display on the screen? Is output from foo proc going somewhere else with Grid?

I made sure to use Grid:-Set(foo): to define foo for the grid as the help says to do. 

Here is worksheet which shows this problem. I simply want to use print inside foo and see the result on the screen when running foo on a node. 

Is this a bug?

restart;

interface(version);

`Standard Worksheet Interface, Maple 2024.2, Windows 10, October 29 2024 Build ID 1872373`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1843 and is the same as the version installed in this computer, created 2025, January 25, 22:5 hours Pacific Time.`

Why task running on node do not print anything?

 

restart;

foo:=proc(n)
   print("Entered foo, n=",n);    
end proc;

proc (n) print("Entered foo, n=", n) end proc

Grid:-Set(foo):
Grid:-Setup("local",numnodes=1); #just use one node
n:=1:
Grid:-Run(0,foo,[n]):
Grid:-Wait();

#nothing is printed from foo

 

To make it print, why assignto is needed?

 

restart;

foo:=proc(n)
   print("Entered foo, n=",n);    
   RETURN("done");
end proc;

proc (n) print("Entered foo, n=", n); RETURN("done") end proc

Grid:-Set(foo):
Grid:-Setup("local",numnodes=1);
n:=1:
Grid:-Run(0,foo,[n],'assignto'='ans0'):
Grid:-Wait();
ans0

"Entered foo, n=", 1

"done"

 

 

Download grid_question_jan_27_2025.mw

Update

I found why, but I do not understand why this fixes it. Removing numnodes =n  where n is number of nodes needed, now it works, i.e. proc prints on the screen ok as expected !

restart;

foo:=proc(n)
   print("Entered foo, n=",n);    
end proc;

proc (n) print("Entered foo, n=", n) end proc

Grid:-Set(foo):
Grid:-Setup("local"); # remove numnodes = ... , then it works. why??
n:=1:
Grid:-Run(0,foo,[n]):
Grid:-Wait();

"Entered foo, n=", 1

 

 

Download grid_question_jan_27_2025_V2.mw

But why? why is adding numnodes =1 or any other number makes it not print? Help says

So I do not see why adding this option makes it not print.

This has to be a bug, right? If not, then what is the logical explanation for this?

Dear all,

I'm a new maple user trying to solve a single PDE in maple using finite volume.

For simplicity I'm using three volumes. When I'm trying to apply a simple flux limiter, up-wind scheme, (relation between the wall and the node values u[j+0.5](t)=u[j](t)), I'm solver works well and produces accurate results.

However, when I try to a more complicated flux limiter, the solver doesn't initialize and I'm getting an error:
"Error, (in dsolve/numeric/DAE/make_proc) specified dependent variables [u[0](t), u[.5](t), u[1](t), u[1.5](t), u[2](t), u[2.5](t), u[3](t), u[3.5](t), u[4](t)] do not agree with input system {u[0], u[1], u[2], u[3], u[4], u[1/2], u[1.5], u[2.5], u[3.5]}, differences: {u[1/2]}, {u[.5]}".

I would greatly appreciate it if somebody helps me on in this issue.

error.mw

in a lot of my equation i have such problem and really i don't know how fix this also i try to put : in end and sometime is work and i keep contionues  but sometime not there is any way for solve this problem?

limit.mw

i don't know how generate this series and when i have a lot series which i can't make them automatically i don't know how write and replacing some structure like mu is zero or 1 as shown in picture can any one give me a hand?

both of them are same with little different

 

Let us suppose I open Maple, write a worksheet, save it in a folder A and then quit Maple.

Now I run a new session by double clicking on some mw file located in folder B, let us say //B/test_1.mw.
Once opened I do some modifications and decide to save this worksheet into a new file, let us say test_2.mw in the same folder B test_1.mw belongs to (which means I use Save As from the menu bar)

I'm regularly fooled by the fact that the default folder is not B, but the folder A I used in the previous session.

I find this very unpleasant.
Is this a Maple (2015) issue or something related to my operating system (Mac OSX Catalina)?
In case it is a Maple issue which is still present in more recent Maple versions, Would it be possible to set the default backup folder to be the folder to which the active worksheet belongs?

Thanks in advance

i need find parameter in explicite way without Rootof() so i need use code of explicite but i get error but when i use all parameter without explicite all parameter come out so why i get this error?

 
 

 

  (13)

vars := indets(eqs); ans := solve(eqs, {p, q, a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], k[1], k[2], k[3], m[1], m[2], m[3]}, explicit)

{p, q, a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], k[1], k[2], k[3], m[1], m[2], m[3]}

 

Error, (in Utilities:-RecognizeCyclotomic) numeric exception: division by zero

 
 

``

zero.mw

It's 2024 and this is still something that doesn't exist? I'd just like to swap the Enter/Shfit+Enter behaviors since I find myself writing a lot of multi-line and custom procs and boy howdy it'd be nice if I could make Maple behave at least the littllest bit like, I dunno, every other product I own and use.

i found solution of PDE but there is some different from my solution and paper solution so there is must be a mistake becuase he solved by maple too he mentioned in the paper i try to figure out but i can't see any mistake from my solution can anyone watch where i did mistake, i change some letter in finding parameter but they are same like p=k&h=A&n=p&w=n

here is paper solution 

parameter-different.mw

`How to calculate u = `((∂)/(∂ t) - (∂)/(∂ x))^(-1)(z)? 

restart;

with(PDEtools):

alias(z=z(x,y,t), u=u(x,y,t))

z, u

(1)

z := 32*delta2^3*(exp((2*a*y*delta2^3 + 2*(x + y + t)^3*(B1 + 2*B2)*delta2^2 + (2*a*delta1^2*y + t)*delta2 + 2*delta1^2*(x + y + t)^3*(B1 + 2*B2))/(delta1^2 + delta2^2)) - exp((-2*a*y*delta2^3 + 4*(B1 + B2/2)*(x + y + t)^3*delta2^2 + (-2*a*delta1^2*y - t)*delta2 + 4*delta1^2*(B1 + B2/2)*(x + y + t)^3)/(delta1^2 + delta2^2)))*a/((delta1^2 + delta2^2)^2*(exp((2*(delta1^2 + delta2^2)*(x + y + t)^3*B2 + 2*delta2*(a*(delta1^2 + delta2^2)*y + t/2))/(delta1^2 + delta2^2)) + exp((2*(delta1^2 + delta2^2)*(x + y + t)^3*B1 - 2*delta2*(a*(delta1^2 + delta2^2)*y + t/2))/(delta1^2 + delta2^2)))^3);

32*delta2^3*(exp((2*a*y*delta2^3+2*(x+y+t)^3*(B1+2*B2)*delta2^2+(2*a*delta1^2*y+t)*delta2+2*delta1^2*(x+y+t)^3*(B1+2*B2))/(delta1^2+delta2^2))-exp((-2*a*y*delta2^3+4*(B1+(1/2)*B2)*(x+y+t)^3*delta2^2+(-2*a*delta1^2*y-t)*delta2+4*delta1^2*(B1+(1/2)*B2)*(x+y+t)^3)/(delta1^2+delta2^2)))*a/((delta1^2+delta2^2)^2*(exp((2*(delta1^2+delta2^2)*(x+y+t)^3*B2+2*delta2*(a*(delta1^2+delta2^2)*y+(1/2)*t))/(delta1^2+delta2^2))+exp((2*(delta1^2+delta2^2)*(x+y+t)^3*B1-2*delta2*(a*(delta1^2+delta2^2)*y+(1/2)*t))/(delta1^2+delta2^2)))^3)

(2)

NULL

NULL

Download integ.mw

I was trying to look for an easy way to plot the locations of the distance and midpoint on a graph. I found how to get the distance and midpoint functions but plotting them is hard.

Thanks in advance.

 

with(Student:-Precalculus)

with(Plot)

a := [1, 3]

b := [5, 6]

Distance(a, b)

5

(1)

Midpoint(a, b)

[3, 9/2]

(2)

Line(a, b)

y = (3/4)*x+9/4, 3/4, 9/4, -3

(3)

Line(a, b, output = plot)

 
 

 

Download How-to-plot-distance-midpoint.mw

i want to plot density i try to use code of [interactive] but didn't give me density 

restart

_local(gamma)

Warning, A new binding for the name `gamma` has been created. The global instance of this name is still accessible using the :- prefix, :-`gamma`.  See ?protect for details.

 

NULL

sol3 := (2*(2*k[2]^2*p[2]^2/p[1]^2+2*k[2]^2))/((-x*k[2]*p[2]/p[1]+y*p[1])^2+(x*k[2]+y*p[2])^2+a[0])-2*(-(2*(-x*k[2]*p[2]/p[1]+y*p[1]))*k[2]*p[2]/p[1]+(2*(x*k[2]+y*p[2]))*k[2])^2/((-x*k[2]*p[2]/p[1]+y*p[1])^2+(x*k[2]+y*p[2])^2+a[0])^2

NULL

lprint(indets(sol3, name))

{x, y, a[0], k[2], p[1], p[2]}

 

P :=   [  a[0]=1.2, k[2]=0.8, p[1]=-0.8, p[2]=0.4]

[a[0] = 1.2, k[2] = .8, p[1] = -.8, p[2] = .4]

(1)

latex(P)

[a_{0} =  1.2, k_{2} =  0.8, p_{1} = - 0.8, p_{2} =  0.4]

 

NULL

Assume some functional form for U(xi)

 

insert numerical values

solnum :=subs(P, sol3);

3.200000000/((.4000000000*x-.8*y)^2+(.8*x+.4*y)^2+1.2)-5.120000000*x^2/((.4000000000*x-.8*y)^2+(.8*x+.4*y)^2+1.2)^2

(2)

CodeGeneration['Matlab']('3.200000000/((.4000000000*x-.8*y)^2+(.8*x+.4*y)^2+1.2)-5.120000000*x^2/((.4000000000*x-.8*y)^2+(.8*x+.4*y)^2+1.2)^2')

cg0 = 0.3200000000e1 / ((0.4000000000e0 * x - 0.8e0 * y) ^ 2 + (0.8e0 * x + 0.4e0 * y) ^ 2 + 0.12e1) - 0.5120000000e1 * x ^ 2 / ((0.4000000000e0 * x - 0.8e0 * y) ^ 2 + (0.8e0 * x + 0.4e0 * y) ^ 2 + 0.12e1) ^ 2;

 

 

P := Array(1 .. 3); P[1] := plot3d(map(Re, solnum), x = -20 .. 20, y = -5 .. 5, title = Re); P[2] := plot3d(map(Im, solnum), x = -20 .. 20, y = -5 .. 5, title = Im); P[3] := plot3d(map(abs, solnum), x = -20 .. 20, y = -5 .. 5, title = abs); plots:-display(P)

 

 

 

 

 

 

``

 

 

Q := Array(1 .. 2); Q[1] := plot3d(map(density, solnum), x = -20 .. 20, y = -5 .. 5, title = den); Q[2] := plot3d(map(contour, solnum), x = -20 .. 20, y = -5 .. 5, title = contour); plots:-display(Q)

Warning, expecting only range variables [x, y] in expression density(3.200000000/((.4000000000*x-.8*y)^2+(.8*x+.4*y)^2+1.2))+density(-5.120000000*x^2/((.4000000000*x-.8*y)^2+(.8*x+.4*y)^2+1.2)^2) to be plotted but found name density

 

Warning, expecting only range variables [x, y] in expression contour(3.200000000/((.4000000000*x-.8*y)^2+(.8*x+.4*y)^2+1.2))+contour(-5.120000000*x^2/((.4000000000*x-.8*y)^2+(.8*x+.4*y)^2+1.2)^2) to be plotted but found name contour

 

 

 

 

 

 

 

 

Download graph-density-countour.mw

I am looking for a command that generates a rotation matrix with Euler angles.

Ideally a command that allows to specify the sequence of rotations about x,y,z axes and the corresponding angles.

The only command I found is ?Student,LinearAlgebra,RotationMatrix which only rotates about one axis.

Anything else that Maple offers in this context? (searching with the search term "Euler" is hopeless -> too many hits.)

I'm calcuating an endomorphism in 2d dimensions. It is contructed out of a tensor contraction, for example, in 6-dimensions, the endomorphism is

K[mu,~nu] = LeviCivita[~alpha,~beta,~gamma,~delta,~upsilon,~nu]*C[alpha,beta,gamma]*C[delta,upsilon,mu]

I appreciate that, in terms of computation, this gets big quickly: it's something like O(exp) in time to sum over repeated indices in each matrix entry. Therefore, I thought, instead of putting the above expression in Define, I could make a matrix with unsummed entries, and then do the sums in parallel using Threads[Map](SumOverRepeatedIndices,...) but looking at my CPU usage and comparing execution times, it doesn't appear that this is working.

Is there any way I can more efficiently calculate these matrix entries?

This isn't the first time that I've seen a question that doesn't seem to have received a comment or answer, but which, when I click on the question title, turns out to have received one.
Here's the opposite phenomenon: a question appears to have two comments or answers, but none of them exist (9:38 GMT+1)

Screen capture from the main page

Screen capture from the question page

restart

with(PDEtools)

with(LinearAlgebra)

NULL

with(SolveTools)

undeclare(prime)

`There is no more prime differentiation variable; all derivatives will be displayed as indexed functions`

(1)

declare(u(x, t))

u(x, t)*`will now be displayed as`*u

(2)

declare(f(x, t))

f(x, t)*`will now be displayed as`*f

(3)

pde := diff(u(x, t), `$`(x, 3))+6*u(x, t)*(diff(u(x, t), x))+diff(u(x, t), t) = 0

diff(diff(diff(u(x, t), x), x), x)+6*u(x, t)*(diff(u(x, t), x))+diff(u(x, t), t) = 0

(4)

map(int, diff(diff(diff(u(x, t), x), x), x)+6*u(x, t)*(diff(u(x, t), x))+diff(u(x, t), t) = 0, x)

3*u(x, t)^2+diff(diff(u(x, t), x), x)+int(diff(u(x, t), t), x) = 0

(5)

pde1 := %

3*u(x, t)^2+diff(diff(u(x, t), x), x)+int(diff(u(x, t), t), x) = 0

(6)

Y := u(x, t) = 2*(diff(ln(f(x, t)), `$`(x, 2)))

u(x, t) = 2*(diff(diff(f(x, t), x), x))/f(x, t)-2*(diff(f(x, t), x))^2/f(x, t)^2

(7)

L := eval(pde1, Y)

3*(2*(diff(diff(f(x, t), x), x))/f(x, t)-2*(diff(f(x, t), x))^2/f(x, t)^2)^2+2*(diff(diff(diff(diff(f(x, t), x), x), x), x))/f(x, t)-8*(diff(diff(diff(f(x, t), x), x), x))*(diff(f(x, t), x))/f(x, t)^2+24*(diff(diff(f(x, t), x), x))*(diff(f(x, t), x))^2/f(x, t)^3-6*(diff(diff(f(x, t), x), x))^2/f(x, t)^2-12*(diff(f(x, t), x))^4/f(x, t)^4-2*(diff(f(x, t), x))*(diff(f(x, t), t))/f(x, t)^2+2*(diff(diff(f(x, t), t), x))/f(x, t) = 0

(8)

numer(lhs(3*(2*(diff(diff(f(x, t), x), x))/f(x, t)-2*(diff(f(x, t), x))^2/f(x, t)^2)^2+2*(diff(diff(diff(diff(f(x, t), x), x), x), x))/f(x, t)-8*(diff(diff(diff(f(x, t), x), x), x))*(diff(f(x, t), x))/f(x, t)^2+24*(diff(diff(f(x, t), x), x))*(diff(f(x, t), x))^2/f(x, t)^3-6*(diff(diff(f(x, t), x), x))^2/f(x, t)^2-12*(diff(f(x, t), x))^4/f(x, t)^4-2*(diff(f(x, t), x))*(diff(f(x, t), t))/f(x, t)^2+2*(diff(diff(f(x, t), t), x))/f(x, t) = 0))*denom(rhs(3*(2*(diff(diff(f(x, t), x), x))/f(x, t)-2*(diff(f(x, t), x))^2/f(x, t)^2)^2+2*(diff(diff(diff(diff(f(x, t), x), x), x), x))/f(x, t)-8*(diff(diff(diff(f(x, t), x), x), x))*(diff(f(x, t), x))/f(x, t)^2+24*(diff(diff(f(x, t), x), x))*(diff(f(x, t), x))^2/f(x, t)^3-6*(diff(diff(f(x, t), x), x))^2/f(x, t)^2-12*(diff(f(x, t), x))^4/f(x, t)^4-2*(diff(f(x, t), x))*(diff(f(x, t), t))/f(x, t)^2+2*(diff(diff(f(x, t), t), x))/f(x, t) = 0)) = numer(rhs(3*(2*(diff(diff(f(x, t), x), x))/f(x, t)-2*(diff(f(x, t), x))^2/f(x, t)^2)^2+2*(diff(diff(diff(diff(f(x, t), x), x), x), x))/f(x, t)-8*(diff(diff(diff(f(x, t), x), x), x))*(diff(f(x, t), x))/f(x, t)^2+24*(diff(diff(f(x, t), x), x))*(diff(f(x, t), x))^2/f(x, t)^3-6*(diff(diff(f(x, t), x), x))^2/f(x, t)^2-12*(diff(f(x, t), x))^4/f(x, t)^4-2*(diff(f(x, t), x))*(diff(f(x, t), t))/f(x, t)^2+2*(diff(diff(f(x, t), t), x))/f(x, t) = 0))*denom(lhs(3*(2*(diff(diff(f(x, t), x), x))/f(x, t)-2*(diff(f(x, t), x))^2/f(x, t)^2)^2+2*(diff(diff(diff(diff(f(x, t), x), x), x), x))/f(x, t)-8*(diff(diff(diff(f(x, t), x), x), x))*(diff(f(x, t), x))/f(x, t)^2+24*(diff(diff(f(x, t), x), x))*(diff(f(x, t), x))^2/f(x, t)^3-6*(diff(diff(f(x, t), x), x))^2/f(x, t)^2-12*(diff(f(x, t), x))^4/f(x, t)^4-2*(diff(f(x, t), x))*(diff(f(x, t), t))/f(x, t)^2+2*(diff(diff(f(x, t), t), x))/f(x, t) = 0))

2*f(x, t)^2*(3*(diff(diff(f(x, t), x), x))^2+f(x, t)*(diff(diff(diff(diff(f(x, t), x), x), x), x))+f(x, t)*(diff(diff(f(x, t), t), x))-4*(diff(diff(diff(f(x, t), x), x), x))*(diff(f(x, t), x))-(diff(f(x, t), x))*(diff(f(x, t), t))) = 0

(9)

PP := simplify(2*f(x, t)^2*(3*(diff(diff(f(x, t), x), x))^2+f(x, t)*(diff(diff(diff(diff(f(x, t), x), x), x), x))+f(x, t)*(diff(diff(f(x, t), t), x))-4*(diff(diff(diff(f(x, t), x), x), x))*(diff(f(x, t), x))-(diff(f(x, t), x))*(diff(f(x, t), t))) = 0)

2*f(x, t)^2*(3*(diff(diff(f(x, t), x), x))^2+f(x, t)*(diff(diff(diff(diff(f(x, t), x), x), x), x))+f(x, t)*(diff(diff(f(x, t), t), x))-4*(diff(diff(diff(f(x, t), x), x), x))*(diff(f(x, t), x))-(diff(f(x, t), x))*(diff(f(x, t), t))) = 0

(10)

%/(2*f(x, t)^2)

3*(diff(diff(f(x, t), x), x))^2+f(x, t)*(diff(diff(diff(diff(f(x, t), x), x), x), x))+f(x, t)*(diff(diff(f(x, t), t), x))-4*(diff(diff(diff(f(x, t), x), x), x))*(diff(f(x, t), x))-(diff(f(x, t), x))*(diff(f(x, t), t)) = 0

(11)

collect(%, f)

(diff(diff(diff(diff(f(x, t), x), x), x), x)+diff(diff(f(x, t), t), x))*f(x, t)+3*(diff(diff(f(x, t), x), x))^2-4*(diff(diff(diff(f(x, t), x), x), x))*(diff(f(x, t), x))-(diff(f(x, t), x))*(diff(f(x, t), t)) = 0

(12)

pde2 := %

(diff(diff(diff(diff(f(x, t), x), x), x), x)+diff(diff(f(x, t), t), x))*f(x, t)+3*(diff(diff(f(x, t), x), x))^2-4*(diff(diff(diff(f(x, t), x), x), x))*(diff(f(x, t), x))-(diff(f(x, t), x))*(diff(f(x, t), t)) = 0

(13)

NULL

T := f(x, t) = g(x, t)^2+h(x, t)^2+a[0]

T1 := g(x, t) = t*n[1]+x*k[1]

T2 := h(x, t) = t*n[2]+x*k[2]

L2 := subs({T1, T2}, T)

f(x, t) = (t*n[1]+x*k[1])^2+(t*n[2]+x*k[2])^2+a[0]

(14)

L3 := eval(pde2, L2)

(2*k[1]*n[1]+2*k[2]*n[2])*((t*n[1]+x*k[1])^2+(t*n[2]+x*k[2])^2+a[0])+3*(2*k[1]^2+2*k[2]^2)^2-(2*(t*n[1]+x*k[1])*k[1]+2*(t*n[2]+x*k[2])*k[2])*(2*(t*n[1]+x*k[1])*n[1]+2*(t*n[2]+x*k[2])*n[2]) = 0

(15)

L4 := collect(L3, [x, t], 'distributed')

((2*k[1]*n[1]+2*k[2]*n[2])*(k[1]^2+k[2]^2)-(2*k[1]^2+2*k[2]^2)*(2*k[1]*n[1]+2*k[2]*n[2]))*x^2-(2*k[1]^2+2*k[2]^2)*(2*n[1]^2+2*n[2]^2)*x*t+((2*k[1]*n[1]+2*k[2]*n[2])*(n[1]^2+n[2]^2)-(2*k[1]*n[1]+2*k[2]*n[2])*(2*n[1]^2+2*n[2]^2))*t^2+(2*k[1]*n[1]+2*k[2]*n[2])*a[0]+3*(2*k[1]^2+2*k[2]^2)^2 = 0

(16)

eqs := {coeffs(L4, [x, t])}

Error, invalid arguments to coeffs

 

NULL

NULL

ans := solve(eqs, vars)

{a[2] = a[2], a[3] = a[3], a[4] = 0, a[5] = a[5], a[7] = a[7]}

(17)

NULL

eqI := ans

{a[2] = a[2], a[3] = a[3], a[4] = 0, a[5] = a[5], a[7] = a[7]}

(18)

eqpsi := eval(L2, eqI)

f(x, t) = (t*a[2]+a[3])^2+a[5]^2*t^2+a[7]

(19)

eqphi := eval(Y, eqpsi)

w(x, t) = 0

(20)

simplify(eval(pde, eqphi))

 

NULL

Download F-params.mw

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