acer

30385 Reputation

29 Badges

18 years, 264 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

This is just to address your a) and b).

Your phrasing in a) isn't clear about whether you're interested in any 3rd element being zero (including multiple instances of that), versus exactly one 3rd element being zero. I supposed the former, since you didn't state how the followup indices would be formed in the latter case.

pt := [<1, 1, 1>, <2, 1, 1>, <3, 1, 0>, <4, 1, 1>]:

for i to nops(pt) do if pt[i][3]=0 then break; end; end;
[$i..nops(pt), $1..i-1];

     [3, 4, 1, 2]

You could start by issuing

    kernelopts(numcpus=1):

at the start of your session. (See ?kernelopts)

ps. Being thread-safe is not the same as being deterministic. Neither causes the other in general. (Of course a particular program can easily have one depend on the other -- either way -- but that's certainly not the same as general causation. It's just happenstance and can link any two qualities.)

It's not clear whether you want an animation of a static plot. It's not clear to me whether you want a surface or 3d point-plot, as result.

So I guessed.

restart

with(plottools); with(plots)

points1 := {[0, 1], [0.4e-1, .99920], [0.8e-1, .99680], [.12, .99280], [.16, .98722], [.20, .98006], [.24, .97133], [.28, .96104], [.32, .94922], [.36, .93588], [.40, .92104], [.44, .90472], [.48, .88696], [.52, .86779], [.56, .84723], [.60, .82531], [.64, .80207], [.68, .77755], [.72, .75179], [.76, .72482], [.80, .69669], [.84, .66744], [.88, .63713], [.92, .60580], [.96, .57350], [1.00, .54028], [1.04, .50620], [1.08, .47130], [1.12, .43565], [1.16, .39930], [1.20, .36231], [1.24, .32474], [1.28, .28665], [1.32, .24811], [1.36, .20917], [1.40, .16989], [1.44, .13034], [1.48, 0.90585e-1], [1.52, 0.50685e-1], [1.56, 0.10703e-1], [1.60, -0.29295e-1], [1.64, -0.69245e-1], [1.68, -.10908], [1.72, -.14874], [1.76, -.18817], [1.80, -.22730], [1.84, -.26606], [1.88, -.30440], [1.92, -.34225], [1.96, -.37955], [2.00, -.41625], [2.04, -.45228], [2.08, -.48758], [2.12, -.52210], [2.16, -.55578], [2.20, -.58858], [2.24, -.62043], [2.28, -.65129], [2.32, -.68111], [2.36, -.70983], [2.40, -.73742], [2.44, -.76383], [2.48, -.78902], [2.52, -.81294], [2.56, -.83556], [2.60, -.85684], [2.64, -.87674], [2.68, -.89525], [2.72, -.91233], [2.76, -.92795], [2.80, -.94208], [2.84, -.95471], [2.88, -.96581], [2.92, -.97536], [2.96, -.98334], [3.00, -.98975], [3.04, -.99458], [3.08, -.99781], [3.12, -.99940], [3.16, -.99940], [3.20, -.99783], [3.24, -.99466], [3.28, -.98989], [3.32, -.98354], [3.36, -.97561], [3.40, -.96612], [3.44, -.95509], [3.48, -.94252], [3.52, -.92844], [3.56, -.91288], [3.60, -.89585], [3.64, -.87738], [3.68, -.85752], [3.72, -.83628], [3.76, -.81370], [3.80, -.78982], [3.84, -.76468], [3.88, -.73831], [3.92, -.71076], [3.96, -.68206], [4.00, -.65227], [4.04, -.62144], [4.08, -.58961], [4.12, -.55684], [4.16, -.52317], [4.20, -.48866], [4.24, -.45337], [4.28, -.41736], [4.32, -.38068], [4.36, -.34338], [4.40, -.30553], [4.44, -.26720], [4.48, -.22844], [4.52, -.18931], [4.56, -.14988], [4.60, -.11020], [4.64, -0.70347e-1], [4.68, -0.30381e-1], [4.72, 0.96326e-2], [4.76, 0.49630e-1], [4.80, 0.89547e-1], [4.84, .12932], [4.88, .16889], [4.92, .20818], [4.96, .24714], [5.00, .28571]}

