Maple 2020 Questions and Posts

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

I want to write a procedure for adding gridlines to 3dplots of any function f on ([x_min,x_max]x[y_min,y_max])

restart:
with(plots):
grids:=proc(f,x_min,x_max,y_min,y_max)
 local z_min,z_max,plot_f,xz,yz,xy;
uses plots;
z_min:=0:
z_max:=10:
plot_f:=plot3d(f,x=x_min..x_max,y=y_min..y_max);
xz:=plot3d([x,y_min,z],x=x_min..x_max,z=z_min..z_max,style=line,color=blue,thickness=0,grid=[6,6]);
yz:=plot3d([x_min,y,z],y=y_min..y_max,z=z_min..z_max,style=line,color=blue,thickness=0,grid=[4,6]);
xy:=plot3d([x,y,z_min],x=x_min..x_max,y=y_min..y_max,style=line,color=blue,thickness=0,grid=[4,4]);
return
display(plot_f,xz,yz,xy,lightmodel=none,tickmarks=[3,3,6],labels=[x,y,"f(x,y)"],labeldirections=[horizontal,horizontal,vertical],axes=frame);
end proc:

#EXAMPLE
f:=x^2-y:
x_min:=-1:
x_max:=3:
y_min:=-2:
y_max:=1:
grids(f,-1,3,-2,-1);

 

 

 

 

 

 

Some of the drawbacks of the above code are:

  1. The minimum value ( z_min ) and maximum value ( z_max ) of function f(x,y) can't be calculated automatically.
  2. grid=[6,6],grid=[4,6] etc. can't be calculated automatically. (it may be automatically calculated by considering the stepsize of axis x and axis y)

 

Hi,

I was hoping to run two procs: tgf3 and tgf4 in parallel using Grid, Run and get a faster execution time. As I understood the description of Grid Run, the first call to Grid Run will run in the background and before it is finished the second call Grid Run will start. I do not believe I have that situation in my script. I am not understanding Grid Run. How can this problem be fixed? Here is just a portion of the script using Grid Run:

Use Grid Run 0 for tgf3 and 1 for tgf4. Determine the real time and compare times. The Grid Runs do not appear to run in parallel.

rgt := time[real]();
Grid:-Run(0, `~`[tgf3@op](convert(L, listlist)), 'assignto' = ans3roots);
Grid:-Run(1, `~`[tgf4@op](convert(L, listlist)), 'assignto' = ans4roots);
ans3roots;
ans4roots;

GridRunTime := time[real]() - rgt;
                     GridRunTime := 44.074

Here is my script:

Grid_Run_2.mw

 

Thank you for your help.

 12 yeas later, the probelm  is not still improved in following links 

https://www.mapleprimes.com/posts/38473-Simplify-Ceil-And-Floor

simplify(ceil(x)+floor(-x));

                         floor(-x) + ceil(x)



I think extending simplify by Joe Riel 8221  is a little complicated. 

restart;
`simplify/ceil` := proc(ex)
    evalindets(ex, 'specfunc(anything,ceil)', x -> -floor(-op(x)));
end proc:

simplify(floor(-x) + ceil(x));

 It seems that maple know  ceil(x)=-floor(-x) 

 

why does not maple2020 still handle that?  

 

 

This worksheet contains images scanned from a book of problems.

Problem56.mw

Hi there,

 

I'm currently trying to work with combinations where I need to be able to retrieve a list of possible combinations, although i do not actually need to see the output but use it for a later part of programming.

Unfortunately, I get an error message such as the one in the title of this question. 

It seems to me that maple is unable to allocate enough memory to evaluate the problem. I'm not familiar with any way to refine the programming.

are there any possible workarounds for this issue?

 

 

This integral 

for n integer and n>=0

Maple finds it if I tell it this in the assumptions.  But if I remove the assumption that n>=0 and just keep the assumption that n is integer, it hangs. (at least I waited 5 minutes and gave up).

Is this something to be expected?  If I try the same thing in Mathematica, i.e. telling it n is an integer, but not that it is n>=0, it returns result  immediately, with condition that the result is valid for n>=0.

restart;
int(x^n*exp(-x),x=0..infinity) assuming n::integer

seems to hang.

In Mathematica:

My question is  if this behaviour of int hanging is to be expected, since it was not told than n>=0? Should it have returned result of n!  like Mathematica, with the assumption given in the result as well?

Since for n<0 the integral does not converge, and maple knows this

restart;
int(x^(-2)*exp(-x),x=0..infinity)

            infinity

