_Maxim_

724 Reputation

12 Badges

8 years, 107 days

MaplePrimes Activity


These are questions asked by _Maxim_

1. This seems wrong:

applyrule(x::symbol+y::symbol = 0, a+b);
                             a + b

2. Should these two match f(a)?

applyrule((h::anything)(a) = 0, f(a));
                              f(a)
applyrule(x::f(x1::anything) = 0, f(a));
                              f(a)

3. hypergeom will give an error if the arguments are not lists, so how to write a pattern that will match hypergeom(anything, anything, a)? This works but is... skittish:

applyrule('''hypergeom'''(x1::anything, x2::anything, a) = 0, hypergeom([], [], a));
                               0

"(a)(b"

"(a)(b"

(1)

Copy the string, paste into a new cell, delete and retype the opening quote.

""(a)(`b"`"

Error, unable to delimit strings/identifiers

""(a)(`b"`"

 

Copy the string from the first cell, add f() around it.

"f("(a)(`b"`)"

Error, unable to delimit strings/identifiers

"f("(a)(`b"`)"

 

Download 2dstring.mw

Spawned from here. The code itself is perfectly fine, but if the definition of TD is in the same cell with the rest of the code, TD gives an error. The same definition in a separate cell works.

ans := dsolve({diff(y(t), `$`(t, 2)) = y(t), y(0) = a, (D(y))(0) = 0}, numeric, parameters = [a]); td := proc (x, tt) option remember; ans(parameters = [a = x]); eval([t, y(t), diff(y(t), t)], ans(tt)) end proc; TD := proc (k::{1, 2, 3}) options operator, arrow; proc (x, tt) options operator, arrow; td(x, tt)[k] end proc end proc

(TD(1))(.2, .2)

Error, (in unknown) invalid keyword expression

 

TD := proc (k::{1, 2, 3}) options operator, arrow; proc (x, tt) options operator, arrow; td(x, tt)[k] end proc end proc

(TD(1))(.2, .2)

.2

(1)

Download td.mw

eqs := [D[1, 2](u)(x, y) = x+y, u(x, 0) = x, u(0, y) = y]:

pdsolve(eqs[1], u(x, y));
                       u(x, y) = _F2(x)+_F1(y)+(1/2)*x^2*y+(1/2)*x*y^2

pdsolve(eqs[1 .. 2], u(x, y)); # indeterminate
                       u(x, y) = invfourier((y^2*undefined+signum(y)*infinity+y*(limit(-(2*I)*Pi*y/s1,
                       s1 = 0))+undefined)*Dirac(s1)+2*Pi*(limit((I*s1+y)/s1, s1 = 0))*Dirac(1, s1), s1, x)

pdsolve(eqs, u(x, y)); # doesn't satisfy the DE
                       u(x, y) = (Int(1, tau1 = 0 .. y)+1)*(-_F1(0)+x-_F2(0)+y)

(value@eval)(eqs, u = unapply(rhs(%), [x, y]));
                       [1 = x+y, -_F1(0)+x-_F2(0) = x, (y+1)*(-_F1(0)-_F2(0)+y) = y]

The first pdsolve is fine, but not the other two.

diff(int(1/(1+exp(1/(x-t))), t = 0 .. x), x);
              diff(int(1/(1+exp(1/(x-t))), t = 0 .. x), t)

simplify(%);
                                  0

diff returns a derivative wrt the bound variable t.

This is probably tricky because diff needs to evaluate the limit of f(x, t) at t=x, and it must distinguish between the case of the left limit (x>0) and of the right limit (x<0).

 

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