acer

32405 Reputation

29 Badges

19 years, 349 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

Your code calls eval like this,

   eval(M, [:-alpha=alpha, :-gamma = gamma, :-mu = mu, :-lambda=lambda, :-B[1]=B__1, :-B[2]=B__2],:-beta[0]=beta__0)

but the closing right bracket is in the wrong place, ie. before beta[0]=beta__0. So you're invalidly calling eval with three arguments. That's what the error message tells you, too. It should be,

   eval(M, [:-alpha=alpha, :-gamma = gamma, :-mu = mu, :-lambda=lambda, :-B[1]=B__1, :-B[2]=B__2,:-beta[0]=beta__0])

Also, you're code tries to substitute for global :-gamma, which you've declared local at the top-level.

Also, some parts of your expression might take either very large/very small values, when done computed at hardware precision. You can force use of "software" floats instead of hardware double-precision. And you might also want to experiment with how much (if any) increased working precision might benefit the accuracy.

You might also need to adjust your hard-coded view, in the plot3d call in procedure G.

plot1_ac.mw

ps. One of the useful ideas behind having such a G procedure is that you can just call it with numeric arguments and get a single plot. That's easier to debug and figure out than is a whole Explore call. Focus on getting a/any good result from G. Then, when that works (at all!) try Explore.

Please check for mistakes. I may have misunderstood, and I wrote it quickly.

The basic idea is that if you can get at the allowed functions (of the Xi names) then you could freeze those function calls. The resulting (frozen) placeholder names might then be added to the set of Xi names and done altogether with the methodology for handling your first bullet point cases.

If you have some particular allowed "functions" in mind then you could adjust the typefunc
specification below, changing from name to something else (eg. identical(...), or other...)

restart;

 

H := proc(expr, S) local K,SS,temp;
  K := typefunc(identical(S[]),name);
  SS := freeze~(indets(expr, K)) union S;
  temp := subsindets(expr, K, freeze);
  ormap(s->type(expr, linear(s)), SS)
   and
  andmap(s->type(temp, And(polynom(anything,s),
                           satisfies(t->degree(t,s)<2))), SS);
end proc:

 

H( a*f(X1, X2)*g(X4) + b*X3*g(X4) + c*X1 + d*X1*X2,
   {X1,X2,X3,X4} );

true

H( a*b + c,
   {X1,X2,X3,X4} );

false

H( a*f(X1, X2)*g(X4)^2 + b*X3*g(X4) + c*X1 + d*X1*X2,
   {X1,X2,X3,X4} );

false

H( a*f(X1, X2)*g(X4) + b*X3^4*g(X4) + c*X1 + d*X1*X2,
   {X1,X2,X3,X4} );

false

H( a*f(X1, X2)*g(X4) + b*X3*g(X4) + c^2*X1 + d*X1*X2*X3*X4,
   {X1,X2,X3,X4} );

true

H( a*b*X3 + c^2*X1 + d*X1*X2*X3*X4,
   {X1,X2,X3,X4} );

true

H( a*b*X3^4 + c^2*X1 + d*X1*X2*X3*X4,
   {X1,X2,X3,X4} );

false

H( a*b + c^2*X1,
   {X1,X2,X3,X4} );

true

Download typefunc_ex.mw

restart;

kernelopts(version);

`Maple 2024.2, X86 64 LINUX, Oct 29 2024, Build ID 1872373`

A := module()
  local DEBUG_MSG::truefalse:=false;
  export work_proc:=proc(n::integer)
     print("My flag is ",DEBUG_MSG);
  end proc;
end module:

kernelopts(opaquemodules=false):

Grid:-Set(0,A:-work_proc,'A:-DEBUG_MSG');
Grid:-Run(0,A:-work_proc,[ 0 ]);
Grid:-Wait();

"My flag is ", false

A:-DEBUG_MSG := true:

Grid:-Set(0,A:-work_proc,'A:-DEBUG_MSG');
Grid:-Run(0,A:-work_proc,[ 0 ]);
Grid:-Wait();

"My flag is ", true


Download grid_set_module_local.mw