May be this is just a design issue in int and it was stuck trying to evaluate the integral for negative integers, and could not determine if it converges or not?

Any thoughts?

Maple 2020.2

Hello everyone,

My question might be trivial for you but I really could not find any solution online. In an academic assignment, the load function acting on top of a beam contains dirac function and its derivatives. What I want is that the dirac function, Dirac(x-a1), is equal to 1 when x=a1, but all I get is Dirac(0.). 

I solved the same problem with Heaviside function with the NumericEventHandler but did not find anything about Dirac delta function.

My goal is to also plot this load function ("q" in my case) along a beam of 5 meters length. When I tried it looks like the dirac delta function are not considered at all.

restart:
with(plots):
NumericEventHandler(invalid_operation=`Heaviside/EventHandler`(value_at_zero=1/2)):
alias(delta=Dirac):
q:=3-0.2*x+varV1*delta(x-a1)+varV3*delta(x-a3)+EI2*varPhi2*delta(2,(x-a2))+EI2*varW2*delta(3,(x-a3));
            q := 3 - 0.2 x + varV1 delta(-x + a1) + varV3 delta(-x + a3)

   + EI2 varPhi2 delta(2, -x + a2) - EI2 varW2 delta(3, -x + a3)

a1:=1:a2:=3:a3:=2:
x:=a2:q;
                 2.4 + EI2 varPhi2 delta(2, 0)

x:='x':plot(q,x=0..5);
 

Thank you in advance.

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:

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]

 

 

 

 

 

 

 

 

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

I have created a set of help files using the example templates. After I create the .help file and install it with my package, I can view the help pages in the help viewer. However, when I click on any link within a help page, the target page opens as a worksheet in Maple. I understand this is because I created the hyperlink with a worksheet as the target. However, I don't know where to obtain the help topic name for a help page before it has been created.  I have searched help, but can't find any applicable guidance.  Can anyone tell me how to determine the help topic name when first creating the help pages.

I have attached one of my help file worksheets.     Hlpdiracmatrices.mw

Hello,

When I create a vector in spherical coordinates and map it to cartesian coordinates with Physics[Vectors] package as follows,

restart:with(Physics[Vectors]):
q_:=a _r + b _theta + c _phi
ChangeBasis(q_,cartesian)

I get the answer:

(a*cos(phi)*sin(theta)+b*cos(phi)*cos(theta)-c*sin(phi)) i + (a*sin(theta)*sin(phi)+b*cos(theta)*sin(phi)+c*cos(phi)) j + (-b*sin(theta)+a*cos(theta)) k

which is what I would expect.

But if I try to do that with VectorCalculus package as follows,

q := SetCoordinates(<a, b, c>, spherical)
MapToBasis(q, cartesian)

This gives 

(a*sin(b)*cos(c)) ex + (a*sin(b)*sin(c)) ey + (a*cos(b)) ez

I am confused about this!

The SetCoordinates(<a, b, c>, spherical) command outputs

q:=(a) er  + (b) ephi + (c) etheta

here, a,b, and c are  depicted as the components of the vector q in spherical coordinates, but when I map to cartesian coordinates, a,b, and c are treated as if they were the coordinates in spherical coordinates rather than components-- unlike ChangeBasis in Physics[Vectors] package.

Why are these two different?

For example, can a worksheet display a radius vector rotating through equally spaced points on a circle at a constantly reducing angular velocity?

Hello there, 

When I tried to use 'solve' command to solve an algebraic matrix equation, I got this error:

Would you please tell me the correct way to solve it?

eq6_3_sol := T__PhPh = solve(eq6_3_1, T__PhPh);
Error, invalid input: solve expects its 1st argument, eqs, to be of type {`and`, `not`, `or`, algebraic, relation(algebraic), ({list, set})({`and`, `not`, `or`, algebraic, relation(algebraic)})}, but received (Vector(3, {(1) = cos(omega__o*t), (2) = -cos(omega__o*t+(1/3)*Pi), (3) = -sin(omega__o*t+(1/6)*Pi)})) = T__PhPh . (Vector(3, {(1) = cos(omega__i*t), (2) = -cos(omega__i*t+(1/3)*Pi), (3) = -sin(omega__i*t+(1/6)*Pi)}))
 

The matrix equation I tried to solve is presented below:

(sorry for the duplication below, perhaps the Maple app which is supposed to display the content of the worksheet is not too happy with Microsoft Edge browser)

Download Q20210127.mw

 

First 17 18 19 20 21 22 23 Last Page 19 of 55