Joe Riel

9660 Reputation

23 Badges

20 years, 22 days

MaplePrimes Activity


These are replies submitted by Joe Riel

(**) y := sin(x)*x^2;            
                                                              2
                                                 y := sin(x) x

(**) frontend(diff, [y,sin(x)]);
                                                        2
                                                       x

See www.mapleprimes.com/book/frontend

The reason for this is that when assume is used to apply an assumption to a variable, that variable is assigned a value.  The value is another variable, which looks the same as the original but has a `~' appended to it.  In you case, t is assigned t~.  When you assign t := x+2, the previous assignment to t is replaced. However, the variable with the assumption (t~) still exists in expressions that had been previously created.  That is, the Array eq contains not t, but t~ because, at the time eq[1,1] := g*t was evaluated, t was assigned (t~), so eq[1,1] := g~ * t~.

Using assuming is different in that it temporarily applies assumptions to a variable.  Consequently, eq[1,1] is assigned g*t, not g~*t~.  So when you later assign a value to t, eq appears to change.  It doesn't actually change (that is, it still contains g*t), but when its contents are fully evaluated, then you see the x+2.  To see this, do

eval(eq[1,1],1); # the second argument (1), causes the first to be evaluated only one level.  See ?eval
                         g*t
eq[1,1];
                         g*(x+2)

 

 

The reason for this is that when assume is used to apply an assumption to a variable, that variable is assigned a value.  The value is another variable, which looks the same as the original but has a `~' appended to it.  In you case, t is assigned t~.  When you assign t := x+2, the previous assignment to t is replaced. However, the variable with the assumption (t~) still exists in expressions that had been previously created.  That is, the Array eq contains not t, but t~ because, at the time eq[1,1] := g*t was evaluated, t was assigned (t~), so eq[1,1] := g~ * t~.

Using assuming is different in that it temporarily applies assumptions to a variable.  Consequently, eq[1,1] is assigned g*t, not g~*t~.  So when you later assign a value to t, eq appears to change.  It doesn't actually change (that is, it still contains g*t), but when its contents are fully evaluated, then you see the x+2.  To see this, do

eval(eq[1,1],1); # the second argument (1), causes the first to be evaluated only one level.  See ?eval
                         g*t
eq[1,1];
                         g*(x+2)

 

 

There are several things going on here.  Note that you assigned eq1 an array, but in the for loop you assign to eq, not eq1.  Maple is happy to accept that, assigning to any indexed name creates a table (which is different from an array, though array's are based on tables).  To compound the confusion, array's are an older Maple structure, the newer structure is Array.   Also, you can use the Array constructor to initialize it. For example

M := Array(1..2,1..2, (i,j) -> g*t):
t := x+2:
M;
                           [g (x + 2)    g (x + 2)]
                           [                      ]
                           [g (x + 2)    g (x + 2)]

Note that you have to be careful here.  M's element are still g*t, not g*(x+2).  Global variables are fully evaluated, but locals are only evaluated one level. The following illustrates the difference

proc()
local x,y;
global g;
    g := x;
    y := x;
    x := 2;
    evalb(g=2) <> evalb(y=2);
end proc();
                         true <> false

 

There are several things going on here.  Note that you assigned eq1 an array, but in the for loop you assign to eq, not eq1.  Maple is happy to accept that, assigning to any indexed name creates a table (which is different from an array, though array's are based on tables).  To compound the confusion, array's are an older Maple structure, the newer structure is Array.   Also, you can use the Array constructor to initialize it. For example

M := Array(1..2,1..2, (i,j) -> g*t):
t := x+2:
M;
                           [g (x + 2)    g (x + 2)]
                           [                      ]
                           [g (x + 2)    g (x + 2)]

Note that you have to be careful here.  M's element are still g*t, not g*(x+2).  Global variables are fully evaluated, but locals are only evaluated one level. The following illustrates the difference

proc()
local x,y;
global g;
    g := x;
    y := x;
    x := 2;
    evalb(g=2) <> evalb(y=2);
end proc();
                         true <> false

 

Glad it worked.  Just thinking aloud (or in words).  It would be nice if there were a convenient way to expand the term without having to assign `expand/Im`.  Something like

z := Im(x+y):
expand(z) assuming Im :: linear;

You could use define to tell Maple that your own inert function is linear,

define(Jm,linear):
Jm(x+y);
                        Jm(x) + Jm(y)

However, you cannot do

define(Im, linear);
Error, (in define) Im is assigned

One approach is to temporarily replace Im with Jm to do the expansion, and then swap back,

eval(eval(z, Im=Jm), Jm=Im);
                           Im(x) + Im(y)

 

 

 

              

Glad it worked.  Just thinking aloud (or in words).  It would be nice if there were a convenient way to expand the term without having to assign `expand/Im`.  Something like

z := Im(x+y):
expand(z) assuming Im :: linear;

You could use define to tell Maple that your own inert function is linear,

define(Jm,linear):
Jm(x+y);
                        Jm(x) + Jm(y)

However, you cannot do

define(Im, linear);
Error, (in define) Im is assigned

One approach is to temporarily replace Im with Jm to do the expansion, and then swap back,

eval(eval(z, Im=Jm), Jm=Im);
                           Im(x) + Im(y)

 

 

 

              

That is done to lessen the information overload for new users.   I'd prefer that there be a way to tell Maple that I'm an experienced user, in which case ?simplify would automatically open ?simplify,details. Similarly for other help pages.

That is done to lessen the information overload for new users.   I'd prefer that there be a way to tell Maple that I'm an experienced user, in which case ?simplify would automatically open ?simplify,details. Similarly for other help pages.

What version of Maple are you using?  And is that from a worksheet?  On Maple13 tty I get

Multiple matches found:
   limit
   MultiSeries,limit
   MTM,real

They are syntactically correct, but simplify to 0 so are not particularly useful:

simplify(piecewise(t<=100,0,t<100 and t<=160,1,0));
                                                                    0

It seems more likely that the second condition was entered incorrectly.



 

They are syntactically correct, but simplify to 0 so are not particularly useful:

simplify(piecewise(t<=100,0,t<100 and t<=160,1,0));
                                                                    0

It seems more likely that the second condition was entered incorrectly.



 

I believe the original poster is using pdsolve/numeric.

I believe the original poster is using pdsolve/numeric.

It replaces the n in k3:

                 /                       1              \      2
                 |phi + ln(- --------------------------)| sigma
                 \           -exp(phi) + exp(phi) p - p /
               - -----------------------------------------------
                                 phi p (-1 + p)

First 91 92 93 94 95 96 97 Last Page 93 of 195