p := pointplot(points1)

f := transform(proc (x, z) options operator, arrow; [x, aa, z] end proc); display(seq((subs(aa = i, eval(f)))(p), i = 1 .. 25), insequence, labels = [x, y, z])

animate(proc (i) options operator, arrow; (transform(unapply([x, i, z], [x, z])))(p) end proc, [i], i = 1 .. 25, frames = 25, paraminfo = false, trace = 25)

display(extrude(p, 1 .. 25, proc (x, y, z) options operator, arrow; [x, z, y] end proc, numsegments = 25, style = point), labels = [x, y, z])

NULL

NULL

Download 2d_to_3d_try_ac.mw

The do-loop to solve and compute the Matrices M[k] (for the k values of Gr) takes 3 seconds on my Maple 2018.2. I also used spacestep=1e-2.

restart;

interface(displayprecision=4):

(inf,Pr,g,Ec):=20,.71,.3,.4: GrVals:=[.1,.5,1.0,1.5]:

OdeSys:={(diff(Theta(xi,eta),eta,eta))/Pr-(diff(Theta(xi,eta),xi))
         -g*(diff(Theta(xi,eta),eta))+Ec*(diff(u(xi,eta),eta))
         *(diff(u(xi,eta),eta))=0,diff(u(xi,eta),eta,eta)-g*(diff(u(xi,eta),eta))
         -(diff(u(xi,eta),xi))+Gr*Theta(xi,eta)=0}:

Cond:={Theta(0,eta)=0,Theta(xi,0)=1,Theta(xi,inf)=0,
       u(0,eta)=0,u(xi,0)=1,u(xi,inf)=0}:

Veta:=<1e-5,seq(0.02..20-0.02,0.02),20-1e-5>:

for k to nops(GrVals) do
  Ans[k]:=pdsolve((eval([OdeSys,Cond],Gr= GrVals[k]))[],
                  numeric,time=xi,spacestep=1e-2,timestep=1);
  All[k]:=subsop(3=remember,Ans[k]:-value(xi=1));
  Ff:=(eta,k)->eval(u(xi,:-eta),All[k](eta));
  Thetaf:=(eta,k)->eval(Theta(xi,:-eta),All[k](eta));
  M[k]:=<<Cf[GrVals[k]]|Nux[GrVals[k]]>,
         <(evalf@D[1](Ff))~(Veta,k)|(evalf@D[1](Thetaf))~(Veta,k)>>;
end do:

final:=<<eta,Veta>|`<|>`(seq(M[k],k=1..nops(GrVals)))>:

final(..10,..);