Yes, it is a bug.  If x is real then at least one of the pair is satisfied.

A developer might classify it as a "weakness".

I couldn't get it with a single is call and unrestricted real x (or equivalent) and the point is that ideally that would be possible.

restart;

S := cos(x) + sqrt(1-sin(x)^2) = 0, cos(x) - sqrt(1-sin(x)^2) = 0;

cos(x)+(1-sin(x)^2)^(1/2) = 0, cos(x)-(1-sin(x)^2)^(1/2) = 0

I wasn't able to merge these assumptions into a single `is` call (say, using
`Or`, including adding x::real, etc).

is(Or(S)) assuming cos(x)<=0;
is(Or(S)) assuming cos(x)>=0;

true

true

I also couldn't "merge" this pair (even with the abs converted to signum or piecewise).

is(Or(C + abs(C) = 0, C - abs(C) = 0)) assuming C>=0;
is(Or(C + abs(C) = 0, C - abs(C) = 0)) assuming C<=0;

true

true

Download is_trig_01.mw

You might guess that I have a hunch that an underlying problem is with combining such pairs, rather than just internal problems with trig handling...

A helping prod, that happens to work:

is(x*y*z = 0) assuming Or(x=0,z=0);

             true

I suppose that `solve` could be leveraged to get that Or() construction programmatically. Multiple results from solve can be taken as Or, and individual results within that can be taken as And (or just themselves if a singleton sequence).

I like nm's Answer.

In your Document, the expression assigned to Ghat contains a name-quoted minus symbol instead of just the infix minus.

That makes it a name, not the expected arithmetic operator. And the spaces around that name make the whole thing get interpreted (2D Input) as implicit multiplication.

It parses your form as,
   2*sqrt(2)*GAMMA(5/2)*`-`*(7*sqrt(2))/6*GAMMA(7/2)/(r^(5/2)*r^(7/2))

If I replace it with just the usual infix minus sign then it goes as expected.

restart

g := exp(-r*cosh(x))*x^(2*n); G := Int(g, x = 0 .. infinity)

Int(exp(-r*cosh(x))*x^(2*n), x = 0 .. infinity)

f0 := arccosh(1+y); df0 := diff(f0, y)

1/(y^(1/2)*(2+y)^(1/2))

f := f0^(2*n)*df0

arccosh(1+y)^(2*n)/(y^(1/2)*(2+y)^(1/2))

n := 2; series(f, y)

2*2^(1/2)*y^(3/2)-(7/6)*2^(1/2)*y^(5/2)+(47/80)*2^(1/2)*y^(7/2)-(17281/60480)*2^(1/2)*y^(9/2)+O(y^(11/2))

r := 6; evalf(G)

0.8560816424e-4

Ghat := exp(-r)*(2*sqrt(2)*GAMMA(5/2)/r^(5/2)-(7*sqrt(2)*(1/6))*GAMMA(7/2)/r^(7/2))

(109/20736)*exp(-6)*2^(1/2)*Pi^(1/2)*6^(1/2)

Ghat1 := evalf(Ghat)

0.8000187796e-4

NULL

Download asyapprox_ac.mw

Here I've used Maple 2022.2, since that's the version in which your attachment was last saved.

It can be simplified with just,

   simplify(B1,exp)

however below also I give a few minor variants on the final form (and checks on all results).

restart;

kernelopts(version);

`Maple 2022.2, X86 64 LINUX, Oct 23 2022, Build ID 1657361`

interface(showassumed=0):

assume(x::real);assume(t::real);assume(lambda1::complex);assume(b::real);

alias(psi1 = psi1(x,t), psi2 = psi2(x,t), phi1 = phi1(x,t), phi2 = phi2(x,t), beta = beta(t), alpha =alpha(t));

psi1, psi2, phi1, phi2, beta, alpha

rel := {psi1 = exp((-I*lambda1)*x - (1/(4*I*lambda1))*int((alpha + b*beta),t)), psi2 = exp((I*lambda1)*x + (1/(4*I*lambda1))*int((alpha + b*beta),t)), phi1= exp((-I*conjugate(lambda1))*x - (1/(4*I*conjugate(lambda1)))*int((alpha + b*beta),t)), phi2 = exp((I*conjugate(lambda1))*x + (1/(4*I*conjugate(lambda1)))*int((alpha + b*beta),t))}

