acer

20475 Reputation

29 Badges

15 years, 26 days

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

Have a look at the Help pages for the Student:-Calculus1 package.

@tomleslie The OP made it quite clear in his Question that he wanted to act on operators/procedures rather than expressions. That was the central point of the Question.

Your code deals with function calls which evaluate to expressions prior to Jacobuan being called. So your suggestion is not what was requested.

One could map unapply over an expression-based solution like yours, after the fact, to get a result with operators. But that is a kludge generally weaker than using D (which also has some abilities to deal with conditionals and code branching within the procedure, and that otherwise mostly gets wrecked/ignored by a function call to produce an expression result).

@tomleslie Investigating the older behavior is a good idea. But the following does not agree with one of your examples (even if put in a single execution group).

restart;

kernelopts(version);

`Maple 2019.0, X86 64 LINUX, Mar 9 2019, Build ID 1384062`

with(VectorCalculus):

# assume(x, 'real');
# assume(y, 'real');

D[1]((x, y) ->x^2-y^2);

proc (x, y) options operator, arrow; 2*x end proc

 

Download D_TL.mw

@Carl Love The example that I showed produces the same results in my Maple 2019.0 as it did in what I posted from Maple 2018.0.

I suspect that you have not noticed the key aspects of my two alternatives. One uses procedure f defined before loading the package, and the other used unapply afterwards. I did not claim that :-D would work on the operator defined literally as you have it, after loading the full VectorCalculus package and placing the assumptions (which is literally similar to what the OP had).

restart;

kernelopts(version);

`Maple 2019.0, X86 64 LINUX, Mar 9 2019, Build ID 1384062`

with(VectorCalculus):

assume(x, 'real');
assume(y, 'real');

:-D[1]( unapply(x^2-y^2, [x,y]) );

proc (x, y) options operator, arrow; 2*x end proc

:-D[2]( unapply(x^2-y^2, [x,y]) );

proc (x, y) options operator, arrow; -2*y end proc

restart;

kernelopts(version);

`Maple 2019.0, X86 64 LINUX, Mar 9 2019, Build ID 1384062`

f := (x, y) -> x^2-y^2;

proc (x, y) options operator, arrow; x^2-y^2 end proc

with(VectorCalculus):

assume(x, 'real');
assume(y, 'real');

:-D[1](f);

proc (x, y) options operator, arrow; 2*x end proc

:-D[2](f);

proc (x, y) options operator, arrow; -2*y end proc

:-D[1]( unapply(x^2-y^2, [x,y]) );

proc (x, y) options operator, arrow; 2*x end proc

:-D[2]( unapply(x^2-y^2, [x,y]) );

proc (x, y) options operator, arrow; -2*y end proc

 

VCD_M2019.0.mw

Trying to export package "overloads" of kernel builtins is difficult to get exactly right (and not always possible). [edit] If Tom is correct and this is a regression breakage then I do not yet know whether the bug is Library-side or kernel-side.[/edit]

Please upload a worksheet, or add a comment with the full details to this thread. Please don't post a duplicate thread, which is unhelpful.

@Carl Love Yes, simplify with side-relations can just do this:

restart;

G:=Groebner:-Basis({a+b+c-1,a^2+b^2+c^2-2,a^3+b^3+c^3-3},
                   plex(c,b,a),characteristic=0,output="basislm"):

lprint(G);
   [[6, a^3, 6*a^3-6*a^2-3*a-1], [2, b^2, 2*a^2+2*a*b+2*b^2-2*a-2*b-1],
    [1, c, a+b+c-1]]

Groebner:-NormalForm(a^4+b^4+c^4,G,plex(c,b,a),characteristic=0);

                         25/6

I suppose that this was originally intended for people to do without Maple, where they would concoct or notice that the target expressions can be obtained by a judicious expansion (with cancellation) of a polynomial of the original three expressions.

Perhaps the OP was shooting for something like this (just a guess as to intent):

restart;

eqs := [t1 = a+b+c,
        t2 = a^2+b^2+c^2,
        t3 = a^3+b^3+c^3]:

vals := [t1=1,t2=2,t3=3]:

R4 := 1/2*(t2-t1^2)^2-1/3*t1^4+4/3*t1*t3;

(1/2)*(-t1^2+t2)^2-(1/3)*t1^4+(4/3)*t1*t3

# Notice this
subs(eqs, R4);
expand(%);

(1/2)*(-(a+b+c)^2+a^2+b^2+c^2)^2-(1/3)*(a+b+c)^4+(4/3)*(a+b+c)*(a^3+b^3+c^3)

a^4+b^4+c^4

expand(eval(R4, eqs)) = eval(R4, vals);

a^4+b^4+c^4 = 25/6

R5 := 1/6*(5*(t1^2+t2)*t3+t1^3*(t1^2-5*t2));

(5/6)*(t1^2+t2)*t3+(1/6)*t1^3*(t1^2-5*t2)

# Notice this
subs(eqs, R5);
expand(%);

(5/6)*((a+b+c)^2+a^2+b^2+c^2)*(a^3+b^3+c^3)+(1/6)*(a+b+c)^3*((a+b+c)^2-5*a^2-5*b^2-5*c^2)

a^5+b^5+c^5

expand(eval(R5, eqs)) = eval(R5, vals);

a^5+b^5+c^5 = 6

 

Download subs_challenge.mw

So, is there some "easier" reformulation of R4 or R5 which might be concocted with more of an "aha!" moment?

@Carl Love I wish I'd thought of it earlier.

@Christopher2222 I submitted a bug report related to this a few years ago.

@tomleslie Yes, and now you've obtained a method that is essentially the same as what dharr showed earlier (as in the examples,Explore help page).

[I'm not suggesting that you haven't come up with this all by yourself. I think it's the natural way to approach it efficiently. I'm pretty sure I've seen Preben do the same thing. I've long wanted something like DEplot to offer the same flexibility+efficiency.]

Please post your followups to this thread here, instead of entirely new Question threads.

To get the visual effect of subscripted text (but not as output) you might have to toggle into non-executing 2D Math input mode and manually flip off italics from the menubar.

@Christopher2222 It looks as if his question is about how to enter it as input, while your answer is only about how to produce output.

Moreover he seems to want a subscripted/superscripted bit of "text", which I interpret as meaning something formatted in upright roman font. So mi is not the right typesetting markup for that.

I don't see how your answer relates properly to this question at all.

@dharr Vote up, because this shows dsolve being called only the one time.

The help page referred to is available in the Help system under the topic examples,Explore

@ebrahimina I much prefer to have multiplication show explicitly, even in 2D Input. Relying on a space to denote multiplication implicitly often leads to confusion and mistakes. But in this case the * appeared when I copied and pasted, I suspect. [edit] I have revised my Answer to use the unitless range 0..100 since the calls to tau and Q already contain argument x*Unit(mm). [/edit]

Did you have a second followup question?

On the topic of style, I also dislike using the syntax Q(x):=...  to denote assignment of an operator, but I forgot to change it when replying. That syntax is ambiguous and can also be used to denote assignment to the remember table of Q. And ambiguous syntax is error prone. I much prefer the syntax Q:=x->... 

By the way, I used Maple 2017.2 in my Answer, since the OP's original attachment was last saved in Maple 2017. I also tried to write the answer so that the OP could use his original definitions of Q and tau, as is, and call plot without having to strip or cancel out the units.

First 65 66 67 68 69 70 71 Last Page 67 of 438