Matrix(10, 9, {(1, 1) = eta, (1, 2) = Cf[.1000], (1, 3) = Nux[.1000], (1, 4) = Cf[.5000], (1, 5) = Nux[.5000], (1, 6) = Cf[1.0000], (1, 7) = Nux[1.0000], (1, 8) = Cf[1.5000], (1, 9) = Nux[1.5000], (2, 1) = 0., (2, 2) = -1.2340, (2, 3) = -1.0326, (2, 4) = -1.0819, (2, 5) = -1.0420, (2, 6) = -.8922, (2, 7) = -1.0522, (2, 8) = -.7029, (2, 9) = -1.0608, (3, 1) = 0.200e-1, (3, 2) = -1.2038, (3, 3) = -1.0131, (3, 4) = -1.0587, (3, 5) = -1.0215, (3, 6) = -.8777, (3, 7) = -1.0308, (3, 8) = -.6971, (3, 9) = -1.0386, (4, 1) = 0.400e-1, (4, 2) = -1.1743, (4, 3) = -.9939, (4, 4) = -1.0359, (4, 5) = -1.0014, (4, 6) = -.8633, (4, 7) = -1.0097, (4, 8) = -.6912, (4, 9) = -1.0168, (5, 1) = 0.600e-1, (5, 2) = -1.1456, (5, 3) = -.9749, (5, 4) = -1.0137, (5, 5) = -.9817, (5, 6) = -.8492, (5, 7) = -.9891, (5, 8) = -.6851, (5, 9) = -.9955, (6, 1) = 0.800e-1, (6, 2) = -1.1176, (6, 3) = -.9563, (6, 4) = -.9919, (6, 5) = -.9623, (6, 6) = -.8353, (6, 7) = -.9689, (6, 8) = -.6790, (6, 9) = -.9747, (7, 1) = .1000, (7, 2) = -1.0902, (7, 3) = -.9379, (7, 4) = -.9706, (7, 5) = -.9432, (7, 6) = -.8215, (7, 7) = -.9491, (7, 8) = -.6728, (7, 9) = -.9543, (8, 1) = .1200, (8, 2) = -1.0635, (8, 3) = -.9198, (8, 4) = -.9497, (8, 5) = -.9245, (8, 6) = -.8080, (8, 7) = -.9297, (8, 8) = -.6666, (8, 9) = -.9343, (9, 1) = .1400, (9, 2) = -1.0375, (9, 3) = -.9020, (9, 4) = -.9294, (9, 5) = -.9061, (9, 6) = -.7946, (9, 7) = -.9107, (9, 8) = -.6602, (9, 9) = -.9147, (10, 1) = .1600, (10, 2) = -1.0121, (10, 3) = -.8845, (10, 4) = -.9094, (10, 5) = -.8881, (10, 6) = -.7814, (10, 7) = -.8921, (10, 8) = -.6538, (10, 9) = -.8956})


Download Demo_paper_work_1_accc.mw

The first one can be done because simplify can handle the rhs-lhs if n is assumed posint.

restart;

F := subs(__d=rsolve({F(1) = 1, F(2) = 1,
                      F(n + 1) = F(n) + F(n - 1)}, F(n)),
          proc(n) if is(n,posint) then __d;
                  else 'procname'(args); end if; end proc):

cand := F(n + 1)^2 = F(n)*F(n + 2) + (-1)^n;

F(n+1)^2 = F(n)*F(n+2)+(-1)^n

is( simplify( (rhs-lhs)( cand )=0 ) ) assuming n::posint;

true


Download fibo_JAMET_1.mw

I haven't found a way to get zero from rhs-lhs of your G formula.

The answer seems to be due to the difference between applying eval versus limit for the IC.

This is apparently the same behaviour from odetest -- and certainly the same kind of example -- as in this older Question of yours from April 2024. And IIRC you posted another duplicate of that just the other week (though perhaps since deleted).

restart;

e1:=2/x+1/3*sqrt(3);

2/x+(1/3)*3^(1/2)

e2:=simplify(e1);

(1/3)*(3^(1/2)*x+6)/x

eval([e1,e2], x=infinity);

[(1/3)*3^(1/2), 0]

limit~([e1,e2], x=infinity);

[(1/3)*3^(1/2), (1/3)*3^(1/2)]

Download lim_eval.mw

@Andiguys This is to respond to your last Reply immediately above. I had a look at this last night, using Maple 2019 like you.

This seems to attain a minimum for TRC(sigma,nu,Q3).

N1_11_ac1.mw

Note that your ensuing plot3d call is confusing, since its first argument is an expression that does not contain I1 or I2. So it's unclear how you want to use any optimal values of sigma,nu,Q3. (I still don't think that you've made your full purpose clear, as previously mentioned.)

ps. I also tried to confirm the minimum using DirectSearch (from maple.cloud or the Application Center). For only Optimization:-Minimize I did some preliminary analysis to restrict the parameter ranges. The results seem to agree, though higher Digits was needed due I suppose to the difference in scale of Q3 versus sigma and mu.

Are you asking for a list of all the arguments to log calls in that input?