{phi1 = exp(-I*conjugate(lambda1)*x+((1/4)*I)*(int(b*beta+alpha, t))/conjugate(lambda1)), phi2 = exp(I*conjugate(lambda1)*x-((1/4)*I)*(int(b*beta+alpha, t))/conjugate(lambda1)), psi1 = exp(-I*lambda1*x+((1/4)*I)*(int(b*beta+alpha, t))/lambda1), psi2 = exp(I*lambda1*x-((1/4)*I)*(int(b*beta+alpha, t))/lambda1)}

Bnum := psi2*phi1*conjugate(lambda1) + psi1*lambda1*phi2;

psi2*phi1*conjugate(lambda1)+psi1*lambda1*phi2

Bnumexp := subs(rel,Bnum):

Den := -phi1*psi2 - phi2*psi1;

-phi1*psi2-phi2*psi1

expDen := subs(rel, Den)

-exp(-I*conjugate(lambda1)*x+((1/4)*I)*(int(b*beta+alpha, t))/conjugate(lambda1))*exp(I*lambda1*x-((1/4)*I)*(int(b*beta+alpha, t))/lambda1)-exp(I*conjugate(lambda1)*x-((1/4)*I)*(int(b*beta+alpha, t))/conjugate(lambda1))*exp(-I*lambda1*x+((1/4)*I)*(int(b*beta+alpha, t))/lambda1)

sr := Bnumexp/expDen: ratiosr := simplify(diff(sr,t), complex):

B := b - (4*I/beta)*ratiosr

b+2*exp(((1/4)*I)*(4*lambda1^2*x-(int(b*beta+alpha, t)))/lambda1)*exp(((1/4)*I)*(4*conjugate(lambda1)^2*x-(int(b*beta+alpha, t)))/conjugate(lambda1))*(lambda1-conjugate(lambda1))^2*exp(-((1/4)*I)*(4*lambda1^2*x-(int(b*beta+alpha, t)))/lambda1)*(b*beta+alpha)*exp(-((1/4)*I)*(4*conjugate(lambda1)^2*x-(int(b*beta+alpha, t)))/conjugate(lambda1))/(beta*(exp(-((1/4)*I)*(4*conjugate(lambda1)^2*x-(int(b*beta+alpha, t)))/conjugate(lambda1))*exp(((1/4)*I)*(4*lambda1^2*x-(int(b*beta+alpha, t)))/lambda1)+exp(((1/4)*I)*(4*conjugate(lambda1)^2*x-(int(b*beta+alpha, t)))/conjugate(lambda1))*exp(-((1/4)*I)*(4*lambda1^2*x-(int(b*beta+alpha, t)))/lambda1))^2*lambda1*conjugate(lambda1))

p := {alpha = t^2, beta = exp(-t)}

{alpha = t^2, beta = exp(-t)}

B1 := eval(B, p);

b+2*exp(((1/4)*I)*(4*lambda1^2*x-(1/3)*t^3+b*exp(-t))/lambda1)*exp(((1/4)*I)*(4*conjugate(lambda1)^2*x-(1/3)*t^3+b*exp(-t))/conjugate(lambda1))*(lambda1-conjugate(lambda1))^2*exp(-((1/4)*I)*(4*lambda1^2*x-(1/3)*t^3+b*exp(-t))/lambda1)*(b*exp(-t)+t^2)*exp(-((1/4)*I)*(4*conjugate(lambda1)^2*x-(1/3)*t^3+b*exp(-t))/conjugate(lambda1))/(exp(-t)*(exp(-((1/4)*I)*(4*conjugate(lambda1)^2*x-(1/3)*t^3+b*exp(-t))/conjugate(lambda1))*exp(((1/4)*I)*(4*lambda1^2*x-(1/3)*t^3+b*exp(-t))/lambda1)+exp(((1/4)*I)*(4*conjugate(lambda1)^2*x-(1/3)*t^3+b*exp(-t))/conjugate(lambda1))*exp(-((1/4)*I)*(4*lambda1^2*x-(1/3)*t^3+b*exp(-t))/lambda1))^2*lambda1*conjugate(lambda1))

