Rouben Rostamian

MaplePrimes Activity


These are questions asked by Rouben Rostamian

 

restart;

q := (u,v) -> u^2 + v^2;

proc (u, v) options operator, arrow; v^2+u^2 end proc

D[3](q);

Error, (in D/procedure) index out of range: function takes only 2 arguments

Question: How does D know that q takes two arguments?

In general, if I pass q to another proc, how can I find out, within
that proc, that q takes only two arguments?

download number-of-arguments.mw

Given a vector-valued function z(u,v), I want to calculate the derivative of z with respect to its first argument by applying the D operator to it. I don't see how.  Any suggestions?

restart;

z := (u,v) -> < a(u,v), b(u,v) >;

proc (u, v) options operator, arrow; `<,>`(a(u, v), b(u, v)) end proc

Calculate the derivative of z with respect to its first argument:

P := diff(z(u,v), u);

Vector(2, {(1) = diff(a(u, v), u), (2) = diff(b(u, v), u)})

Express P through the D operator:

Q := convert(P, D);

Vector(2, {(1) = (D[1](a))(u, v), (2) = (D[1](b))(u, v)})

Question:  How do we obtain Q directly by applying the D operator to z

without the help of diff?  This one doesn't work:

D[1](z)(u,v);
type(%, Vector);

(D[1](`<,>`))(a(u, v), b(u, v))*(D[1](a))(u, v)+(D[2](`<,>`))(a(u, v), b(u, v))*(D[1](b))(u, v)

false

Download diff.mw

restart;

pde := diff(u(x,t),t) + u(x,t)*diff(u(x,t),x) = 0;

diff(u(x, t), t)+u(x, t)*(diff(u(x, t), x)) = 0

These are all wrong:

pdsolve({pde,u(x,0)=f(x)});
pdsolve({pde,u(x,0)=sin(x)});
pdsolve({pde,u(x,0)=erf(x)});

u(x, t) = 0

u(x, t) = 0

u(x, t) = 0

But these ones are correct:

pdsolve({pde,u(x,0)=exp(x)});
pdsolve({pde,u(x,0)=x});

u(x, t) = LambertW(t*exp(x))/t

u(x, t) = x/(t+1)

Download mw.mw

Is there  a specific type name for vectors in Physics[Vectors]?  Specifically, Let's say we want to write a proc whose argument is expected to be a (Physics) Vector, as in  these (trivial) demos:

with(Physics[Vectors]);

f := proc(a_::???)
    return a_ . a_;
end proc:

g := proc(a_::???, b_::???)
    return a_ &x b_;
end proc:

What do we put in place of "???".

When displaying two tubeplots together, we may specify their colors at will, as long as they are different colors!  For instance, specifying red and green works correctly, but specifying red and red results in red and black!

See the attached worksheet.  Interestingly, when displaying the contents of the worksheet on this website, the colors are rendered correctly!  So don't go with what you see on this web page; look inside the worksheet instead.

restart;

kernelopts(version);

`Maple 2022.1, X86 64 LINUX, May 26 2022, Build ID 1619613`

with(plots):

Two intersecting tori colored red and green -- works as expected:

display(
        tubeplot([cos(t), 0, sin(t)], t=-Pi..Pi, radius=0.2),
        tubeplot([cos(t), sin(t), 0], t=-Pi..Pi, radius=0.2),
style=surface, color=[red,green]);

When we set both colors to red, one of the surfaces is painted black!  Why?

Please note: This website displays the colors corectly as red and red.  But

within the worksheet the colors are read and black.

display(
        tubeplot([cos(t), 0, sin(t)], t=-Pi..Pi, radius=0.2),
        tubeplot([cos(t), sin(t), 0], t=-Pi..Pi, radius=0.2),
style=surface, color=[red,red]);

Specifying colors as red/red within the tubeplots still produces red/black!

display(
        tubeplot([cos(t), 0, sin(t)], t=-Pi..Pi, radius=0.2, color=red),
        tubeplot([cos(t), sin(t), 0], t=-Pi..Pi, radius=0.2, color=red),
style=surface);

Download mw.mw

PS: As a workaround, we may replace the red & red specification with
COLOR(RGB, 1, 0, 0) and
COLOR(RGB, 1, 0, 0.01)
which are different enough to make Maple happy, but produce essentially the same red color.

1 2 3 4 5 6 7 Last Page 3 of 16