acer

32490 Reputation

29 Badges

20 years, 8 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

restart;

kernelopts(version);

`Maple 2015.2, X86 64 LINUX, Dec 20 2015, Build ID 1097895`

expr := %surd(a*%surd(a*'`^`'(a,b),2),c):

InertForm:-Display(eval(expr,1), inert=true);

%surd(a*%surd(a*a^b, 2), c)

new := subs([a=2,b=6,c=4], eval(expr,1)):

InertForm:-Display(eval(new,1), inert=true);

%surd(2*%surd(2*2^6, 2), 4)

value(new);

2*2^(1/8)

 

Download inertsurdmaple2015.mw

(The above produces the same 2D Output in Maple 2018.0 I believe.)

@student_md Please do not post duplicates of this Question.

Please add the details of additional examples in this thread instead.

Please do not inline .pdf copies of papers for which you do not own the copyright. Use the link (URL) button in the editor instead.

I have previously sent you a message about this.

@mmcdara 

As Carl noted in the Post, "Maple's dsolve(..., numeric) allows symbolic input parameters for IVPs but not BVPs." For BVPs, separate calls to dsolve are needed to handle separate sets of parameter values. That may still leave the possibility of using Grid on separate dsolve BVP calls, depending on the goal.

(Slightly related to your comments on using dsolve with parameters for efficiency, in case you're interested: an old post about making animations of IVP solutions.)

@mmcdara If you're interested in details: Statistics is going through ExprectedValue to Moment. In Maple 2017.3 this worked:

c := (exp(1.2*t) - exp(.9*t))/t/.3:
coeftayl(c, t=0, 1);
                     1.050000000

But in Maple 2018.0 that fails.

c := (exp(1.2*t) - exp(.9*t))/t/.3:
coeftayl(c, t=0, 1);
Error, (in coeftayl) the expression does not have a taylor expansion at t = 0

That comes from calling normal on the derivative, and then failing in taking the limit.

c := (exp(1.2*t) - exp(.9*t))/t/.3:
cd := diff(c, t):
limit(cd, t=0);
                   1.050000000

cdn := normal(cd):
limit(cdn, t=0);
                 Float(undefined)

The issue with coeftayl could be fixed. But Statistics might even avoid that altogether by recognizing the special case.

The following example works in Maple 2017.3 (and back at least as far as Maple 16.02), but generates this error starting with Maple 2018.0 .

with(Statistics):
Q:=RandomVariable(Uniform(0.9, 1.2)):
Mean(1/2*Q);
Error, (in Statistics:-Mean) the expression does not have a taylor expansion at t = 0

There are several easy workarounds.

I've submitted a bug report.

@David1 The Optimization package in Maple is primarily a collection of local optimizers.

There is no numeric global optimization program in the world that "guarantees" a global optimum for any general nonconvex problem. (edit: That is a general issue of mathematical computing, and is not Maple-specific.)

But if you want to do numeric global optimization of multivariate nonconvex problems in Maple then your best bet might be the 3rd party downloadable DirectSearch package (v.2).  If your Maple version is at least 2018 then you could install its package directly from within Maple (via the login to the Maplecloud).

@Kitonum The OP didn't both to give the URL. I added it.

@itsme I have no idea what the Standard GUI is doing with interface options, other than what I can infer by experiment.

@Ahmed111 With the name d assigned the determinant of that Matrix, I just looked at the typeset 2D Math output of the following statement in my Maple 2018, and observed the common subexpressions I used for R1,..,R4.

simplify(simplify(collect(d,[rho,chi],u->simplify(u,size))),size);

And then I cut & pasted.

But if you are interested in common subexpressions, for the purpose of easier viewing or greater insight into the structure of your expression, then you might consider using an older output labelling mechanism. (I do not mean the equation labelling that one can see along the right edge of a worksheet. I mean an older mechanism, for prettyprint=1, that represents common subexpressions and makes output terse.)

For this current example it just so happens that the default "maximal label expression size" allows for automatic labelling of exactly the particular common subexpressions I used above (originally, by cut&paste) for R1 and R2. So below I happen to be able to construct that R1 and R2 programatically, which I find neat.

restart;

kernelopts(version);

`Maple 2018.0, X86 64 LINUX, Mar 9 2018, Build ID 1298750`

A := Matrix([[phi,conjugate(psi),chi,conjugate(rho)],
            [psi,-conjugate(phi),rho,-conjugate(chi)],
            [lambda1*phi,conjugate(lambda1)*conjugate(psi),
             lambda2*chi,conjugate(lambda2)*conjugate(rho)],
            [lambda1*psi,-conjugate(lambda1)*conjugate(phi),
             lambda2*rho,-conjugate(lambda2)*conjugate(chi)]]):

d := LinearAlgebra:-Determinant(A):

interface(prettyprint=1):

temp := simplify(simplify(collect(d,[rho,chi],u->simplify(u,size))),size);

             /          2        2     \      2        2           2   
     temp := \(%1) |phi|  + |psi|  (%2)/ |chi|  + |rho|  (%2) |phi|    
                                                                       
               2           2                                           
        + |rho|  (%1) |psi|                                            
                                                                       
                                                                       
                                    /    ___ ___       ___         ___\
        - 4 Im(lambda1) Im(lambda2) \chi phi rho psi + psi phi rho chi/
                                                                       
                    2            2           _______           _______
     %1 := |lambda1|  + |lambda2|  - lambda2 lambda1 - lambda1 lambda2
                    2            2   _______ _______                   
     %2 := |lambda1|  + |lambda2|  - lambda2 lambda1 - lambda1 lambda2

R1 := %1 = K1;

                  2            2           _______           _______     
   R1 := |lambda1|  + |lambda2|  - lambda2 lambda1 - lambda1 lambda2 = K1

R2 := %2 = K2;

                  2            2   _______ _______                       
   R2 := |lambda1|  + |lambda2|  - lambda2 lambda1 - lambda1 lambda2 = K2

interface(prettyprint=3):

subs([R1,R2], temp);

(K1*abs(phi)^2+abs(psi)^2*K2)*abs(chi)^2+abs(rho)^2*K2*abs(phi)^2+abs(rho)^2*K1*abs(psi)^2-4*Im(lambda1)*Im(lambda2)*(chi*conjugate(phi)*conjugate(rho)*psi+conjugate(psi)*phi*rho*conjugate(chi))

 

Download some_labelling.mw

I think that the automatic labelling of common subexpressions was one of the best features of the old Classic GUI. It's a great loss that the newer Standard Java GUI doesn't have it for typeset 2D Output and enabled by default (and with as clever an automatic mechanism as Classic had for deciding on the labels by size). The loss is made even more severe since one of the greatest instabilities remaining in the Standard GUI is in it locking up when trying to render very large expressions close to the default length-limit. There are a lot of examples where the common subexpression labelling mechanism can greatly reduce the total output display.

@itsme Thanks.

I suppose one might also replace the conjugate(K3)+K3 by 2*Re(K3) , but maybe we're already in territory where beauty is in the eye of the beholder.

@vv Yes, I was wondering whether a fortuitous Change and Split might allow resolution of the `abs`, which might make it more tractable.

@mschneider Let me know if this handles at least some of your other problematic examples.

restart;

 

p:=module()
  local ModuleApply, K, L;
  ModuleApply:=proc(s::string)
  local new, r, t;
  t := InertForm:-Parse(s);
  r := map(n->n='K'(n),indets(t,And(name,satisfies(nn->depends(t,nn)))));
  new := InertForm:-Value(eval(subs(r, t)));
  new := subsindets(new,`*`,u->frontend(expand,[numer(u)])/denom(u));
  subsindets(new, specfunc(anything,{entries(L,':-nolist')}), op);
  end proc;
  K:=proc(n)
    local sym;
    sym:=:-`tools/genglobal`(U);
    L[sym]:=sym;
    sym(n);
  end proc
end module:

 

response := "(x+3)*(x-1)/(x-1)";

"(x+3)*(x-1)/(x-1)"

p(response);

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

normal(%);

x+3

response := "(x+3)*(x-1)/(x-1) + sin((x+3)*(x-1)^(3/2)/(x-1)^(3/2)) + sqrt((y+3)*(y-1)/(y-1))";

"(x+3)*(x-1)/(x-1) + sin((x+3)*(x-1)^(3/2)/(x-1)^(3/2)) + sqrt((y+3)*(y-1)/(y-1))"

p(response);

(x^2+2*x-3)/(x-1)+sin(((x-1)^(3/2)*x+3*(x-1)^(3/2))/(x-1)^(3/2))+((y^2+2*y-3)/(y-1))^(1/2)

normal(%);

x+sin(x+3)+(y+3)^(1/2)+3

 

Download parsedelay.mw

@digerdiga The Cuhre method of the Cuba library (an external link to which evalf/Int calls) is documented as being a deterministic and not a Monte Carlo approach. It implements a globally adaptive subdivision scheme.

@tomleslie DirectSearch:-SolveEquations has its own depressing bugs and faults.

@Christopher2222 Then why did you name this Post as "Maple 2019 wishlist"??

First 244 245 246 247 248 249 250 Last Page 246 of 595