ans1 := simplify(B1,exp);
simplify(ans1-B1);

b+(1/2)*(b*exp(-t)+t^2)*(lambda1-conjugate(lambda1))^2*exp(t)/(conjugate(lambda1)*lambda1*cos((1/12)*(lambda1-conjugate(lambda1))*(-12*lambda1*x*conjugate(lambda1)-t^3+3*b*exp(-t))/(lambda1*conjugate(lambda1)))^2)

0

subsindets(ans1,`*`,u->combine(u,trig)):
ans2 := subsindets(%,trig,u->simplify(u));
simplify(ans2-B1);

b+(b*exp(-t)+t^2)*(lambda1-conjugate(lambda1))^2*exp(t)/(conjugate(lambda1)*lambda1*(cos((1/6)*(lambda1-conjugate(lambda1))*(-12*x*abs(lambda1)^2-t^3+3*b*exp(-t))/abs(lambda1)^2)+1))

0

subsindets(ans1,`*`,simplify);
simplify(simplify(%-B1));

b-2*Im(lambda1)^2*(t^2*exp(t)+b)/(cosh((1/6)*Im(lambda1)*(12*x*abs(lambda1)^2+t^3-3*b*exp(-t))/abs(lambda1)^2)^2*abs(lambda1)^2)

0

subsindets(ans2,`*`,simplify);
simplify(simplify(%-B1));

b-4*Im(lambda1)^2*(t^2*exp(t)+b)/((cosh((-(1/3)*t^3-4*x*abs(lambda1)^2+b*exp(-t))*Im(lambda1)/abs(lambda1)^2)+1)*abs(lambda1)^2)

0

NULL

Download simplify_3_ac.mw

Are you trying to say that previously unopened .mw files on your machine have changed, as saved files?

Or are you trying to say that when you now Open any .mw file (Document) that was previously untouched (as a file on your OS) that the GUI opens it wrongly, and alters the input lines as displayed.

If the latter, then are you also saying the uninstalling/reinstalling doesn't help? Are you sure that when uninstalling your personal GUI Preferences file is removed? It would usually be somewhere like this on MS-Windows:
    C:\Users\%USERNAME%\AppData\Roaming\Maple\2023\Maple.ini
If that's still present (on uninstallinging) then you might consider removing it prior to reinstallation.

(It seems weird, if a wholly clean install were now to show different behaviour when opening files that haven't been changed since before the problem started.)

Here are some fixes that allow the problematic sections 17.6, 17.9, and 17.10 to run in a newer version such as Maple 2018 or Maple 2024.

ch17_acc_2018.mw


The problems come in the following varieties:
i) Failure of plots:-spacecurve with operator-form calling sequence. Remedy is simple: since the operators return unevaluated when passed a name, replace the operator names (in the first argument triple) with those same names applied to `t`, and use t=range instead of just range. Or just use plots:-odeplot (which is usually better, btw), in its usual way. (I will submit a bug report; it broke in Maple 2016.)
ii) Use of bare name y alongside aliases to indexed names y[i] in section 17.9.
iii) Dubious recursive definition in loop in section 17.9,
    for i from 0 to e_order do   
        eta[i] := t -> eta[i](t)
    end do:

The whole alias/macro/defn business of that section is obfuscated.
iii) Repeated (chained) aliases in section 17.6, which is hokey.
iv) Access to casesplit results by location in the returned sequence, in section 17.10, which was fragile programming. Changed it to access by property of nontriviality does better, including in Maple 2024 whose casesplit result differs in form/nature from that of Maple 2018.
v) I also added a few normal/simplification/sort calls, to get some of the (mathematically) ok results to look&feel even more like in the "target" .mws file's output.

