acer

32510 Reputation

29 Badges

20 years, 13 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

The OP has encountered a common usage difficulty for users new to Maple.

In summary,
i) Using unevaluation quotes to delay the evaluation of the first argument works here, but is not the best general solution. Yes, it works for this example. But I've seen this usage devolve into even murkier difficulties far too often.
ii) Using irem vs modp happens to work for this example (and can have better efficiency) but is not by itself the best general solution because many similar difficulties arise for problems having nothing to do with modp/irem.
iii) The add command is more appropriate that sum here. It's specifically designed to better and more more generally handle this kind of issue. Yes, it's unfortunate that the 2D Input Sigma symbol is hooked into sum rather than add. But the allure of the typeset Sigma notation doesn't generally make up for the shortfalls of using sum in such situations.
iv) Similar distinctions can arise with product vs mul.

Altogether,
    add(irem(5, mul(2, t = 0 .. irem(q - 1, 3))), q = 1 .. 2)

And now, for some details,

restart;

sum(modp(5, product(2, t = 0 .. modp(q - 1, 3))), q = 1 .. 2);

10

The following is being evaluated, in the sum call, before q gets
any actual numeric value.

This call is being prematurely evaluated.

modp(5, product(2, t = 0 .. modp(q - 1, 3)));
eval(%,q=1)+eval(%,q=2);

modp(5, 2^(q+3))

10

One alternative is to delay the evaluation of the first
argument to the sum call, using single right-ticks
(a.k.a. unevaluation quotes)

sum('modp(5, product(2, t = 0 .. modp(q - 1, 3)))', q = 1 .. 2);

2

You can also get by with this, for this example,

sum(modp(5, 'product(2, t = 0 .. modp(q - 1, 3))'), q = 1 .. 2);

2

Hence you can also get by with the following.
nb. This is not as general a workaround, since not all sum evaluation
problems involve the tasks of modp or irem.

sum(irem(5, product(2, t = 0 .. irem(q - 1, 3))), q = 1 .. 2);

2

The previous example worked because the following happens
to return unevaluated for unknown q.

irem(5, product(2, t = 0 .. irem(q - 1, 3)))

irem(5, 2^(irem(q-1, 3)+1))

A generally better approach here is to use the add command instead of
the sum command.

The add command has so-called special evaluation rules, which
delays the evaluation of is first argument until the summation
index q gets some actual numeric values.

add(modp(5, product(2, t = 0 .. modp(q - 1, 3))), q = 1 .. 2);

2

You can also do the following: use add instead of sum, mul instead of
product (for the same reasons), and irem for suitability to this
particular computation (as well as efficiency).

add(irem(5, mul(2, t = 0 .. irem(q - 1, 3))), q = 1 .. 2);

2

Download sum_add_eval.mw

This is a common issue for new Maple users. There are lots of examples of this kind of problem on this forum.

There are also several Help Pages devoted specifically to the issue: eg,
1) special evaluation rules
2) sum vs add

