acer

31495 Reputation

29 Badges

19 years, 140 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

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]

`ω__b` := proc (alpha) options operator, arrow; `ω__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(`ω__b`(alpha), alpha = infinity)], [`ω__0`::positive]) = infinityNULL

`assuming`([limit(`ω__b`(alpha), alpha = infinity)], [`ω__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

`ω__b` := proc (alpha) options operator, arrow; `ω__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 := `ω__b`(alpha)

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

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

`assuming`([limit(expr, alpha = infinity)], [`ω__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)))*`ω__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.

@vv I can't see your response at the moment. But I notice that the following seem equal:

LinearAlgebra:-CharacteristicPolynomial(A,x);
evala(expand(mul(x-rr,rr=evstheory)));

It seems to me that the primary issue here is obtaining the maximum for (only piecewise continuous) Mprof for arbitray tau0 values in your range.

The next issues seem to be doing so reasonably efficiently. And then producing nice individual plots woul be next. And then showing the multiple plots that happen to be on quite different scales would be next.

And mixed in there is the issue of whether delta is always equal to 1 at the optima. I'm deliberately not going to simplify to the methodology for such a case, since you may want to modify your formula/conditions so that no longer holds.

In comparison to all that, merely combining multiple plots or array data seems straightfoward in comparison.

Here are some ideas. I've used Maple 2019, as you did. One of the variants uses 3rd party add-on DirectSearch as fallback.

trial_question_acc.mw

And here's an Mprof plot.

@salim-barzani You need to use the appropriate Maple commands to get your plots.

Here are some examples. You could read the Help Pages for those commands, to adjust the coloring, etc.

You could even provide an actual explanation (in words) of what precisely you want, in terms of color, shading, etc.

graph-density-countour_ac.mw

That produces,

Here are some ways, to get you started.

Input_question_ac.mw

times := [-2.019619977*Unit('s'), 2.019619977*Unit('s'),
          17.019619977*Unit('s'), -11.019619977*Unit('s')];

[-2.019619977*Units:-Unit(s), 2.019619977*Units:-Unit(s), 17.019619977*Units:-Unit(s), -11.019619977*Units:-Unit(s)]

select(u->convert(u,unit_free)>0, times);

[2.019619977*Units:-Unit(s), 17.019619977*Units:-Unit(s)]

%[];

2.019619977*Units:-Unit(s), 17.019619977*Units:-Unit(s)

Download units_select.mw

number := 1;
Var2 := "b";

1

"b"

Using %s to denote a string for the second replacement.
I'd guess that this is like your goal here.

sprintf("file(%a)_%s",number,Var2);

"file(1)_b"

lprint(%);

file(1)_b

Using %a to denote a general algebraic quantity for the
second replacement.

This places the string value of Var2 literally inside the
result string (including the quotes, escaped). This might
not be what you want here.

sprintf("file(%a)_%a",number,Var2);

"file(1)_"b""

lprint(%);

file(1)_\"b\"


Download sprintf_1.mw

As worded, your query seems to be about the sprintf command, and the construction of the filename string to be assigned to fname by using multiple assigned names, rather than about the save command.

See also the Help page for sprintf, for explanation of the modifiers %a, %s, etc. (Apart from its ability to handle symbolic expressions, that Maple command is much like the C language command of the same name. You can find similar commands in C++, R, Matlab, etc.)

However, if you ever do have multiple assigned names (eg. A,C,F) that you wish to save to the .m file then you could pass them as follows,

   save A,C,F fname;

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