acer

32602 Reputation

29 Badges

20 years, 42 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

r := 1.9;
                            r := 1.9
i := trunc(r);
                             i := 1

First of all, you don't tell us anything about the qualitative nature of the plot you are expecting, or what specifically you object to above the plot originally produced. (The thing you wrote about "two arguments" makes no literal sense.)

We can of course guess that you object to the sign flip between the discontinuities. But tell us precisely.

Next, while it may not be the cause of your issues, it looks like a really bad idea to apply evalf all over the place, and have those float exponents. Do you understand that when there are branch-cut issues -- around say rational multiples of Pi -- turning exact values into floating-point representations can be trouble. If the float rounds just above..., or just below..., the behavior can change.

So, I am guessing that the combine(zeta_c, symbolic) might resolve your issue. (But, really, you're the one who supplied the various exp calls in the first place, without explanation or source...)

Here's one version with floats, and one without. Is this the plot you expected? Or perhaps as likely, its negation?

Toya_complexPlot2_ac.mw

Toya_complexPlot2_ac_exact.mw

I no longer believe in coincidences.

Working on another question here -- right now -- I stumbled across the same phenomenon.

The problem is the gridlines option, which your .mapleinit sets to true in a call to plots:-setoptions.

If I include that gridlines setting, then the GUI goes bonkers in the way described when I try to use plottools:-transform to raise a 2D plot up to 3D. (I have to use the menubar's Edit->Remove Output From Worksheet, then Save As another filename, then File->Close, then re-open, etc, to recover.

But if I exclude that setting then it goes OK.

I found this out, on the side, because I now habitually use plots:-setoptions to set gridlines=false so that the ancient Mapleprimes backend MapleNet engine doesn't render my inlined worksheet's 2D plots with ugly gridlines.

And then when I tried to transform a 2D plot to 3D I saw the same GUI crash, in Maple 2018.1 on 64bit Linux.

One might guess that setting gridlines=false wouldn't do anything concrete, since the default in the Maple GUI is not to show gridlines when no option for it is supplied. But in recent versions of Maple it actually puts a _GRIDLINES substructure within the PLOT structure of a 2D plot.

Anyway, the problem seems to happen whether the 2D plot is constructed with gridlines=true or gridlines=false.

Anyway, either the plottools:-transform command doesn't handle the GRIDLINES substructure properly when converting from PLOT to PLOT3D, or the GUI is mis-handling what it gets. Probably the former, where plottools is now failing to strip it out, since 3D plots don't really support gridlines. I will submit a bug report.

If you wish to retain your use of the gridlines option within the setoptions call, you could work around the issue by stripping out the _GRIDLINES structure.

restart;

plots[setoptions](axes=boxed,gridlines=true,symbol=solidcircle,symbolsize=20,\
font=[Palatino,Roman,18],labeldirections=[default,vertical]):

XX := [0.972801894435012e-2, 0.291840568330504e-1, 0.486400947217506e-1, 0.680961326104508e-1, 0.875521704991511e-1, .107008208387851, .126464246276552, .145920284165252, .165376322053952, .184832359942652, .204288397831353, .223744435720053, .243200473608753, .262656511497453, .282112549386153, .301568587274854, .321024625163554, .340480663052254, .359936700940954, .379392738829655, .398848776718355, .418304814607055, .437760852495755, .457216890384456, .476672928273156, .496128966161856, .515585004050556, .535041041939257, .554497079827957, .573953117716657, .593409155605357, .612865193494058, .632321231382758, .651777269271458, .671233307160158, .690689345048859, .710145382937559, .729601420826259, .749057458714959, .768513496603660, .787969534492360, .807425572381060, .826881610269760, .846337648158460, .865793686047161, .885249723935861, .904705761824561, .924161799713261, .943617837601962, .963073875490662]:

YY := [0., 0., 0.780705528028337e-4, -0.211866241843197e-3, -0.184081483518222e-3, -5.92871649289528*10^(-7), 0.705340540980509e-4, -0.461174040475175e-4, 6.08388233646549*10^(-6), -8.17545249012504*10^(-6), 0.784067792614267e-4, 0.948234032955701e-4, 0.129200206984893e-3, 0.217379985100455e-3, 0.117812477986346e-3, 0.740892827191450e-4, 0.713995793942092e-4, 0.883487018223552e-4, 0.114636346351373e-3, 0.126761621156635e-3, 0.249346062938405e-3, 0.353610442001781e-3, 0.389331161267054e-3, 0.285297377949754e-3, 0.206965990122876e-3, 0.198776365299836e-3, 0.274456081855498e-3, 0.150247195410351e-3, 0.373870077694107e-3, 0.389541749965941e-3, 0.195404380104158e-3, 0.496058769010207e-4, 0.143186561641884e-3, 0.495342494399980e-4, 0.284041858195664e-3, 0.218772341089506e-3, 0.871267097462542e-4, 0.140083271975313e-3, 0.278100169819868e-3, 0.492898546422542e-4, 0.528148364100161e-4, 0.336946605866647e-3, 0.144331022273297e-3, 0.213563703188388e-3, 0.533896184036048e-4, -0.297228533778489e-4, 0.551702396397926e-4, 0.192723516977434e-3, -0.351998902998264e-4, -0.979722172527731e-2]:

plt:=plot(XX,YY,view=[default,0..0.003]);

tr:=plottools:-transform((x,y) -> [x,2,y]):

temp := subsindets(plt, 'specfunc(anything,_GRIDLINES)', ()->NULL):
plots:-display(tr(temp));

 

Download display3d_subs.mw

Try the command ListDirectory from the FileTools package.

Your main problem was that you were calling your procedure UP with GAMMA as the argument instead of the typeset GAMMA-with-an-overbar.

In order to use Grid:-Seq here you also need to tell the kernel to pass along the definitions of `index/xxx` and RrProc. For that you can use the Grid:-Set command. And also, pass Rr into UP.

I changed the unprotect(GAMMA) to local GAMMA as a top-level declaration. You don't anything like that for the typeset GAMMA-with-an-overbar.

Now the Grid:-Seq runs twice as fast as seq on the two UP calls, on my quad-core 64bit Linux machine under Maple 2017.2. I change M=5 to M=12, to make it take a little longer.

What matters is the real time, which is wall-clock time.

[edited] If I set M=100 to make it long enough to examine the timings better, it takes 33sec with Grid:-Seq and 66sec with serial seq. And the answers are the same. Under serial seq my Linux machine's load showed at 100% (one mserver process), while under Grid:-seq it showed at 200% (across two mserver processes). 

[edited] Your mileage here may vary with OS and Maple version, but this exercise leaves my OS running multiple defunct or orphaned mserver processes (taking no load, phew!), even when the GUI is completely quit. I have to kill them manually.

``

restart

kernelopts(version)

`Maple 2017.2, X86 64 LINUX, Jul 19 2017, Build ID 1247392`

II := 2

2

JJ := 2

2

N := 2

_local(GAMMA)

q := max(II+1, JJ+1)

M := 12

seq(seq(seq(assign(GAMMA[i, j, r], a*`#mover(mi("Γ",fontstyle = "normal"),mo("&uminus0;"))`[i, j, r]), i = 0 .. q), j = 0 .. q), r = 1 .. N)

a := .2; b := 2; with(ArrayTools)

RrProc := proc (i, m) local K, j, Q; if i <= m then 0 else K := 1; Q := Matrix(i, 1); for j by 2 to i do Q(j) := 2*i-K; K := 4+K end do; Q := FlipDimension(Q, 1); Q(m+1) end if end proc; `index/xxx` := proc (L) RrProc(op(L)) end proc; Rr := table(xxx)
NULL

`#mover(mi("&Gamma;",fontstyle = "normal"),mo("&uminus0;"))` := Array(0 .. II, 0 .. JJ, 1 .. 6, 1 .. M)

f1 := RandomArray(II+1, JJ+1); f2 := RandomArray(II+1, JJ+1); f3 := RandomArray(II+1, JJ+1); f4 := RandomArray(II+1, JJ+1); f5 := RandomArray(II+1, JJ+1); f6 := RandomArray(II+1, JJ+1)

for m to M do `&Gamma;m`[1, m] := f1; `&Gamma;m`[2, m] := f2; `&Gamma;m`[3, m] := f3; `&Gamma;m`[4, m] := f4; `&Gamma;m`[5, m] := f5; `&Gamma;m`[6, m] := f6 end do

for m to M do `#mover(mi("&Gamma;",fontstyle = "normal"),mo("&uminus0;"))`[0 .. II, 0 .. JJ, 1, m] := ArrayTools:-Alias(`&Gamma;m`[1, m], [0 .. II, 0 .. JJ]); `#mover(mi("&Gamma;",fontstyle = "normal"),mo("&uminus0;"))`[0 .. II, 0 .. JJ, 2, m] := ArrayTools:-Alias(`&Gamma;m`[2, m], [0 .. II, 0 .. JJ]); `#mover(mi("&Gamma;",fontstyle = "normal"),mo("&uminus0;"))`[0 .. II, 0 .. JJ, 3, m] := ArrayTools:-Alias(`&Gamma;m`[3, m], [0 .. II, 0 .. JJ]); `#mover(mi("&Gamma;",fontstyle = "normal"),mo("&uminus0;"))`[0 .. II, 0 .. JJ, 4, m] := ArrayTools:-Alias(`&Gamma;m`[4, m], [0 .. II, 0 .. JJ]); `#mover(mi("&Gamma;",fontstyle = "normal"),mo("&uminus0;"))`[0 .. II, 0 .. JJ, 5, m] := ArrayTools:-Alias(`&Gamma;m`[5, m], [0 .. II, 0 .. JJ]); `#mover(mi("&Gamma;",fontstyle = "normal"),mo("&uminus0;"))`[0 .. II, 0 .. JJ, 6, m] := ArrayTools:-Alias(`&Gamma;m`[6, m], [0 .. II, 0 .. JJ]) end do

UP := proc (s, GAMMA, N, M, a, b, II, JJ, Rr) local k; i, j, r, p, m, q, n, l; if s = 1 then add(add(add(add(add(add((2/3)*Rr[i, m]*Rr[k, m]*b*add(GAMMA[i, j, q, p]*GAMMA[k, j, q, r]*tau[p](t)*tau[r](t), q = 1 .. N)/((2*m+1)*(2*j+1)*a), i = 0 .. II), k = 0 .. II), m = 0 .. II), j = 0 .. JJ), p = 1 .. M), r = 1 .. M) elif s = 2 then add(add(add(add(add(add((1/2)*Rr[i, m]*Rr[k, m]*b*add(GAMMA[i, j, q, p]*GAMMA[k, j, q, r]*tau[p](t)*tau[r](t), q = 1 .. N)/((2*m+1)*(2*j+1)*a), i = 0 .. II), k = 0 .. II), m = 0 .. II), j = 0 .. JJ), p = 1 .. M), r = 1 .. M) end if end proc

Grid:-Set(`index/xxx`);
Grid:-Set(RrProc);

forget(evalf); ans1 := CodeTools:-Usage([Grid:-Seq(UP(s, `#mover(mi("&Gamma;",fontstyle = "normal"),mo("&uminus0;"))`, N, M, a, b, II, JJ, Rr), s = 1 .. 2)])

memory used=186.05KiB, alloc change=2.19MiB, cpu time=15.00ms, real time=509.00ms, gc time=0ns

[HFloat(25.72145649709499)*tau[11](t)^2+HFloat(25.72145649709499)*tau[10](t)^2+HFloat(25.72145649709499)*tau[9](t)^2+HFloat(25.72145649709499)*tau[5](t)^2+HFloat(25.72145649709499)*tau[12](t)^2+HFloat(25.72145649709499)*tau[4](t)^2+HFloat(25.72145649709499)*tau[3](t)^2+HFloat(25.72145649709499)*tau[7](t)^2+HFloat(25.72145649709499)*tau[8](t)^2+HFloat(25.72145649709499)*tau[6](t)^2+HFloat(25.72145649709499)*tau[2](t)^2+HFloat(25.72145649709499)*tau[1](t)^2+HFloat(51.44291299418998)*tau[12](t)*tau[11](t)+HFloat(51.44291299418998)*tau[12](t)*tau[10](t)+HFloat(51.44291299418998)*tau[11](t)*tau[10](t)+HFloat(51.44291299418998)*tau[12](t)*tau[5](t)+HFloat(51.44291299418998)*tau[11](t)*tau[5](t)+HFloat(51.44291299418998)*tau[7](t)*tau[6](t)+HFloat(51.44291299418998)*tau[10](t)*tau[5](t)+HFloat(51.44291299418998)*tau[9](t)*tau[5](t)+HFloat(51.44291299418998)*tau[10](t)*tau[9](t)+HFloat(51.44291299418998)*tau[8](t)*tau[5](t)+HFloat(51.44291299418998)*tau[7](t)*tau[5](t)+HFloat(51.44291299418998)*tau[6](t)*tau[5](t)+HFloat(51.44291299418998)*tau[12](t)*tau[4](t)+HFloat(51.44291299418998)*tau[11](t)*tau[4](t)+HFloat(51.44291299418998)*tau[10](t)*tau[4](t)+HFloat(51.44291299418998)*tau[9](t)*tau[4](t)+HFloat(51.44291299418998)*tau[8](t)*tau[4](t)+HFloat(51.44291299418998)*tau[7](t)*tau[4](t)+HFloat(51.44291299418998)*tau[6](t)*tau[4](t)+HFloat(51.44291299418998)*tau[5](t)*tau[4](t)+HFloat(51.44291299418998)*tau[12](t)*tau[7](t)+HFloat(51.44291299418998)*tau[12](t)*tau[3](t)+HFloat(51.44291299418998)*tau[11](t)*tau[7](t)+HFloat(51.44291299418998)*tau[11](t)*tau[3](t)+HFloat(51.44291299418998)*tau[12](t)*tau[6](t)+HFloat(51.44291299418998)*tau[10](t)*tau[3](t)+HFloat(51.44291299418998)*tau[9](t)*tau[3](t)+HFloat(51.44291299418998)*tau[8](t)*tau[3](t)+HFloat(51.44291299418998)*tau[7](t)*tau[3](t)+HFloat(51.44291299418998)*tau[6](t)*tau[3](t)+HFloat(51.44291299418998)*tau[5](t)*tau[3](t)+HFloat(51.44291299418998)*tau[10](t)*tau[7](t)+HFloat(51.44291299418998)*tau[4](t)*tau[3](t)+HFloat(51.44291299418998)*tau[12](t)*tau[8](t)+HFloat(51.44291299418998)*tau[11](t)*tau[6](t)+HFloat(51.44291299418998)*tau[11](t)*tau[8](t)+HFloat(51.44291299418998)*tau[12](t)*tau[2](t)+HFloat(51.44291299418998)*tau[9](t)*tau[7](t)+HFloat(51.44291299418998)*tau[11](t)*tau[2](t)+HFloat(51.44291299418998)*tau[10](t)*tau[8](t)+HFloat(51.44291299418998)*tau[10](t)*tau[2](t)+HFloat(51.44291299418998)*tau[9](t)*tau[2](t)+HFloat(51.44291299418998)*tau[10](t)*tau[6](t)+HFloat(51.44291299418998)*tau[8](t)*tau[7](t)+HFloat(51.44291299418998)*tau[8](t)*tau[2](t)+HFloat(51.44291299418998)*tau[7](t)*tau[2](t)+HFloat(51.44291299418998)*tau[9](t)*tau[8](t)+HFloat(51.44291299418998)*tau[6](t)*tau[2](t)+HFloat(51.44291299418998)*tau[5](t)*tau[2](t)+HFloat(51.44291299418998)*tau[4](t)*tau[2](t)+HFloat(51.44291299418998)*tau[3](t)*tau[2](t)+HFloat(51.44291299418998)*tau[9](t)*tau[6](t)+HFloat(51.44291299418998)*tau[12](t)*tau[1](t)+HFloat(51.44291299418998)*tau[12](t)*tau[9](t)+HFloat(51.44291299418998)*tau[11](t)*tau[1](t)+HFloat(51.44291299418998)*tau[10](t)*tau[1](t)+HFloat(51.44291299418998)*tau[8](t)*tau[6](t)+HFloat(51.44291299418998)*tau[9](t)*tau[1](t)+HFloat(51.44291299418998)*tau[8](t)*tau[1](t)+HFloat(51.44291299418998)*tau[7](t)*tau[1](t)+HFloat(51.44291299418998)*tau[11](t)*tau[9](t)+HFloat(51.44291299418998)*tau[6](t)*tau[1](t)+HFloat(51.44291299418998)*tau[5](t)*tau[1](t)+HFloat(51.44291299418998)*tau[2](t)*tau[1](t)+HFloat(51.44291299418998)*tau[3](t)*tau[1](t)+HFloat(51.44291299418998)*tau[4](t)*tau[1](t), HFloat(19.291092372821243)*tau[11](t)^2+HFloat(19.291092372821243)*tau[10](t)^2+HFloat(19.291092372821243)*tau[9](t)^2+HFloat(19.291092372821243)*tau[5](t)^2+HFloat(19.291092372821243)*tau[12](t)^2+HFloat(19.291092372821243)*tau[4](t)^2+HFloat(19.291092372821243)*tau[3](t)^2+HFloat(19.291092372821243)*tau[7](t)^2+HFloat(19.291092372821243)*tau[8](t)^2+HFloat(19.291092372821243)*tau[6](t)^2+HFloat(19.291092372821243)*tau[2](t)^2+HFloat(19.291092372821243)*tau[1](t)^2+HFloat(38.582184745642486)*tau[12](t)*tau[11](t)+HFloat(38.582184745642486)*tau[12](t)*tau[10](t)+HFloat(38.582184745642486)*tau[11](t)*tau[10](t)+HFloat(38.582184745642486)*tau[12](t)*tau[5](t)+HFloat(38.582184745642486)*tau[11](t)*tau[5](t)+HFloat(38.582184745642486)*tau[7](t)*tau[6](t)+HFloat(38.582184745642486)*tau[10](t)*tau[5](t)+HFloat(38.582184745642486)*tau[9](t)*tau[5](t)+HFloat(38.582184745642486)*tau[10](t)*tau[9](t)+HFloat(38.582184745642486)*tau[8](t)*tau[5](t)+HFloat(38.582184745642486)*tau[7](t)*tau[5](t)+HFloat(38.582184745642486)*tau[6](t)*tau[5](t)+HFloat(38.582184745642486)*tau[12](t)*tau[4](t)+HFloat(38.582184745642486)*tau[11](t)*tau[4](t)+HFloat(38.582184745642486)*tau[10](t)*tau[4](t)+HFloat(38.582184745642486)*tau[9](t)*tau[4](t)+HFloat(38.582184745642486)*tau[8](t)*tau[4](t)+HFloat(38.582184745642486)*tau[7](t)*tau[4](t)+HFloat(38.582184745642486)*tau[6](t)*tau[4](t)+HFloat(38.582184745642486)*tau[5](t)*tau[4](t)+HFloat(38.582184745642486)*tau[12](t)*tau[7](t)+HFloat(38.582184745642486)*tau[12](t)*tau[3](t)+HFloat(38.582184745642486)*tau[11](t)*tau[7](t)+HFloat(38.582184745642486)*tau[11](t)*tau[3](t)+HFloat(38.582184745642486)*tau[12](t)*tau[6](t)+HFloat(38.582184745642486)*tau[10](t)*tau[3](t)+HFloat(38.582184745642486)*tau[9](t)*tau[3](t)+HFloat(38.582184745642486)*tau[8](t)*tau[3](t)+HFloat(38.582184745642486)*tau[7](t)*tau[3](t)+HFloat(38.582184745642486)*tau[6](t)*tau[3](t)+HFloat(38.582184745642486)*tau[5](t)*tau[3](t)+HFloat(38.582184745642486)*tau[10](t)*tau[7](t)+HFloat(38.582184745642486)*tau[4](t)*tau[3](t)+HFloat(38.582184745642486)*tau[12](t)*tau[8](t)+HFloat(38.582184745642486)*tau[11](t)*tau[6](t)+HFloat(38.582184745642486)*tau[11](t)*tau[8](t)+HFloat(38.582184745642486)*tau[12](t)*tau[2](t)+HFloat(38.582184745642486)*tau[9](t)*tau[7](t)+HFloat(38.582184745642486)*tau[11](t)*tau[2](t)+HFloat(38.582184745642486)*tau[10](t)*tau[8](t)+HFloat(38.582184745642486)*tau[10](t)*tau[2](t)+HFloat(38.582184745642486)*tau[9](t)*tau[2](t)+HFloat(38.582184745642486)*tau[10](t)*tau[6](t)+HFloat(38.582184745642486)*tau[8](t)*tau[7](t)+HFloat(38.582184745642486)*tau[8](t)*tau[2](t)+HFloat(38.582184745642486)*tau[7](t)*tau[2](t)+HFloat(38.582184745642486)*tau[9](t)*tau[8](t)+HFloat(38.582184745642486)*tau[6](t)*tau[2](t)+HFloat(38.582184745642486)*tau[5](t)*tau[2](t)+HFloat(38.582184745642486)*tau[4](t)*tau[2](t)+HFloat(38.582184745642486)*tau[3](t)*tau[2](t)+HFloat(38.582184745642486)*tau[9](t)*tau[6](t)+HFloat(38.582184745642486)*tau[12](t)*tau[1](t)+HFloat(38.582184745642486)*tau[12](t)*tau[9](t)+HFloat(38.582184745642486)*tau[11](t)*tau[1](t)+HFloat(38.582184745642486)*tau[10](t)*tau[1](t)+HFloat(38.582184745642486)*tau[8](t)*tau[6](t)+HFloat(38.582184745642486)*tau[9](t)*tau[1](t)+HFloat(38.582184745642486)*tau[8](t)*tau[1](t)+HFloat(38.582184745642486)*tau[7](t)*tau[1](t)+HFloat(38.582184745642486)*tau[11](t)*tau[9](t)+HFloat(38.582184745642486)*tau[6](t)*tau[1](t)+HFloat(38.582184745642486)*tau[5](t)*tau[1](t)+HFloat(38.582184745642486)*tau[2](t)*tau[1](t)+HFloat(38.582184745642486)*tau[3](t)*tau[1](t)+HFloat(38.582184745642486)*tau[4](t)*tau[1](t)]

forget(evalf); ans2 := CodeTools:-Usage([seq(UP(s, `#mover(mi("&Gamma;",fontstyle = "normal"),mo("&uminus0;"))`, N, M, a, b, II, JJ, Rr), s = 1 .. 2)])

memory used=141.52MiB, alloc change=4.00MiB, cpu time=1.03s, real time=1.03s, gc time=125.44ms

ans1-ans2

[0, 0]

forget(evalf); ans1 := CodeTools:-Usage([Grid:-Seq(UP(s, `#mover(mi("&Gamma;",fontstyle = "normal"),mo("&uminus0;"))`, N, M, a, b, II, JJ, Rr), s = 1 .. 2)])

memory used=116.91KiB, alloc change=4.38MiB, cpu time=42.00ms, real time=489.00ms, gc time=32.16ms

forget(evalf); ans2 := CodeTools:-Usage([seq(UP(s, `#mover(mi("&Gamma;",fontstyle = "normal"),mo("&uminus0;"))`, N, M, a, b, II, JJ, Rr), s = 1 .. 2)])

memory used=137.51MiB, alloc change=-2.00MiB, cpu time=1.04s, real time=970.00ms, gc time=145.08ms

ans1-ans2

[0, 0]

``

Download soal_ac.mw

The problem is that you are trying to use GAMMA as if it were a previously unused name. But it is already the name of a procedure in Maple itself.

Trying to unprotect the name, so as to try and use it like a regular, unassigned name, is something you should NOT do.

The error message is telling you what to do. Replace the call to unprotect(GAMMA) with,

local GAMMA;

Or use another name. That might be advisable, if it's supposed to be passed off via Grid

Why not solve for t, symbolically, up front? You can utilize that formula directly within the plot command. (There's no need to produce discrete data, although you can if you want.)

restart;

thetavn := (1/6)*Pi:

omegac := 0.1:

s := v*cos(thetavn)*(cos(2*thetabn)*tan(thetabn)+sin(2*thetabn)*sin(omegac*t)/omegac):

form := solve(s = 0, t);

-10.*arcsin(.1000000000*cos(2.*thetabn)*tan(thetabn)/sin(2.*thetabn))

# non-parametric plotting
plot(form, thetabn=Pi/100 .. Pi);

# parametric plotting
# You don't need to call `solve` for each thetabn value.
plot([eval([thetabn, form],thetabn=Pi*k/100)[], k=1..100]);

# non-parametric form, first portion
plot(form, thetabn=Pi/100 .. Pi*43/100, tickmarks=[decimalticks, default]);

Data1:=[seq([thetabn, form], thetabn=[seq(Pi*k/100, k=1..43)])]:
Data2:=[seq([thetabn, form], thetabn=[seq(Pi*k/100, k=57..99)])]:
plots:-display(plot(Data1), plot(Data2));

 

 

Download form_plotting.mw

You can automate parallel (concurrent) computations by using either the Grid or Threads packages. That would be considerably superior to using separate worksheets to cobble together your own parallel computation environment.

As a very rough but general rule: if you can parallelize the job at a fine level (usually for something which is purely numeric and thus more readily made thread-safe) then the Threads package is more suitable, while if your overall goal is more easily parallelized into larger and more computationally expensive (usually fewer, higher level) jobs then the Grid package is more suitable.

With the Threads package the concurrent computations take place under the same kernel session, hence the need for them to not interact with each other (an aspect of the needed thread-safety). Most of the Maple Library's commands are not thread-safe, hence the common occurrence that thread-safe code is mostly numeric or mostly uses kernel builins.

With the Grid package there is greater overhead for launching the concurrent sub-computations, but that is relatively negligible if the sub-computations are more expensive and there are less of them. With this package the sub-computations run in separate kernels, and so are protected from interfering with each other, and the issue of thread-safety is mitigated.

See the Help, or search this site, for examples.

It sounds to me as if the Grid package might be more suitable for your job.

restart;

t:=0:

for i from 1 to 11 do
  j:=i+i^2;
  k:=j+t;
  t:=j/k; print('t'=t);
end do:

t = 1

t = 6/7

t = 14/15

t = 150/157

t = 157/162

t = 6804/6961

t = 13922/14165

t = 509940/516901

t = 516901/522567

t = 5225670/5272661

t = 115998542/116869487

 

Download loop_print.mw

Here it is with everything but the last plot's output:

triangle_analysis_ac1.mw

Another thing that worked for me was to File->Open the original, and then (even though it appears to have not loaded and sheet appears blank!) use the menubar's Edit->Remove Output->From Worksheet , and then save it to another filename. That produces a version with all output removed.  triangle_analysis_gone.mw

The term G*M/R^2 does not appear alone in your second expression. Before your second attempt, the value of work is actually G*M*m*h/R^2 . Mathematically G*M/R^2 divides that expression, but subs is a syntactic replacement mechanism. This is one of the reasons why the algsubs command exists.

Is this what you wanted to accomplish?

NULL

Justification for using mg as the force exerted by mass m in gravity field g

Using Newton's Law of Gravity, find NULL

work := `assuming`([int(G*M*m/r^2, r = R .. R+h)], [0 < R, 0 < h])

G*M*m*h/(R*(R+h))

NULL

R is >> h, so let R + h = R

work := subs(R+h = R, work)

G*M*m*h/R^2

NULL

G, M and R are all constants, so let GM/R² = g

work := algsubs(G*M/R^2 = g, work)

m*h*g

NULL

NULL

Download Gravity_ac.mw

The following all works ok for me using either Maple 2017.3, or Maple 2017.2, or Maple 2017.0 on 64bit Linux.

It also includes an example in which the color shading goes from green through purple to blue (by surface height), without using the colorscheme option at all.

All the examples which do not use the colorscheme option will work in Maple 17.02 (released 2013), including the one in which the color shading goes from green through purple to blue (by surface height).

Perhaps you could upload a .mw worksheet in which it does not work, so that we could try and diagnose the issue.

restart;

kernelopts(version);

`Maple 2017.2, X86 64 LINUX, Jul 19 2017, Build ID 1247392`

plots:-setoptions3d(lightmodel=none, orientation=[50,70,0]):

plot3d(sin(x)*cos(y), x = 0 .. 4*Pi, y = 0 .. 4*Pi,
       view = [default, default, -3 .. 3],
       colorscheme = ["xgradient", ["Green", "Purple", "Blue"]]);

plot3d(sin(x)*cos(y), x = 0 .. 4*Pi, y = 0 .. 4*Pi,
       view = [default, default, -3 .. 3],
       colorscheme = ["zgradient", ["Green", "Purple", "Blue"]]);

 

The next example is shaded from green through purple to blue, z-wise,
but doesn't require the colorscheme option.

 

f := proc(x,y) option remember, system;
       sin(x)*cos(y);
     end proc:

F := proc(x,y)
       if not (x::numeric and y::numeric) then
         return 'procname'(args);
       end if;
       (1+f(x,y))/2;
     end proc: # normalize
v := F(x,y):

redpw := piecewise(v<1/2, v, 1-v):
greenpw := piecewise(v<1/2, 1-2*v, 0):
bluepw := v:

plot3d(f(x,y), x = 0 .. 4*Pi, y = 0 .. 4*Pi,
       view = [default, default, -3 .. 3],
       color=[redpw,greenpw,bluepw,colortype=RGB]);

 

The rest are just for fun.

 

f := (x,y)->sin(x)*cos(y):
F := (x,y)->0.3+0.4*(1+f(x,y))/2:

plot3d(f(x,y), x = 0 .. 4*Pi, y = 0 .. 4*Pi,
       view = [default, default, -3 .. 3],
       color=[F(x,y),1,1,colortype=HSV]);

f := (x,y)->sin(x)*cos(y):
F := (x,y)->(1+f(x,y))/2:

plot3d(f(x,y), x = 0 .. 4*Pi, y = 0 .. 4*Pi,
       view = [default, default, -3 .. 3],
       color=[1-(abs(F(x,y)-1/2))^(1/2),
              1-(abs(F(x,y)))^(1/2),
              1-(abs(F(x,y)-3/4))^(1/4),
              colortype=RGB]);

 

Download plot3d_color_20172.mw

 

You need to use := instead of just = when making an assignment.

The concatenation operator (with evaluation of the suffix) in modern Maple is done using the cat command. (It was dot in the very distant past, but not now. In modern Maple the dot is used for multiplication.)

The name index is protected. Use another name.

Is this what you were trying to do?

restart;

G := unapply((x-y+1)*X/binomial(x, y)+1-(x-y+1)/binomial(x, y), x, y):

PSI := G(3, 2)^10*G(4, 2)^4*G(4, 3)^2*G(5, 2)^2*G(5, 4)
       *G(5, 3)*G(6, 2)^4*G(7, 3)*G(8, 2)*G(9, 2)*G(9, 3)
       *G(9, 4)*G(10, 2)^2*G(11, 2)*G(11, 3)*G(12, 3)*G(13, 3)*G(15, 2)^2:

for i from 0 to degree(PSI,X) do
  cat(D,i) := evalf(coeff(PSI, X, i));
end do:

Dmax := 0:

for i from 0 to degree(PSI,X) do
  if eval(cat(D,i)) > Dmax then
    Index := i;
    Dmax := cat(D,i);
  end if;
end do;

Index, Dmax, evalf(coeff(PSI,X,Index));

14, .1499364076, .1499364076

 

Download coeff_max1.mw

It's more effiecient to use an indexed name rather than a concatenated name, but in that case use another name since D is protected and has a particular meaning.

restart;

G := unapply((x-y+1)*X/binomial(x, y)+1-(x-y+1)/binomial(x, y), x, y):

PSI := G(3, 2)^10*G(4, 2)^4*G(4, 3)^2*G(5, 2)^2*G(5, 4)
       *G(5, 3)*G(6, 2)^4*G(7, 3)*G(8, 2)*G(9, 2)*G(9, 3)
       *G(9, 4)*G(10, 2)^2*G(11, 2)*G(11, 3)*G(12, 3)*G(13, 3)*G(15, 2)^2:

for i from 0 to degree(PSI,X) do
  DD[i] := evalf(coeff(PSI, X, i));
end do:

Dmax := 0:

for i from 0 to degree(PSI,X) do
  if DD[i] > Dmax then
    Index := i;
    Dmax := DD[i];
  end if;
end do;

Index, Dmax, evalf(coeff(PSI,X,Index));

14, .1499364076, .1499364076

 

Download coeff_max2.mw

If you have no other reason to retain the coefficients then there's no need to assign them separately to any new names.

restart;

G := unapply((x-y+1)*X/binomial(x, y)+1-(x-y+1)/binomial(x, y), x, y):

PSI := G(3, 2)^10*G(4, 2)^4*G(4, 3)^2*G(5, 2)^2*G(5, 4)
       *G(5, 3)*G(6, 2)^4*G(7, 3)*G(8, 2)*G(9, 2)*G(9, 3)
       *G(9, 4)*G(10, 2)^2*G(11, 2)*G(11, 3)*G(12, 3)*G(13, 3)*G(15, 2)^2:

Dmax := 0:

for i from 0 to degree(PSI,X) do
  temp := coeff(PSI, X, i);
  if temp > Dmax then
    Index := i;
    Dmax := temp;
  end if;
end do:

Index, evalf(Dmax), evalf(coeff(PSI,X,Index));

14, .1499364076, .1499364076

 

Download coeff_max3.mw

I find that manual rotation (or even selection) of an implicitplot3d t makes my Linux machine bog down, especially when the grid or numpoints setting is high.

But, here, the jaggedness of the boundary can be reduced quite a bit with a higher grid setting of an explicit plot3d or contourplot3d result. And manual rotation, etc, seems to behave better.

I include a few small contour values, to illustrate the restricted domain better.

I zip the worksheet because the saved file is large, due to large plot structure which present a problem for inlining here.

3d_cont.zip

restart:
with(plots):
Omega:=5*Pi:
gamma1:=8*Pi:
gamma2:=0.002*Pi:
x1:=100*Pi:
omega2:=200*Pi:
gamma0:=0.2*Pi:
G:=20*Pi:

lambda1:=(1/(2*Pi))^2*(G*Omega*gamma0/(2*(0.25*gamma0^2+Delta^2))):
lambda2:=(1/(2*Pi))^2*(-G*Omega*Delta/((0.25*gamma0^2+Delta^2))):
lambda3:=(1/(2*Pi))^2*gamma1+lambda1:
lambda4:=(1/(2*Pi))^2*(0.2*omega2-G^2*Delta/(0.25*gamma0^2+Delta^2)):
lambda5:=(1/(2*Pi))^2*(2*x1^2*omega2/((omega2^2+gamma2^2))):
f:=epsilon-(lambda1+sqrt(-lambda2^2+Y*(lambda3^2+(lambda4-lambda5*Y)^2)))^2:
contourplot(solve(f,epsilon), Delta =-25*Pi .. 25*Pi, Y=0..1,
            contours=[0.01,0.1,0.5,1,4,8,12,16,20], axes=boxed, color=black,
            tickmarks=[3, 3], linestyle=1, grid=[501,501],
            gridlines=false, view=[-25*Pi .. 25*Pi,0..1]);

plot3d(solve(f,epsilon), Y = 0 .. 1.0, Delta=-25*Pi..25*Pi,
       style=surfacecontour, color=khaki, labels=[Y,Delta,E1],
       tickmarks=[3,3,3], grid=[351,351], view=0..20,
       orientation=[180,0,-180], lightmodel=none);

plots:-contourplot3d(solve(f,epsilon), Y = 0 .. 1.0, Delta=-25*Pi..25*Pi,
                     contours=[0.01,0.1,0.5,1,4,8,12,16,20], color=khaki,
                     labels=[Y,Delta,E1],
                     tickmarks=[3,3,3], grid=[551,551], view=0..20,
                     color=black, thickness=2, orientation=[180,0,-180]);

If you are still using Maple 13 (released in the year 2009) then remove the option size=[...] which I added only to try and make the offset a little better. I figured that you didn't want the text to cross the y-axis.

restart:

with(plots):

p1:=plot(sin(2*x), x = -Pi .. Pi):
p2:= textplot([0,1.2,typeset("effect of ",alpha=3,",",gamma=5," in the flow")]):
display(p1,p2,
        plot(0, x = -Pi .. Pi, color=black),
        axes=box, view=[default,-1..1.5]);

p1:=plot(sin(2*x), x = -Pi .. Pi):
p2:= textplot([2.2,1.2,typeset("effect of ",alpha=3,",",gamma=5," in the flow")]):
display(p1,p2, size=[450,400]);

 

Download gk_text.mw

First 168 169 170 171 172 173 174 Last Page 170 of 339