Maple 2018 Questions and Posts

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

I'd like to use Maple to make measurements on a map (Dealey Plaza). I can load an image in Sketcher and draw lines on it, but can't figure out how to access the lengths of those lines.

restart``

estart; with(Physics); with(LinearAlgebra); with(VectorCalculus); with(Optimization); with(Statistics); with(ArrayTools); with(plottools); with(plots); with(Threads); with(MmaTranslator[Mma]), with(StringTools); with(CodeGeneration); VectorCalculus:-`*`(Setup(mathematicalnotation = true), Setup(coordinatesystems = cartesian))

estart

 

[annulus, arc, arrow, circle, cone, cuboid, curve, cutin, cutout, cylinder, disk, dodecahedron, ellipse, ellipticArc, exportplot, extrude, getdata, hemisphere, hexahedron, homothety, hyperbola, icosahedron, importplot, line, octahedron, parallelepiped, pieslice, point, polygon, prism, project, rectangle, reflect, rotate, scale, sector, semitorus, sphere, stellate, tetrahedron, torus, transform, translate]

 

`Default differentiation variables for d_, D_ and dAlembertian are:`*{X = (x, y, z, t)}

 

`Systems of spacetime Coordinates are:`*{X = (x, y, z, t)}

(1)

``

``

NULL

 

``

``

Download DealeyPlazaToo.mw

Hi,
I have a function (see attached file).  How can I find by Maple 
those values of beta and f for which W will have 
three consecutive local extrema between the
phi=0 and phi_0 where W=dW/dphi=0 at phi=0 and W=0 at phi_0 and W<0 for 0<abs(phi)<phi_0?
Thanks,
plot.mw

Using Maple-18 on Window 11...

I have a set of curves in a Maple 'vector.' I want to plot them all on the same figure, but if call 'display' with the vector it makes separate plots for each one. I have to all it with each plot individual to get them on the same plot:

lc is a 'vector' of curves (I use 'vector' because I want to append and that doesn't work for 'list')

display(lc) -- plots a separate plot for each element of lc

display(lc[1], lc[2], lc[3],...) puts them all on one plot as needed, but as there will be a large numbe of curvesr it's extremely tedious.

It is a Huygens principle based simulation of diffraction.

restart

estart; with(Physics); with(LinearAlgebra); with(VectorCalculus); with(Optimization); with(Statistics); with(ArrayTools); with(plots); with(plottools); with(Threads); with(MmaTranslator[Mma]), with(StringTools); with(CodeGeneration); with(ImageTools); with(ImageTools:-Draw); VectorCalculus:-`*`(Setup(mathematicalnotation = true), Setup(coordinatesystems = cartesian))

estart

 

[annulus, arc, arrow, circle, cone, cuboid, curve, cutin, cutout, cylinder, disk, dodecahedron, ellipse, ellipticArc, exportplot, extrude, getdata, hemisphere, hexahedron, homothety, hyperbola, icosahedron, importplot, line, octahedron, parallelepiped, pieslice, point, polygon, prism, project, rectangle, reflect, rotate, scale, sector, semitorus, sphere, stellate, tetrahedron, torus, transform, translate]

 

`Default differentiation variables for d_, D_ and dAlembertian are:`*{X = (x, y, z, t)}

 

`Systems of spacetime Coordinates are:`*{X = (x, y, z, t)}

(1)

NULL

NULL

 

radius := 1.0

1.0

(2)

NULL

NULL

``

NULL

alpha := sin((1/4)*Pi)

(1/2)*2^(1/2)

(3)

step := .2

.2

(4)

radius := 100.0

100.0

(5)

l1 := line([0, 0], [100, 100])

CURVES([[0., 0.], [100., 100.]])

(6)

loAng := 0.

0.

(7)

hiAng := (1/2)*Pi

(1/2)*Pi

(8)

c1 := arc([0, 0.], radius, loAng .. Pi, color = "red")

c2 := arc([step, 0.], -alpha*step+radius, loAng .. hiAng, color = "blue")

c3 := arc([2*step, 0.], -2*alpha*step+radius, loAng .. Pi, color = "purple")

c4 := arc([3*step, 0.], -3*alpha*step+radius, loAng .. Pi, color = "black")

plots[display](l1, c1, c2, c3, c4, view = [0. .. radius, 0 .. radius])

 

`cir&Assign;arc`([x, 0.], radius-step, loAng .. hiAng, i, color = "red")

`cir&Assign;arc`([x, 0.], 99.8, 0. .. (1/2)*Pi, i, color = "red")

(9)

``

xLimitWall := 500.0; nScatter := 20; step := xLimitWall/(nScatter+1); x := 0.; for i from 0 to nScatter do x := x+step; cir := arc([x, 0.], radius-step, 0 .. Pi, color = "red"); if i = 0 then lc := Vector([cir]) else i; cir; Append(lc, cir) end if end do; lc

xLimitWall := 500.0

 

nScatter := 20

 

step := 23.80952381

 

x := 0.

 

x := 23.80952381

 

cir := CURVES(Vector(4, {(1) = ` 200 x 2 `*Matrix, (2) = `Data Type: `*float[8], (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order}), COLOUR(RGB, 1.00000000, 0., 0.))

 

x := 47.61904762

 

cir := CURVES(Vector(4, {(1) = ` 200 x 2 `*Matrix, (2) = `Data Type: `*float[8], (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order}), COLOUR(RGB, 1.00000000, 0., 0.))

 

x := 71.42857143

 

cir := CURVES(Vector(4, {(1) = ` 200 x 2 `*Matrix, (2) = `Data Type: `*float[8], (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order}), COLOUR(RGB, 1.00000000, 0., 0.))

 

x := 95.23809524

 

cir := CURVES(Vector(4, {(1) = ` 200 x 2 `*Matrix, (2) = `Data Type: `*float[8], (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order}), COLOUR(RGB, 1.00000000, 0., 0.))

 

x := 119.0476190

 

cir := CURVES(Vector(4, {(1) = ` 200 x 2 `*Matrix, (2) = `Data Type: `*float[8], (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order}), COLOUR(RGB, 1.00000000, 0., 0.))

 

x := 142.8571428

 

cir := CURVES(Vector(4, {(1) = ` 200 x 2 `*Matrix, (2) = `Data Type: `*float[8], (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order}), COLOUR(RGB, 1.00000000, 0., 0.))

 

x := 166.6666666

 

cir := CURVES(Vector(4, {(1) = ` 200 x 2 `*Matrix, (2) = `Data Type: `*float[8], (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order}), COLOUR(RGB, 1.00000000, 0., 0.))

 

x := 190.4761904

 

cir := CURVES(Vector(4, {(1) = ` 200 x 2 `*Matrix, (2) = `Data Type: `*float[8], (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order}), COLOUR(RGB, 1.00000000, 0., 0.))

 

x := 214.2857142

 

cir := CURVES(Vector(4, {(1) = ` 200 x 2 `*Matrix, (2) = `Data Type: `*float[8], (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order}), COLOUR(RGB, 1.00000000, 0., 0.))

 

x := 238.0952380

 

cir := CURVES(Vector(4, {(1) = ` 200 x 2 `*Matrix, (2) = `Data Type: `*float[8], (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order}), COLOUR(RGB, 1.00000000, 0., 0.))

 

x := 261.9047618

 

cir := CURVES(Vector(4, {(1) = ` 200 x 2 `*Matrix, (2) = `Data Type: `*float[8], (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order}), COLOUR(RGB, 1.00000000, 0., 0.))

 

x := 285.7142856

 

cir := CURVES(Vector(4, {(1) = ` 200 x 2 `*Matrix, (2) = `Data Type: `*float[8], (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order}), COLOUR(RGB, 1.00000000, 0., 0.))

 

x := 309.5238094

 

cir := CURVES(Vector(4, {(1) = ` 200 x 2 `*Matrix, (2) = `Data Type: `*float[8], (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order}), COLOUR(RGB, 1.00000000, 0., 0.))

 

x := 333.3333332

 

cir := CURVES(Vector(4, {(1) = ` 200 x 2 `*Matrix, (2) = `Data Type: `*float[8], (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order}), COLOUR(RGB, 1.00000000, 0., 0.))

 

x := 357.1428570

 

cir := CURVES(Vector(4, {(1) = ` 200 x 2 `*Matrix, (2) = `Data Type: `*float[8], (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order}), COLOUR(RGB, 1.00000000, 0., 0.))

 

x := 380.9523808

 

cir := CURVES(Vector(4, {(1) = ` 200 x 2 `*Matrix, (2) = `Data Type: `*float[8], (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order}), COLOUR(RGB, 1.00000000, 0., 0.))

 

x := 404.7619046

 

cir := CURVES(Vector(4, {(1) = ` 200 x 2 `*Matrix, (2) = `Data Type: `*float[8], (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order}), COLOUR(RGB, 1.00000000, 0., 0.))

 

x := 428.5714284

 

cir := CURVES(Vector(4, {(1) = ` 200 x 2 `*Matrix, (2) = `Data Type: `*float[8], (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order}), COLOUR(RGB, 1.00000000, 0., 0.))

 

x := 452.3809522

 

cir := CURVES(Vector(4, {(1) = ` 200 x 2 `*Matrix, (2) = `Data Type: `*float[8], (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order}), COLOUR(RGB, 1.00000000, 0., 0.))

 

x := 476.1904760

 

cir := CURVES(Vector(4, {(1) = ` 200 x 2 `*Matrix, (2) = `Data Type: `*float[8], (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order}), COLOUR(RGB, 1.00000000, 0., 0.))

 

x := 499.9999998

 

cir := CURVES(Vector(4, {(1) = ` 200 x 2 `*Matrix, (2) = `Data Type: `*float[8], (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order}), COLOUR(RGB, 1.00000000, 0., 0.))

 

Vector[column](%id = 4400555778)

(10)

lc[1]

CURVES(Matrix(%id = 4400554242), COLOUR(RGB, 1.00000000, 0., 0.))

(11)

lc(2)

``

lc

lc[1]

``

Download JFKWEdgeDifractionDirection.mwJFKWEdgeDifractionDirection.mwen.

Hello, I would like to integrate a Maple sheet into a LaTeX sheet. How to do ? Thanks in advance.

I find that if if declare a variable in a procedure inside a if  statement it Maple things something is wrong with the if statement:

tSound=proc(xMic,yMic,zMic,xGun,yGun,zGun,mode)  

global vSound;  

local locMic:=Vector([xMic,yMix,zMix]);  

local locGun:=Vector([xGun,yGun,zGun]);   l

ocal delGunToMix;   if mode=1 then #`direct  `    

local x=0.0;    <==remove this sand fine

delGunToMix:=locMic-locGun;    

return vSound*Norm(delGunToMix);  

elif  mode=2 then #`reflect off wall at z=0`        

end if;   return 0.0;  end proc:


Error, invalid 'if' statement
==>I can delclare the variable 'local' outside the if. Why? It doesn't make much sense, though not that hard to avoid.

how to solve tis type of pdefirst_order_pde.mw

How to plot the second order derivative and first oder derivatives plot in time dependent pde and vector plot of  theta(y,t), u(y,t) at y=0..10 and t=0..1

nowhere i found a vector plot of time-dependent pde 

how to plot give me suggestions.

in vector plots, flow patterns should show with arrow marks

  restart;
  inf:=10:
  pdes:= diff(u(y,t),t)-xi*diff(u(y,t),y)=diff(u(y,t),y$2)/(1+lambda__t)+Gr*theta(y,t)+Gc*C(y,t)-M*u(y,t)-K*u(y,t),
         diff(theta(y,t),t)-xi*diff(theta(y,t),y)=1/Pr*diff(theta(y,t),y$2)+phi*theta(y,t),
         diff(C(y,t),t)-xi*diff(C(y,t),y)=1/Sc*diff(C(y,t),y$2)-delta*C(y,t)+nu*theta(y,t):
  conds:= u(y,0)=0, theta(y,0)=0, C(y,0)=0,
          u(0,t)=0, D[1](theta)(0,t)=-1, D[1](C)(0,t)=-1,
          u(inf,t)=0, theta(inf,t)=0, C(inf,t)=0:
  pars:= { Gr=1, Gc=1, M=1, nu=1, lambda__t=0.5,
           Sc=0.78, delta=0.1, phi=0.5, K=0.5, xi=0.5
         }        

{Gc = 1, Gr = 1, K = .5, M = 1, Sc = .78, delta = .1, nu = 1, phi = .5, xi = .5, lambda__t = .5}

(1)

  PrVals:=[0.71, 1.00, 3.00, 7.00]:
  colors:=[red, green, blue, black]:
  for j from 1 to numelems(PrVals) do
      pars1:=`union`( pars, {Pr=PrVals[j]}):
      pdSol:= pdsolve( eval([pdes], pars1),
                       eval([conds], pars1),
                       numeric
                     );
      plt[j]:=pdSol:-plot( diff(u(y,t),y), y=0, t=0..2, numpoints=200, color=colors[j]);
  od:
  plots:-display( [seq(plt[j], j=1..numelems(PrVals))]);

 

PrVals := [.71, 1.00, 3.00, 7.00]; colors := [red, green, blue, black]; for j to numelems(PrVals) do pars1 := `union`(pars, {Pr = PrVals[j]}); pdSol := pdsolve(eval([pdes], pars1), eval([conds], pars1), numeric); plt[j] := pdSol:-plot(diff(u(y, t), y, y), y = 0, t = 0 .. 2, numpoints = 200, color = colors[j]) end do; plots:-display([seq(plt[j], j = 1 .. numelems(PrVals))])

 
 

 

Download badPDE.mw

How do I set the axis range in a Maple scatter plot. It's not evident to me from the Help.

Please help me how to impliment to solve this problem 

Download dust_practice_code.mw

dust_paper.pdf

As my jobs are still crashing with memory leak, I'd like to write results out to files and read them back to add them together.

I see something called 'Export' and something called 'Import'. It didn't work for me. Does the file have to already exist? An example would be nic

Is there a simple 4-vector package available for Maple? Yes, I know about using Tensors, but don't want to fool with metrics and raising and lowering operators.

I have written my  own, but it seems buggy. I generate some vectors in in CM that should add up to a massless neutrino, but some times when I boost them to the 'lab' and do the addition there the neutrion acquires a substantial mass. It's not a merely numerical issue. It's weird because most of the time the neutrion mass is 0 or close to it.

My homemade boost proc 'boostTo' is attached.

  I am unable to draw both 3d plots sowing error please help me to solve

restart:NULLNULL

p1 := 0.1e-1; p2 := 0.2e-1; p3 := 0.1e-1; Px := p1+p2+p3

rf := 1050; kf := .52; cpf := 3617; sigmaf := .8

sigma1 := 25000; rs1 := 5200; ks1 := 6; cps1 := 670

sigma2 := 59.7*10^6; rs2 := 8933; ks2 := 400; cps2 := 385

sigma3 := 2380000; rs3 := 4250; ks3 := 8.9538; cps3 := 686.2

NULL

B1 := 1+2.5*Px+6.2*Px^2; B2 := 1+13.5*Px+904.4*Px^2; B3 := 1+37.1*Px+612.6*Px^2; B4 := (ks1+2*kf-2*Px*(kf-ks1))/(ks1+2*kf+Px*(kf-ks1)); B5 := (ks2+3.9*kf-3.9*Px*(kf-ks2))/(ks2+3.9*kf+Px*(kf-ks2)); B6 := (ks3+4.7*kf-4.7*Px*(kf-ks3))/(ks3+4.7*kf+Px*(kf-ks3))

a2 := B1*p1+B2*p2+B3*p3

a1 := 1-p1-p2-p3+p1*rs1/rf+p2*rs2/rf+p3*rs3/rf

a3 := 1-p1-p2-p3+p1*rs1*cps1/(rf*cpf)+p2*rs2*cps2/(rf*cpf)+p3*rs3*cps3/(rf*cpf)

a4 := B4*p1+B5*p2+B6*p3

NULL

a5 := 1+3*((p1*sigma1+p2*sigma2+p3*sigma3)/sigmaf-p1-p2-p3)/(2+(p1*sigma1+p2*sigma2+p3*sigma3)/((p1+p2+p3)*sigmaf)-((p1*sigma1+p2*sigma2+p3*sigma3)/sigmaf-p1-p2-p3))

``

``



NULL

ODE:=[(a2+K)*(diff(U0(eta), eta, eta))/a1-Ra*(diff(U0(eta), eta))+lambda0/a1-a5*M1^2*U0(eta)/a1+K*(diff(N0(eta), eta))/a1+la*Ra*Theta0(eta)*(1+Qc*Theta0(eta)), (a2+K)*(diff(U1(eta), eta, eta))/a1-H^2*l1*U1(eta)-Ra*(diff(U1(eta), eta))+lambda1/a1-a5*M1^2*U1(eta)/a1+K*(diff(N1(eta), eta))/a1+la*Ra*(Theta1(eta))(1+2*Qc*Theta0(eta)), diff(N0(eta), eta, eta)-Ra*a1*Pj*(diff(N0(eta), eta))-2*n1*N0(eta)-n1*(diff(U0(eta), eta)), diff(N1(eta), eta, eta)-Ra*a1*Pj*(diff(N1(eta), eta))-2*n1*N1(eta)-n1*(diff(U1(eta), eta))-H^2*a1*Pj*l1*N1(eta), (a4/(a3*Pr)-delta*Ra^2/H^2+4*Rd*(1+(Tp-1)^3*Theta0(eta)^3+3*(Tp-1)^2*Theta0(eta)^2+(3*(Tp-1))*Theta0(eta))/(3*a3*Pr))*(diff(Theta0(eta), eta, eta))-Ra*(diff(Theta0(eta), eta))+a5*Ec*M1^2*U0(eta)^2/a3+(a2+K)*Ec*(diff(U0(eta), eta))^2/a1+Q*Theta0(eta)/a3+4*(diff(Theta0(eta), eta))^2*Rd*(3*(Tp-1)+6*(Tp-1)^2*Theta0(eta)+3*(Tp-1)^3*Theta0(eta)^2)/(3*a3*Pr), (a4/(a3*Pr)-delta*Ra^2/H^2+4*Rd*(1+(Tp-1)^3*Theta0(eta)^3+3*(Tp-1)^2*Theta0(eta)^2+(3*(Tp-1))*Theta0(eta))/(3*a3*Pr))*(diff(Theta1(eta), eta, eta))-(H^2*l1+2*Ra*delta*l1+Ra)*(diff(Theta1(eta), eta))+(Q/a3-delta*H^2*l1^2)*Theta1(eta)+2*(a2+K)*Ec*(diff(U0(eta), eta))*(diff(U1(eta), eta))/a1+2*a5*Ec*M^2*U0(eta)*U1(eta)/a3+4*(diff(Theta0(eta), eta, eta))*Theta1(eta)*Rd*(3*(Tp-1)+6*(Tp-1)^2*Theta0(eta)+3*(Tp-1)^3*Theta0(eta)^2)/(3*a3*Pr)+4*Rd*(diff(Theta0(eta), eta))^2*(6*(Tp-1)^2*Theta1(eta)+6*(Tp-1)^3*Theta0(eta)*Theta1(eta))/(3*a3*Pr)+4*Rd*(diff(Theta1(eta), eta))*(diff(Theta0(eta), eta))*(6*(Tp-1)+6*(Tp-1)^3*Theta0(eta)^2+12*(Tp-1)^2*Theta0(eta))/(3*a3*Pr)]:


(LB,UB):= (0,1):


BCs:= [
  
  U0(0) = 0, U1(0) = 0, N0(0) = 0, N1(0) = 0, Theta0(0) = 0, Theta1(0) = 0, U0(1) = 0, U1(1) = 0, N0(1) = 0, N1(1) = 0, Theta0(1) = 1, Theta1(1) = 0
]:

NULL


Params:= Record(
   
   M1=  1.2, Rd=0.8,la=0.8,n1=1.2,Q=0.2,Pj=0.001,Ra=0.8,Ec=1,    Pr= 21,   delta= 0.2,    t1= (1/4)*Pi, lambda0=2,lambda1=3,   Qc= 0.1,    l1= 1,K=0.4,H=3 ,deltat=0.05  ):
   

NBVs:= [   
 
a1**D(U0)(0) = `C*__f` , # Skin friction coefficient
 (a4+(4*Rd*(1/3))*(1+(Tp-1)*(Theta0(0)+0.1e-2*exp(l1*t1)*Theta1(0)))^3)*((D(Theta0))(0)+0.1e-2*exp(l1*t1)*(D(Theta1))(0)) = `Nu*`    # Nusselt number     
]:
Nu:= `Nu*`:
Cf:= `C*__f`:

 

Solve:= module()
local
   nbvs_rhs:= rhs~(:-NBVs), #just the names
   Sol, #numeric dsolve BVP solution of any 'output' form
   ModuleApply:= subs(
      _Sys= {:-ODEs[], :-BCs[], :-NBVs[]},
      proc({
          M1::realcons:=  Params:-M1,
         Pr::realcons:= Params:-Pr,
         Rd::realcons:= Params:-Rd,
         la::realcons:= Params:-la,
         Tp::realcons:= Params:-Tp,
         n1::realcons:= Params:-n1,
         Q::realcons:= Params:-Q,
         Pj::realcons:= Params:-Pj,
         Ra::realcons:= Params:-Ra,
         Ec::realcons:= Params:-Ec,
         t1::realcons:=  Params:-t1,
         delta::realcons:= Params:-delta,
         lambda0::realcons:= Params:-lambda0,
         lambda1::realcons:= Params:-lambda1,
         Qc::realcons:= Params:-Qc,
         K::realcons:= Params:-K,
         l1::realcons:= Params:-l1,
         H::realcons:= Params:-H
      })
         Sol:= dsolve(_Sys, _rest, numeric);
         AccumData(Sol, {_options});
         Sol
      end proc
   ),
   AccumData:= proc(
      Sol::{Matrix, procedure, list({name, function}= procedure)},
      params::set(name= realcons)
   )
   local n, nbvs;
      if Sol::Matrix then
         nbvs:= seq(n = Sol[2,1][1,Pos(n)], n= nbvs_rhs)
      else
         nbvs:= (nbvs_rhs =~ eval(nbvs_rhs, Sol(:-LB)))[]
      fi;
      SavedData[params]:= Record[packed](params[], nbvs)
   end proc,
   ModuleLoad:= eval(Init);
export
   SavedData, #table of Records
   Pos, #Matrix column indices of nbvs
   Init:= proc()
      Pos:= proc(n::name) option remember; local p; member(n, Sol[1,1], 'p'); p end proc;
      SavedData:= table();
      return
   end proc ;
   ModuleLoad()
end module:
 


 

 

#procedure that generates 3-D plots (dropped-shadow contour + surface) of an expression


ParamPlot3d:= proc(
   Z::{procedure, `module`}, #procedure that extracts z-value from Solve's dsolve solution
   X::name= range(realcons), #x-axis-parameter range
   Y::name= range(realcons), #y-axis-parameter range
   FP::list(name= realcons), #fixed values of other parameters
   {
      #fraction of empty space above and below plot (larger "below"
      #value improves view of dropped-shadow contourplot):
      zmargin::[realcons,realcons]:= [.05,0.15],
      eta::realcons:= :-LB, #independent variable value
      dsolveopts::list({name, name= anything}):= [],
      contouropts::list({name, name= anything}):= [],
      surfaceopts::list({name, name= anything}):=[]    
   }
)
local
   LX:= lhs(X), RX:= rhs(X), LY:= lhs(Y), RY:= rhs(Y),
   Zremember:= proc(x,y)
   option remember; #Used because 'grid' should be the same for both plots.
      Z(
         Solve(
            LX= x, LY= y, FP[],
            #Default dsolve options can be changed by setting 'dsolveopts':
            'abserr'= 0.5e-7, 'interpolant'= false, 'output'= Array([eta]),  
            dsolveopts[]
         )
      )
   end proc,
   plotspec:= (Zremember, RX, RY),
   C:= plots:-contourplot(
      plotspec,
      #These default plot options can be changed by setting 'contouropts':
      'grid'= [25,25], 'contours'= 5, 'filled',
      'coloring'= ['yellow', 'orange'], 'color'= 'green',
      contouropts[]
   ),
   P:= plot3d(
      plotspec,
      #These default plot options can be changed by setting 'surfaceopts':
      'grid'= [25,25], 'style'= 'surfacecontour', 'contours'= 6,
      surfaceopts[]
   ),
   U, L #z-axis endpoints after margin adjustment
;
   #Stretch z-axis to include margins:
   (U,L):= ((Um,Lm,M,m)-> (M*(Lm-1)+m*Um, M*Lm+m*(Um-1)) /~ (Um+Lm-1))(
      zmargin[],
      (max,min)(op(3, indets(P, 'specfunc'('GRID'))[])) #actual z-axis range
   );
   plots:-display(
      [
         plots:-spacecurve(
            {
               [[lhs(RX),rhs(RY),U],[rhs(RX),rhs(RY),U],[rhs(RX),rhs(RY),L]], #yz backwall
               [[rhs(RX),rhs(RY),U],[rhs(RX),lhs(RY),U],[rhs(RX),lhs(RY),L]]  #xz backwall
            },
            'color'= 'grey', 'thickness'= 0
         ),
         plottools:-transform((x,y)-> [x,y,L])(C), #dropped-shadow contours
         P
      ],
      #These default plot options can be changed simply by putting the option in the
      #ParamPlot3d call:
      'view'= ['DEFAULT', 'DEFAULT', L..U], 'orientation'= [-135, 75], 'axes'= 'frame',
      'labels'= [lhs(X), lhs(Y), Z], 'labelfont'= ['TIMES', 'BOLDOBLIQUE', 16],
      'caption'= nprintf(cat("%a = %4.2f, "$nops(FP)-1, "%a = %4.2f"), (lhs,rhs)~(FP)[]),
      'captionfont'= ['TIMES', 14],
      'projection'= 2/3,   
      _rest
   )
end proc:

NULL

NULL

GetNu := proc (Sol::Matrix) options operator, arrow; Sol[2, 1][1, Solve:-Pos(:-Nu)] end proc

ParamPlot3d(
   GetNu,Q= 0..5, Rd= 0..5, [
   
   Pr= 21   ],
   labels= [Q, gamma, Nu]
);

Error, (in plot/iplot2d/levelcurve) could not evaluate expression

 

``

Download P6_3D_plots.mw

HI,
I want to simplify an algebraic experssion. How do I do this with Maple?
A1.mw

I have been using 'MemoryInUse()' to try to track down a memory leak that is crashing my Maple-based simulation. The problematic proc seems to be ProbDStarLNu which calculates the probablity of decay as a function of the angles of the decay product. It gets called a lot in acceptance rejection decay generation.

'MemoryInUse()' slows it down a lot. It also seemed to give weird results to me. I calculate the mem used on entry and then after the 4 trig functions have been called. The amount of mem 'in use' goes down after the trig functions are called. I was suspecting they were the source of the leak, but they seem almost an anti-leak.

This weird behavior caused me to write my own mem counting proc ('memUsed') based on summing over the results of 'mem:= kernelopts(memusage)'.

It is much faster. It gives nearly but not quite the same numbers. It still goes "backward" when the trig functions are called. Most of the mem growth comes from the algebra that follows the trig.

Why would that be?

I have included code for 'ProbDStarLNu'. It's pretty simple.

1 2 3 4 5 6 7 Last Page 2 of 61