If so, note the additional ln terms introduced by Maple's evaluation of your input example. If you know that all your examples will be, say, polynomials of at least degree 1 in x then you might be able to get by with something like the first approach below. But more robust in general would be to use the inert %log when entering your input. (You described it as input.)

restart;

 


Note how this evaluates.

ee := log[2](x^2-3*x+5)+x^3-1-log[3](x-1);

ln(x^2-3*x+5)/ln(2)+x^3-1-ln(x-1)/ln(3)

ans := [map(op,indets(ee,specfunc(Not(constant),ln)))[]];

[x-1, x^2-3*x+5]


With inert %log calls,

ff := %log[2](x^2-3*x+5)+x^3-1-%log[3](x-1);

%log[2](x^2-3*x+5)+x^3-1-%log[3](x-1)

ans := [map(op,indets(ff,specfunc(anything,%log)))[]];

[x-1, x^2-3*x+5]


With delayed evaluation,

hh := 'log[2](x^2-3*x+5)+x^3-1-log[3](x-1)';

log[2](x^2-3*x+5)+x^3-1-log[3](x-1)

ans := [map(op,indets(eval(hh,1),specfunc(anything,log)))[]];

[x-1, x^2-3*x+5]


Do you need that list sorted?

sort(ans, (a,b)->degree(a,x)>degree(b,x));

[x^2-3*x+5, x-1]


Download ln_indets.mw

There's no need to get into DataFrame complications here (eg. Tabulate of such renders row and column headers in 1D plaintext).

S5S4BoxPlotPondération_ac.mw

It's not entirely clear what you mean by "filtered" or "select". Do you want them returned in a new (smaller) DataFrame, or separated out from each other, or...?

Perhaps you want the result from,

    select(member,TestData,Case,SelectionList);

DataFrame_select_ex0.mw

I would prefer to transform a 2D version by transforming it onto the z=1 plane, instead of using intersectplot for a 3D version when it wasn't necessary.

display(transform((x,y)->[x,y,1])(plt1),
        scaling=constrained,caption="Projective Co-ords on plane z=1",
        axes=normal,axis[3]=[tickmarks=[1]]);

 

Having said that, I would also rather use a dedicated line-plotting command (line, or even plot with adaptive=false and numpoints=2) before I would call such a hammer as implicitplot for it.

It's clearly a weakness that simplify(e1,trig) does not gets the compact sec form, while the following does,
   simplify(tan(x+c__1)^2+1,trig);   # returns sec(x+c__1)^2
 

e1:=a/sqrt(tan(x+c__1)^2+1);

a/(tan(x+c__1)^2+1)^(1/2)

evalindets(e1,`+`,simplify,trig);

a/(sec(x+c__1)^2)^(1/2)

Download tan_sec_simplification_june_9_2024_ac.mw


Note: this is not the first time that you've mentioned that you expected simplify(...,size) to get some particular form that required a mathematical transformation outside of that option's documented functionality. See the first bullet point of the Description section of the ?simplify,size Help-page.

Check whether this is the minimization you intended.

restart

with(Optimization); with(plots)

R1 := Jv*(1-x)*d; R2 := Jr*Q2+Ce*(d*y-Q1); R3 := Cm*Q1+I1*Q1a+I2*Q1b+Vr*k

TC := proc (I1, I2, Q2) options operator, arrow; R1+R2+R3 end proc

TC(I1, I2, Q2)

Q1 = Q1a+Q1bQ1a = alpha(I1)*dalpha(I1) = 0.2e-1*exp(.4*I1)Q1b = beta(I2)*dbeta(I2) = 0.2e-1*exp(.3*I2)-0.2e-1

C1 := delta*(Q1a+Q1b)+Q2 >= x*d; C1a := subs([Q1a = alpha(I1)*d, Q1b = beta(I2)*d], C1)

C1b := subs([alpha(I1) = 0.2e-1*exp(.4*I1), beta(I2) = 0.2e-1*exp(.3*I2)-0.2e-1], C1a)

C2a := {k >= alpha(I1)*d+beta(I2)*d, alpha(I1)*d+beta(I2)*d >= rho*k}