There is an example about this on the Help page for assuming. (It's the example about a procedure f).

The essence is that the usual assuming facility does not place assumptions on variables inside the procedure body, up front (which is how it works).

That page documents the following as an alternative, which leverages a revised mechanism that does what you are after:

restart

Physics:-Setup(assumingusesAssume = true)

[assumingusesAssume = true]

`&omega;__b` := proc (alpha) options operator, arrow; `&omega;__0`*sqrt(1+alpha+sqrt(alpha+alpha^2)) end proc

proc (alpha) options operator, arrow; omega__0*sqrt(1+alpha+sqrt(alpha+alpha^2)) end proc

`assuming`([limit(`&omega;__b`(alpha), alpha = infinity)], [`&omega;__0`::positive]) = infinityNULL

`assuming`([limit(`&omega;__b`(alpha), alpha = infinity)], [`&omega;__0` > 0]) = infinityNULL

NULL

Download assuming_ac.mw

Another way to handle your example is to first assign your procedure call to an expression, in which case the usual assuming mechanism "sees" the relevant variable name.

restart

`&omega;__b` := proc (alpha) options operator, arrow; `&omega;__0`*sqrt(1+alpha+sqrt(alpha+alpha^2)) end proc

proc (alpha) options operator, arrow; omega__0*sqrt(1+alpha+sqrt(alpha+alpha^2)) end proc

expr := `&omega;__b`(alpha)

omega__0*(1+alpha+(alpha^2+alpha)^(1/2))^(1/2)

`assuming`([limit(expr, alpha = infinity)], [`&omega;__0`::positive]) = infinityNULL

`assuming`([limit(expr, alpha = infinity)], [`&omega;__0` > 0]) = infinityNULL

NULL

Download assuming_acc.mw

Notice the difference, according to whether we assume m__1 is greater than or less than 0, or just real.

expr := sqrt(-(-m__1-m__2+sqrt(m__2*(m__1+m__2)))*`&omega;__0`^2/m__1)

(-(-m__1-m__2+(m__2*(m__1+m__2))^(1/2))*omega__0^2/m__1)^(1/2)

`assuming`([simplify(simplify(expr, {m__2/m__1 = alpha}))], [m__1 > 0])

(-omega__0^2*((alpha*(alpha+1))^(1/2)-alpha-1))^(1/2)

`assuming`([simplify(simplify(expr, {m__2/m__1 = alpha}))], [m__1 < 0])

(omega__0^2*((alpha*(alpha+1))^(1/2)+alpha+1))^(1/2)

`assuming`([simplify(simplify(expr, {m__2/m__1 = alpha}))], [m__1::real])

(-omega__0^2*(signum(m__1)*(alpha*(alpha+1))^(1/2)-alpha-1))^(1/2)

NULL

Download simplify_side_radical.mw

Here are a couple of ways to get such an effect.

restart

kernelopts(version)

`Maple 2022.2, X86 64 LINUX, Oct 23 2022, Build ID 1657361`

v := `<,>`(`<|>`(a), `<|>`(b))

Matrix(%id = 36893628100656344948)


Here I use . (a period) instead of  *

expr := cos(t*theta+phi).v

cos(t*theta+phi).Matrix(%id = 36893628100656344948)

I can turn it into the usual multiplication, programmatically.

eval(expr, `.` = `*`)

Matrix(%id = 36893628100656329420)

Since some commands can "simplify" the above expr
and distribute the multiplication across the Vector, this
might not be the best approach for you (if you intend on
doing symbolic computations with your expr as defined.
(So see next nethod, below.)

simplify(expr)

Matrix(%id = 36893628100656327724)


Here I use `%*` instead of   * , ie. the inert operator.

In 2D Input this cannot be used with infix syntax in Maple 2022.
So I use it in prefix form.

expr := `%*`(cos(t*theta+phi), v)

`%*`(cos(t*theta+phi), Matrix(%id = 36893628100656344948))

I can turn it into the usual multiplication, it two ways.

value(expr)

Matrix(%id = 36893628100656308940)

eval(expr, `%*` = `*`)

Matrix(%id = 36893628100656306164)

I can also display expr as if it had a usual
multiplication symbol, ie. not a lighter gray asterisk.

InertForm:-Display(expr, inert = false)

0, "%1 is not a command in the %2 package", _Hold, Typesetting

In 1D plaintext input I can enter it in infix form.

expr := cos(t*theta + phi) %* v;

`%*`(cos(t*theta+phi), Vector(2, {(1) = a, (2) = b}))

NULL

Download expr_inert_mult.mw

You could do,

   (u->FileTools:-ListDirectory(currentdir(),'all',select=u)[])~(["*.dvi","*.pdf"])

or,

   (u->FileTools:-ListDirectory(currentdir(),'all',select=u)[])~(L)

where L is your list of strings with wildcards.


ps. You don't need to right-quote the global name select, which is protected. If you're operating within a proc with a local by that name then use :-select. The usual story.

pps. I half expected to see something like select=".*\\.(dvi|pdf)$" work, as there is mention in the ListDirectory help-page of StringTools and its WildcardMatch, which in turn mentions RegMatch. This not so nice,
     select[2](StringTools:-RegMatch,".*\\.(dvi|pdf)$",FileTools:-ListDirectory("."))
and it's also more work to build up the pattern if there are many allowed extensions.

Your Question doesn't mention whether you mean the limits for the Java GUI, or for the kernel/engine (mservers) that do the computations. They have separate settings and options to control them.

See the Maple launch script options, and/or kernelopts Help page.

That launch script Help page unfortunately lacks mention of its -j option, for the Java GUI, which Rouben has mentioned. See also the kernelopts choices limitjvmheap and jvmheaplimit.

The launch script's -T option allows for specifying limits for the kernel/engine. See also the kernelopts choices datalimit and stacklimit.

You can also call simplify after calling solve. You could do each separately (with the assumptions), or nest the calls.

The empty brackets [] means that there is no solution for that case.

Also, you don't need to do the term cancellation stuff you asked about, to solve the inequality for Cv.

restart

kernelopts(version)

`Maple 2019.2, X86 64 LINUX, Nov 26 2019, Build ID 1435526`

ineq := -d*(Am-s1)/(2*Clm)-d*(Am*R0er*d^2-R0er*d^2*s1+Aer*Clm-Ce*Clm+Clm*Rer-Clm*l)/(2*Clm*(-R0er*d^2+Clr)) <= -d*(Am-Cv+Rm-s1-s2)/(-2*R0m*d^2+2*d^2*g1+2*Clm)-d*(Rer-Ce-l+Aer)/(-2*R0er*d^2+2*Clr)

ans1 := `assuming`([simplify(solve(ineq, Cv))], [d > 0, Am > 0, R0er > 0, Clm > 0, s1 > 0, Ce > 0, s2 > 0, Clr > 0, l > 0, g1 > 0, Aer > 0, Rer > 0])

piecewise(0 < -d/((2*R0m-2*g1)*d^2-2*Clm), [{((R0er*(Am+Rm-s1-s2)*Clm-Clr*(R0m-g1)*(Am-s1))*d^2-Clm*Clr*(Rm-s2))/((R0er*d^2-Clr)*Clm) <= Cv}], -d/((2*R0m-2*g1)*d^2-2*Clm) < 0, [{Cv <= ((R0er*(Am+Rm-s1-s2)*Clm-Clr*(R0m-g1)*(Am-s1))*d^2-Clm*Clr*(Rm-s2))/((R0er*d^2-Clr)*Clm)}], [])

Download Q_12_ac.mw

Why do you have a condition on g2?

If you wanted, you could also replace the final conditions in the piecewise answer. Eg, you could replace them after solving them for R0m. Eg,

`assuming`([expand(solve(0 < -d/((2*R0m-2*g1)*d^2-2*Clm), R0m))[]], [d > 0])

R0m < g1+Clm/d^2


Also, the name Ce only appears in an identical amount (ie, with the exact same coefficient, if collected) on both sides of your given inequality. So the given inequality doesn't provide any stipulation or restriction on Ce. Hence, trying to solve the inequality for Ce won't tell you anything about Ce.

First 8 9 10 11 12 13 14 Last Page 10 of 336