Does this work for you? (Check that it makes good sense. It's late in the day...)

restart;

ode := y(x)*diff(y(x),x)-y(x)=A*x+B;

y(x)*(diff(y(x), x))-y(x) = A*x+B

book_sol := y(x)=_C1*t*exp( - Int( t/(t^2-t-A),t));

y(x) = _C1*t*exp(-(Int(t/(t^2-A-t), t)))

eq := x=_C1*exp(  - Int( t/(t^2-t-A),t))-B/A;

x = _C1*exp(-(Int(t/(t^2-A-t), t)))-B/A

new := t=RootOf(subs(t=_Z,rhs(eq))-x,_Z);

t = RootOf(_C1*exp(-(Int(-_Z/(-_Z^2+A+_Z), _Z)))*A-A*x-B)

eval(book_sol,new);

y(x) = _C1*RootOf(_C1*exp(-(Int(-_Z/(-_Z^2+A+_Z), _Z)))*A-A*x-B)*exp(-Intat(_a/(_a^2-A-_a), _a = RootOf(_C1*exp(-(Int(-_Z/(-_Z^2+A+_Z), _Z)))*A-A*x-B)))

odetest(eval(book_sol,new), ode);

0

alt := simplify(eval(book_sol,new));

y(x) = RootOf(c__1*exp(Int(_Z/(-_Z^2+A+_Z), _Z))*A-A*x-B)*(A*x+B)/A

odetest(alt, ode);

0


Download how_to_verify_parametric_solution_to_ode_ac.mw

You have defined the substitution equation T1 as,

   T1 := u(x, t) = U(-t*v + x)*exp(k(t*w + x)*I)

where you are missing a multiplication symbol between the k and the opening bracket. That gives you a function call k(t*w + x) , ie. a call to unknown function k. When you then substitute into the derivative wrt t the chain rule applies, and you get D(k)(...) terms.

You may have intended, instead,

   T1 := u(x, t) = U(-t*v + x)*exp(k*(t*w + x)*I)

restart

with(PDEtools)

undeclare(prime, quiet)

declare(u(x, t), quiet); declare(U(xi), quiet); declare(V(xi), quiet)

pde := I*(diff(u(x, t), `$`(t, 2))-s^2*(diff(u(x, t), `$`(x, 2))))+(1/24)*c[1]*(diff(u(x, t), t, `$`(x, 4)))-alpha*s*c[1]*(diff(u(x, t), `$`(x, 5)))+diff(c[2]*u(x, t)*U(-t*v+x)^2+c[3]*u(x, t)*U(-t*v+x)^4+c[4]*u(x, t)*(diff(U(-t*v+x)^2, `$`(x, 2))), t)-beta*s*(diff(u(x, t), `$`(x, 5)))+diff(c[2]*u(x, t)*U(-t*v+x)^2+c[3]*u(x, t)*U(-t*v+x)^4+c[4]*u(x, t)*(diff(U(-t*v+x)^2, `$`(x, 2))), x)

G1 := U(-t*v+x) = U(xi); G2 := (D(U))(-t*v+x) = diff(U(xi), xi); G3 := ((D@@2)(U))(-t*v+x) = diff(U(xi), `$`(xi, 2)); G4 := ((D@@3)(U))(-t*v+x) = diff(U(xi), `$`(xi, 3)); G5 := ((D@@4)(U))(-t*v+x) = diff(U(xi), `$`(xi, 4)); G6 := ((D@@5)(U))(-t*v+x) = diff(U(xi), `$`(xi, 5))

T := xi = -t*v+x; T1 := u(x, t) = U(-t*v+x)*exp(I*k*(t*w+x))

u(x, t) = U(-t*v+x)*exp(I*k*(t*w+x))

P1 := I*(diff(u(x, t), `$`(t, 2))-s^2*(diff(u(x, t), `$`(x, 2))))+(1/24)*c[1]*(diff(u(x, t), t, `$`(x, 4)))-alpha*s*c[1]*(diff(u(x, t), `$`(x, 5)))+diff(c[2]*u(x, t)*U(-t*v+x)^2+c[3]*u(x, t)*U(-t*v+x)^4+c[4]*u(x, t)*(diff(U(-t*v+x)^2, `$`(x, 2))), t)-beta*s*(diff(u(x, t), `$`(x, 5)))+diff(c[2]*u(x, t)*U(-t*v+x)^2+c[3]*u(x, t)*U(-t*v+x)^4+c[4]*u(x, t)*(diff(U(-t*v+x)^2, `$`(x, 2))), x)

P11 := eval(P1, {T, T1})

P111 := subs({G1, G2, G3, G4, G5, G6}, P11)

pde1 := P111 = 0

numer(lhs(pde1))*denom(rhs(pde1)) = numer(rhs(pde1))*denom(lhs(pde1))

%/(-exp(I*k(t*w+x)))

exp(I*k*(t*w+x))*(-48*(diff(U(xi), xi))*k*s^2-120*c[3]*U(xi)^4*(diff(U(xi), xi))+48*(diff(U(xi), xi))^3*v*c[4]-72*c[2]*U(xi)^2*(diff(U(xi), xi))-48*U(xi)^2*(diff(diff(diff(U(xi), xi), xi), xi))*c[4]+24*(diff(diff(diff(diff(diff(U(xi), xi), xi), xi), xi), xi))*beta*s+(diff(diff(diff(diff(diff(U(xi), xi), xi), xi), xi), xi))*v*c[1]+(24*I)*(diff(diff(U(xi), xi), xi))*s^2-(24*I)*(diff(diff(U(xi), xi), xi))*v^2-240*(diff(diff(diff(U(xi), xi), xi), xi))*alpha*k^2*s*c[1]+192*(diff(diff(U(xi), xi), xi))*(diff(U(xi), xi))*U(xi)*v*c[4]-(24*I)*U(xi)^5*k*w*c[3]+(24*I)*U(xi)*beta*k^5*s-I*U(xi)*k^5*w*c[1]-(240*I)*(diff(diff(U(xi), xi), xi))*beta*k^3*s-(4*I)*(diff(diff(U(xi), xi), xi))*k^3*v*c[1]+(6*I)*(diff(diff(U(xi), xi), xi))*k^3*w*c[1]-(24*I)*U(xi)^3*k*w*c[2]-(48*I)*(diff(diff(U(xi), xi), xi))*U(xi)^2*k*c[4]-(48*I)*(diff(U(xi), xi))^2*U(xi)*k*c[4]+(120*I)*(diff(diff(diff(diff(U(xi), xi), xi), xi), xi))*beta*k*s+(4*I)*(diff(diff(diff(diff(U(xi), xi), xi), xi), xi))*k*v*c[1]-I*(diff(diff(diff(diff(U(xi), xi), xi), xi), xi))*k*w*c[1]-48*(diff(U(xi), xi))^3*c[4]+120*(diff(U(xi), xi))*alpha*k^4*s*c[1]+120*c[3]*U(xi)^4*(diff(U(xi), xi))*v+120*(diff(U(xi), xi))*beta*k^4*s+(diff(U(xi), xi))*k^4*v*c[1]-4*(diff(U(xi), xi))*k^4*w*c[1]-48*(diff(U(xi), xi))*k*v*w+72*c[2]*U(xi)^2*(diff(U(xi), xi))*v+48*U(xi)^2*(diff(diff(diff(U(xi), xi), xi), xi))*v*c[4]-240*(diff(diff(diff(U(xi), xi), xi), xi))*beta*k^2*s-6*(diff(diff(diff(U(xi), xi), xi), xi))*k^2*v*c[1]+4*(diff(diff(diff(U(xi), xi), xi), xi))*k^2*w*c[1]-192*(diff(diff(U(xi), xi), xi))*(diff(U(xi), xi))*U(xi)*c[4]+24*(diff(diff(diff(diff(diff(U(xi), xi), xi), xi), xi), xi))*alpha*s*c[1]-(24*I)*U(xi)^5*k*c[3]-(24*I)*U(xi)^3*k*c[2]-(24*I)*U(xi)*k^2*s^2+(24*I)*U(xi)*k^2*w^2+(24*I)*U(xi)*alpha*k^5*s*c[1]-(240*I)*(diff(diff(U(xi), xi), xi))*alpha*k^3*s*c[1]-(48*I)*(diff(diff(U(xi), xi), xi))*U(xi)^2*k*w*c[4]-(48*I)*(diff(U(xi), xi))^2*U(xi)*k*w*c[4]+(120*I)*(diff(diff(diff(diff(U(xi), xi), xi), xi), xi))*alpha*k*s*c[1])/exp(I*k(t*w+x)) = 0


Download tr_ac.mw

Is this something like you what you're after, without the fractions? (Below are two ways, for this example)

restart

with(PDEtools)

undeclare(prime, quiet)

declare(u(x, t), quiet); declare(U(xi), quiet); declare(V(xi), quiet)

RR := (2*v*(1/3)+2*alpha*beta*(1/3))*U(xi)^3+(-3*alpha*k^2*lambda-4*alpha^2*k-k^2*v+2*k^2*w-4*k*v*w)*U(xi)+(alpha*lambda+v)*(diff(diff(U(xi), xi), xi)) = 0

IM := -2*(diff(diff(U(xi), xi), xi))*v*k-2*U(xi)*k^2*w^2-2*(diff(diff(U(xi), xi), xi))*alpha^2+2*(diff(diff(U(xi), xi), xi))*v^2+(diff(diff(U(xi), xi), xi))*k*w+2*U(xi)^3*k*w-2*U(xi)^3*alpha*beta*k-3*(diff(diff(U(xi), xi), xi))*alpha*k*lambda-U(xi)*k^3*w+2*U(xi)*alpha^2*k^2+U(xi)*alpha*k^3*lambda = 0

collect(%, {U(xi), diff(diff(U(xi), xi), xi)})

P := %

C1 := v = solve(2*v*(1/3)+2*alpha*beta*(1/3) = 0, v)

C2 := k = solve(-3*alpha*k^2*lambda-4*alpha^2*k-k^2*v+2*k^2*w-4*k*v*w = 0, k)

C22 := subs(C1, C2)

C222 := k = -(4*(-alpha*beta*w+alpha^2))/(-alpha*beta+3*alpha*lambda-2*w)

ode := subs({C1, C222}, P)

temp := numer(lhs(ode))*denom(rhs(ode)) = numer(rhs(ode))*denom(lhs(ode))

temp2 := simplify(temp)

temp3 := temp2/(-64*alpha)

PP := numer(lhs(temp3))*denom(rhs(temp3)) = numer(rhs(temp3))*denom(lhs(temp3))

expr := collect(PP, {U(xi), diff(U(xi), xi), diff(diff(U(xi), xi), xi)})

(-4*alpha^3*beta^4*w+24*alpha^3*beta^3*lambda*w-36*alpha^3*beta^2*lambda^2*w+4*alpha^4*beta^3-24*alpha^4*beta^2*lambda+36*alpha^4*beta*lambda^2-12*alpha^2*beta^3*w^2+24*alpha^2*beta^2*lambda*w^2+36*alpha^2*beta*lambda^2*w^2+12*alpha^3*beta^2*w-24*alpha^3*beta*lambda*w-36*alpha^3*lambda^2*w-48*alpha*beta*lambda*w^3+48*alpha^2*lambda*w^2+16*beta*w^4-16*alpha*w^3)*U(xi)^3+(32*alpha^3*beta^3*lambda*w^3-16*alpha^4*beta^3*w^2-48*alpha^4*beta^2*lambda*w^2-16*alpha^2*beta^3*w^4-48*alpha^2*beta^2*lambda*w^4+32*alpha^5*beta^2*w+32*alpha^3*beta^2*w^3+96*alpha^3*beta*lambda*w^3+32*alpha*beta^2*w^5-16*alpha^6*beta+16*alpha^6*lambda-16*alpha^4*beta*w^2-48*alpha^4*lambda*w^2-64*alpha^2*beta*w^4+32*alpha^3*w^3)*U(xi)+(-alpha^4*beta^5+9*alpha^4*beta^4*lambda-27*alpha^4*beta^3*lambda^2+27*alpha^4*beta^2*lambda^3-2*alpha^3*beta^4*w+6*alpha^3*beta^3*lambda*w+18*alpha^3*beta^2*lambda^2*w-54*alpha^3*beta*lambda^3*w-3*alpha^4*beta^3+21*alpha^4*beta^2*lambda-45*alpha^4*beta*lambda^2+27*alpha^4*lambda^3+6*alpha^2*beta^3*w^2-48*alpha^2*beta^2*lambda*w^2+90*alpha^2*beta*lambda^2*w^2-12*alpha^3*beta^2*w+48*alpha^3*beta*lambda*w-36*alpha^3*lambda^2*w+16*alpha*beta^2*w^3-48*alpha*beta*lambda*w^3-12*alpha^2*beta*w^2+12*alpha^2*lambda*w^2+8*beta*w^4)*(diff(diff(U(xi), xi), xi)) = 0

I suppose that you don't want the fractions in this result from simplify

ans0 := collect(PP, {U(xi), diff(U(xi), xi), diff(diff(U(xi), xi), xi)}, simplify)

16*(-alpha*beta+w)*((1/2)*(beta-3*lambda)*alpha+w)^2*(beta*w-alpha)*U(xi)^3+32*((1/2)*(-beta+lambda)*alpha^3+w*beta*alpha^2*lambda-(1/2)*w^2*(beta+3*lambda)*alpha+w^3)*alpha*(beta*w-alpha)^2*U(xi)+8*((1/2)*(-beta^3+3*beta^2*lambda-3*beta+3*lambda)*alpha^2+w*beta*(beta-3*lambda)*alpha+beta*w^2)*((1/2)*(beta-3*lambda)*alpha+w)^2*(diff(diff(U(xi), xi), xi)) = 0

alt1 := collect(PP, [U(xi), diff(U(xi), xi), diff(diff(U(xi), xi), xi)], factor)

4*(alpha*beta-w)*(alpha*beta-3*alpha*lambda+2*w)^2*(-beta*w+alpha)*U(xi)^3-16*(-2*alpha^2*beta*lambda*w+alpha^3*beta-alpha^3*lambda+alpha*beta*w^2+3*alpha*lambda*w^2-2*w^3)*alpha*(-beta*w+alpha)^2*U(xi)-(alpha^2*beta^3-3*alpha^2*beta^2*lambda-2*alpha*beta^2*w+6*alpha*beta*lambda*w+3*alpha^2*beta-3*alpha^2*lambda-2*beta*w^2)*(alpha*beta-3*alpha*lambda+2*w)^2*(diff(diff(U(xi), xi), xi)) = 0

simplify(PP-alt1)

0 = 0

alt2 := eval(collect(expr, [U(xi), diff(U(xi), xi), diff(diff(U(xi), xi), xi)], proc (u) options operator, arrow; subsindets(simplify(u), And(`+`, satisfies(proc (uu) options operator, arrow; type(denom(uu), {integer, `&*`(integer, specfunc(__K))}) end proc)), proc (uu) options operator, arrow; map(`*`, uu, denom(uu))/__K(denom(uu)) end proc) end proc), __K = (proc (u) options operator, arrow; u end proc))

4*(-alpha*beta+w)*((beta-3*lambda)*alpha+2*w)^2*(beta*w-alpha)*U(xi)^3+16*((-beta+lambda)*alpha^3+2*w*beta*alpha^2*lambda-w^2*(beta+3*lambda)*alpha+2*w^3)*alpha*(beta*w-alpha)^2*U(xi)+((-beta^3+3*beta^2*lambda-3*beta+3*lambda)*alpha^2+2*w*beta*(beta-3*lambda)*alpha+2*beta*w^2)*((beta-3*lambda)*alpha+2*w)^2*(diff(diff(U(xi), xi), xi)) = 0

simplify(PP-alt2)

0 = 0


Download B-R_ac.mw

> restart;
> kernelopts(version);
   Maple 2025.0, X86 64 LINUX, Mar 24 2025, Build ID 1909157

> A := -x*(x - 4*exp(x/2) + 2):
> B := x*sqrt((-8*x - 16)*exp(x/2) + x^2 + 4*x + 16*exp(x) + 4):

> simplify(simplify(A-B, {exp(x)=exp(x/2)^2})) assuming x::real;

                    0

Another way to forcibly attack the issue,

restart;

kernelopts(version);

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

A := (-8*x - 16)*exp(x/2) + x^2 + 4*x + 16*exp(x) + 4;

(-8*x-16)*exp((1/2)*x)+x^2+4*x+16*exp(x)+4

simplify(A, {exp(x)=exp(x/2)^2});

(x-4*exp((1/2)*x)+2)^2

Download nm_simp_exA.mw

Naturally, many such temporary replacements may be constructed in an ad hoc manner. How well the system might be taught to do it automagically, I don't know.

restart;


The following canonicalization happens during the
automatic simplification stage, and so cannot be prevented
using unevaluation quotes.

'n>m';

m < n

But, an inert form will do.

G := InertForm:-Display(`%>`(n, m), 'inert'=false);

Typesetting:-mcomplete(Typesetting:-mrow(Typesetting:-mi("n"), Typesetting:-mo("&gt;"), Typesetting:-mi("m")), Typesetting:-_Hold([`%>`(n, m)]))

latex(G, output=string);

"n >m "


You could also easily write a reusable procedure/operator
to construct the above, for other arguments.

And, there are other ways. Eg,

H := `#mrow(mi("n"),mo("&gt;"),mi("m"));`;

`#mrow(mi("n"),mo("&gt;"),mi("m"));`

latex(H, output=string);

"n >m"

Download inert_gt_latex.mw

You posited, "It seems Maple like to make everything  based on "<" internally and that is why it reverses it?". Yes.

You can easily form a similar rule to sustitute in the reciprocals. And you could also use both within the single subs call, to avoid having to distinguish which is present (or even if both are present).

restart

PDEtools:-undeclare(prime)

`There is no more prime differentiation variable; all derivatives will be displayed as indexed functions`

S := (diff(G(xi), xi))^2-r^2*G(xi)^2*(a+b*G(xi)+l*G(xi)^2) = 0

(diff(G(xi), xi))^2-r^2*G(xi)^2*(a+b*G(xi)+l*G(xi)^2) = 0

SS := diff(G(xi), xi) = sqrt(r^2*G(xi)^2*(a+b*G(xi)+l*G(xi)^2))

diff(G(xi), xi) = (r^2*G(xi)^2*(a+b*G(xi)+l*G(xi)^2))^(1/2)

Se := sqrt(r^2*G(xi)^2*(a+b*G(xi)+l*G(xi)^2)) = diff(G(xi), xi)

(r^2*G(xi)^2*(a+b*G(xi)+l*G(xi)^2))^(1/2) = diff(G(xi), xi)

Se2 := map(proc (u) options operator, arrow; 1/u end proc, Se)

1/(r^2*G(xi)^2*(a+b*G(xi)+l*G(xi)^2))^(1/2) = 1/(diff(G(xi), xi))

dub := diff(SS, xi)

diff(diff(G(xi), xi), xi) = (1/2)*(2*r^2*G(xi)*(a+b*G(xi)+l*G(xi)^2)*(diff(G(xi), xi))+r^2*G(xi)^2*(b*(diff(G(xi), xi))+2*l*G(xi)*(diff(G(xi), xi))))/(r^2*G(xi)^2*(a+b*G(xi)+l*G(xi)^2))^(1/2)

Dubl2 := simplify(dub)

diff(diff(G(xi), xi), xi) = (1/2)*r^2*G(xi)*(diff(G(xi), xi))*(4*l*G(xi)^2+3*b*G(xi)+2*a)/(r^2*G(xi)^2*(a+b*G(xi)+l*G(xi)^2))^(1/2)

subs(Se2, Dubl2)

diff(diff(G(xi), xi), xi) = (1/2)*r^2*G(xi)*(4*l*G(xi)^2+3*b*G(xi)+2*a)

You can supply both, so you don't need to figure
out which applies.

subs(Se, Se2, Dubl2)

diff(diff(G(xi), xi), xi) = (1/2)*r^2*G(xi)*(4*l*G(xi)^2+3*b*G(xi)+2*a)

eval(Dubl2, [Se, Se2])

diff(diff(G(xi), xi), xi) = (1/2)*r^2*G(xi)*(4*l*G(xi)^2+3*b*G(xi)+2*a)

For fun, frontend'd simplify-with-side-relations

frontend(simplify, [Dubl2, {Se}], [{`*`, `+`, `=`, set}, {}])

diff(diff(G(xi), xi), xi) = (1/2)*r^2*G(xi)*(4*l*G(xi)^2+3*b*G(xi)+2*a)

Download subs_ac.mw

One fault seems to be that the derivativedivides method fails for integrand_2, while it succeeds (and produces that simpler result) for integrand_1.

A second fault is that int returns the result with ln and I=sqrt(-1) (which can obtain from the risch method) for integrand_2 instead of returning the better result from the orering method. The orering method's result is longer, but doesn't contain I or ln, and can be simplified directly to the short result using merely the normal command.

restart;

kernelopts(version);

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

integrand_1:=x^2*(-arctan(x) + x)*exp(-arctan(x) + x)/(x^2 + 1);

x^2*(-arctan(x)+x)*exp(-arctan(x)+x)/(x^2+1)

int(integrand_1,x,method=DDivides);

(-arctan(x)+x)*exp(-arctan(x)+x)-exp(-arctan(x)+x)

integrand_2:=evala(integrand_1);

-x^2*(arctan(x)-x)*exp(-arctan(x)+x)/(x^2+1)

int(integrand_2,x,method=DDivides);

int(-x^2*(arctan(x)-x)*exp(-arctan(x)+x)/(x^2+1), x, method = DDivides)

normal( int(integrand_2,x,method=orering) );

-(arctan(x)-x+1)*exp(-arctan(x)+x)

anti_2:=int(integrand_2,x); # from Risch method it seems

-(1-x+((1/2)*I)*ln(1-I*x)-((1/2)*I)*ln(1+I*x))*(1-I*x)^(-(1/2)*I)*(1+I*x)^((1/2)*I)*exp(x)

simplify(evalc(diff(anti_2,x)-integrand_2)); # check, for x::real at least

0

simplify(combine(evalc(anti_2)));

(-arctan(x)+x-1)*exp(-arctan(x)+x)


Download int_weakness_02.mw

There are at least two parts to this Question.

1) Your evalf (at default Digits=10 working precision) does not produce 10 accurate
digits of an apprximation of the second exact root obtained by solve. Substituting
the poor root approximation happens to also produce zero in the denominator.
But substituting a more accurate approximation happens not to.