C2 := subs([alpha(I1) = 0.02*exp(0.4*I1), beta(I2) = 0.02*exp(0.3*I2) - 0.02], C2a):

C3 := I1 <= I2:

TC1a := subs([Q1 = Q1a+Q1b], TC(I1, I2, Q2))

TC1b := subs([Q1a = alpha(I1)*d, Q1b = beta(I2)*d], TC1a)

TC1c := subs([alpha(I1) = 0.2e-1*exp(.4*I1), beta(I2) = 0.2e-1*exp(.3*I2)-0.2e-1], TC1b)

DATA := [Jv = 2.8, Jr = 3.15, d = 2*10^9, h = 35, k = 2*10^8, delta = .5, rho = .6, y = .6, x = .25, Ce = 1.5, Cm = 1, Vr = 0.15e-3]

TRC := unapply(eval(TC1c, DATA), I1, I2, Q2):

s := Minimize(TRC(I1, I2, Q2), {C1b, C3} union C2, I1 = 0 .. 5, I2 = 0 .. 7, assume = nonnegative);

[5979250877.72649193, [I1 = HFloat(0.0), I2 = HFloat(0.25474549280535297), Q2 = HFloat(0.0), d = HFloat(0.29837235850951205), delta = HFloat(1.0629016402605893), k = HFloat(0.08025849756859023), rho = HFloat(0.08025792480959956), x = HFloat(0.022571008132838303)]]

plot3d(TRC(I1, I2, eval(Q2, s[2])), I1 = 0 .. 5, I2 = 0 .. 7,
       orientation=[165, 75, 0]);

display(
  plot3d(TRC(I1, I2, eval(Q2, s[2])), I1 = 0 .. 0.1, I2 = 0 .. 1,
         color=cyan),
  pointplot3d([eval([I1,I2,TRC(I1,I2,Q2)],s[2])],symbolsize=30,
              color=red,symbol=solidcircle,orientation=[165,75,0]));


Download Updated_model_ac.mw

Your updated model attempt had several mistakes (syntax, spelling, etc).

Here is what I get,

interface(version);

`Standard Worksheet Interface, Maple 2024.0, Linux, March 01 2024 Build ID 1794891`

A:=Matrix(1,0);

A := Matrix(1, 0, {})

print("My matrix is =",A);

"My matrix is =", Matrix(1, 0, {})

lprint("My matrix is =",A);

"My matrix is =", Matrix(1,0,{},datatype = anything,storage = rectangular,order
= Fortran_order,shape = [])


Download why_print_empty_june_7_2024_ac.mw

I am running with this setting:

   interface(typesetting);    # standard

That is the default for a wholly fresh installation of Maple 2024.0 on Linux (with no older preferences imported).

That corresponds to the GUI Tools->Options->Display setting,
    Typesetting level   :   Extended
whereas you show that above as being,
    Typesetting level   :   Maple Standard

If I changed the interface setting (by interface command or by GUI Options menu) from extended to standard then I do get a blank output for the relevant line.

When that happens, I also get some Java error messages in the shell from which I launched the GUI. The beginning of that indicates that it has run amok of the Matrix with a dimension being zero.

While there were GUI changes for Maple 2024.0 related to the new Scrollable Matrices feature, I was unable to work around it for your example by disabling the effect of that new GUI feature. However I don't see the issue in my Maple 2023.2.

Here is one way, which shows it as 2D Math.

You can also put unassigned parameter names into a InertForms:-Display call, and then substitute numeric values for those (using `eval`, or `subs`) after computing such.

plots:-textplot([2,0.9,
                 InertForm:-Display(W__LJ=0.75 %+ 0.98 %* ((1.18/Gamma)%^1.9-(1.15/Gamma)%^0.98),'inert'=false)],
                 'font'=["helvetica","roman",15],
                 size=[600,300]);


Download inertform_textplot.mw

1 2 3 4 5 6 7 Last Page 1 of 316
´╗┐