2) Your plotting problem is the same as in one of your earlier Questions from today. (This site has faulty inlined display of the worksheet below, but my actual worksheet contains the adaptive=true and smartview=false options.)
 

restart

S := [solve(x^2/(10^(-8)-x) = 5*10^(-3))]

[-1/400-(3/200000)*27778^(1/2), -1/400+(3/200000)*27778^(1/2)]

evala(eval(x^2/(10^(-8)-x), x = S[1]))

1/200

evala(eval(x^2/(10^(-8)-x), x = S[2]))

1/200


This is not an accurate approximation of S.
It is not accurate to Digits=10 decimal places.

evalf[10](S)

[-0.5000010000e-2, 0.10000e-7]


This is a better approximation.

evalf[20](S)

[-0.50000099999800000800e-2, 0.99999800000800e-8]

eval(x^2/(10^(-8)-x) = 5*10^(-3), x = 9.999980000*10^(-9))

0.4999980000e-2 = 1/200

f := proc (x) options operator, arrow; x^2/(1/100000000-x) end proc = proc (x) options operator, arrow; x^2/(1/100000000-x) end proc 

plot(f, .99999*10^(-8) .. .999999*10^(-8), smartview = false)

plot(f, .99999*10^(-8) .. .999999*10^(-8), smartview = false, adaptive = true)

NULL

Download plotq_ac.mw

The small imaginary components of your result can be seen to be an artefect of solving a cubic in terms of radicals, and then computing as a floating-point approximation (in which case the small imaginary artefacts don't vanish due to floating-point concerns -- roundoff error, loss or precision, etc).

You can read about the notion that the purely real roots of some cubics may not be expressible in terms of radicals without the "I" (ie. sqrt(-1)) being present. But a reformulation in terms of trig expressions can get a form in which "I" does not appear, and for which floating-point evaluation produces no such small imarginary artefacts.

restart

S := [solve((x^2-10^(-14))/(10^(-3)-x+10^(-14)/x) = 5*10^(-3), x)]

evalf(S)

[0.854101976e-3-0.4e-11*I, -0.5854101969e-2-0.465063510e-12*I, -0.9e-11+0.3865063510e-11*I]


Increasing the working precision makes the float approaximation
of S have even smaller (artefacts of) imaginary components.

evalf[20](S)

[0.8541019764671763721e-3-0.4e-21*I, -0.58541019664671764921e-2-0.12310889132455352635e-21*I, -0.99999998801e-11+0.48310889132455352635e-21*I]

evalc(S)

[(1/15000000)*4000000003^(1/2)*sin((1/3)*arctan((3/237499999550000)*843750039749999989500000003^(1/2))+(1/6)*Pi)-1/600, -(1/30000000)*4000000003^(1/2)*sin((1/3)*arctan((3/237499999550000)*843750039749999989500000003^(1/2))+(1/6)*Pi)-1/600-(1/30000000)*3^(1/2)*4000000003^(1/2)*cos((1/3)*arctan((3/237499999550000)*843750039749999989500000003^(1/2))+(1/6)*Pi), -(1/30000000)*4000000003^(1/2)*sin((1/3)*arctan((3/237499999550000)*843750039749999989500000003^(1/2))+(1/6)*Pi)-1/600+(1/30000000)*3^(1/2)*4000000003^(1/2)*cos((1/3)*arctan((3/237499999550000)*843750039749999989500000003^(1/2))+(1/6)*Pi)]

evalf(evalc(S))

[0.854101977e-3, -0.5854101968e-2, -0.10e-10]

eq := (x^2-10^(-14))/(10^(-3)-x+10^(-14)/x) = 5*10^(-3)

(x^2-1/100000000000000)/(1/1000-x+(1/100000000000000)/x) = 1/200


A lovely cubic, whose roots correspond to S above.

ee := numer((lhs-rhs)(eq))

-20000000000000000*x^3-100000000000000*x^2+100000000200*x+1


Better than evalf(...(solve(...)...) is to use fsolve on the cubic.

fsolve(ee)

-0.5854101966e-2, -0.9999999880e-11, 0.8541019765e-3

evalf(solve(ee))

0.854101976e-3-0.4e-11*I, -0.5854101969e-2-0.465063510e-12*I, -0.9e-11+0.3865063510e-11*I

NULL

Download concentrations_ac.mw

I marked your Question to be Product=Maple 2022, since that's the version in which your attachment was last saved. It'd be more helpful if you could mark the Product version yourself, for future Questions.

In Maple 2022 your examples are running into issues with the (then new) adaptive=geometric default, and/or the default smartview=true option. Some improvement might be had automatically in the newer Maple 2025.

Each of your examples can be forced to comply (in versions M2022 to M2025) by adjusting those options:

restart

plots:-setoptions(thickness = 3)

kernelopts(version)

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

plot(-log[10](0.1e-3+x), x = 0 .. 10, adaptive = true, smartview = false)

x := -0.2550000000e-2+0.5000000000e-4*sqrt(2601.+(2.000000000*10^6)*C__i)

-0.2550000000e-2+0.5000000000e-4*(2601.+2000000.000*C__i)^(1/2)

plot(-log[10](0.1e-3+x), C__i = 0 .. 10, adaptive = true, smartview = false)

I want to see the plot being 4 at C__i = 0.

 

Note that subs({C__i = 0}, x) = 0. and evalf(subs({C__i = 0}, -log[10](0.1e-3+x))) = 4.000000000 

NULL

plot(-log[10](0.1e-3+x), C__i = 0 .. 1, smartview = false, adaptive = true)

plot(-log[10](0.1e-3+x), C__i = 0 .. 1, view = [0 .. 1, 1 .. 4], adaptive = true)

plot(-log[10](0.1e-3+x), C__i = 0 .. 1, view = [0 .. .1, 1 .. 4], adaptive = true)

NULL

Download plotatzero_ac.mw

You asked how to set the Output display to "Maple Output". But that's not the right value for the setting.

From the menubar, you can set it as,

    Tools -> Options -> Display -> Output display -> 2-D Math

where the drop-menu item would be "2-D Math" instead of "Maple Notation".

Then close the popup dialogue with the "Apply Globally" button.


ps. I too have seen this setting get undone, in rare cases. I sometimes wonder whether it can go awry because there is also a programmatic interface(prettyprint) access to it.

Does your code function as you expect if instead you have that as,

   Object('A':-foo_type)

In Maple 2024, under Tools->Options from the menubar, you could do the following:

1) Choose the tab "Interface", and inside that toggle the drop-menu for,
      Default format for new worksheets
to Worksheet (ie. not Document).

2) Choose the "Display" tab, and inside that toggle the drop-menu for,
      Input display
to Maple Notation (ie. not 2-D Math)

Then close the pop-up Options window by clicking on the button "Apply Globally". That should then make this the default, ie. even if you fully close and relaunch the Maple GUI.

The effect of these, together, is that your inputs will be in red plaintext, ie. Maple Notation mode -- with the red chevron -- in Execution Groups (just like Maple 8 and earlier). It won't be black, marked up 2-D Input math mode in Document Blocks.

This is the prescribed way to get such changes. You don't need any special Style Set or such, to get the red color for plaintext Maple Notation input code.

You could also look at the Help page for topic documentsvsworksheets

Hopefully I haven't guessed wrongly about what you're trying to accomplish.

4 5 6 7 8 9 10 Last Page 6 of 337