acer

32722 Reputation

29 Badges

20 years, 86 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

Are you trying to say that you want to reflect the plot across the y-axis? eg,

P := plot( A, x0=-3..5 ):

plots:-display( P, plottools:-reflect(P, [[0,0],[0,1]]) );

acer

@Harry Garst 

Your second example of plot(0^(x^2), x=-3..3) may appear wholly flat because the point x=0 is not necessarily used as a data point by `plot`, and because your formula might run under evalhf mode.

But the following is somewhat related to my answer above, where the data points for x are explicitly specified. I used Maple 2015.1 below, but a similar effect was had in my Maple 18.02, both 64bit for Linux.

restart;

plot([seq([x,0^(x^2)],x=-3..3,1/1000)], style=line, thickness=3, color=red);

plot([seq([x,0^(x^2)],x=-3..3,0.001)], style=line, thickness=3, color=red);

kernelopts(version);

`Maple 2015.1, X86 64 LINUX, Jun 2 2015, Build ID 1048735`

 


Download zeropow.mw

@Markiyan Hirnyk No, you are wrong. That was a problem with premature evaluation. This is different, being a distinction between behavior with exact exponent 0 and floating-point exponent 0.0.

@Markiyan Hirnyk This is one of several times that you have failed by mistakenly pasting in 1D Maple Notation plaintext code in as 2D Input. That will not work in general. It is very bizarre that you keep making this mistake.

It doesn't matter that you try to convert to 1D input, after pasting in as 2D Input. It's the initial pasting in as 2D Input that is invalid.

Paste it in as 1D Maple Notation code, into an input prompt that is in 1D Maple Notation mode. That works.

@moeinvh What does the command

libname;

return in your fresh Maple session?

If it doesn't contain that new folder location then your initialization file is not being run. (Is it perhaps saved as maple.ini.txt by accident? Or saved as rich-text by accident? What editor did you use?)

It seemed to open Ok for me using 64bit Maple 2015.1 on Linux.

Attached is a zipped copy, with the sections expanded.

Tema_a1.zip

acer

@Carl Love I had pasted in in from Maple, where it was correct. But then I mispasted when I changed instances of < and > to &lt; and &gt; inside the <pre> tags in html edit mode. I corrected it, thanks.

I prefer it with the wrapped procedure around `assuming` so that square brackets around expression on the left of the &as are not always needed, like in the following example of a function call.

restart;

`&as`:=proc(a::uneval) eval(`assuming`([a],[args[2..-1]])); end:

is(a^2 >= 0);

                             false

is(a^2 >= 0) &as (a::real);

                              true

@JVLB Sorry, I had forgotten what I was doing before. Yes, that's related to why I put in the comment, "Now, how shall we handle the derivative of this returned proc?". I'd have to think about it more, to try and get the repeated partials handled better in this way.

@JVLB That d is the list by which the original call to D was indexed. By this I mean that if I call D[3,2,2](A) then `D/A` gets passed the list [3,2,2] as its argument.

That subs(__d=d[],'D[__d](A)') business was just a way for me to make the procedure `D/A` returned the original call, as if unevaluated. There may be another simpler way to achieve that, but it's the first thing that came to mind. So if there is a situation with some list d that one doesn't know how to handle in `D/A` then the original input can just be returned.

For example, using the above code, these inputs just return as if unevaluated (or as if `D/A` and A had not been defined),

D[3,2,2](A);

D[3,2,2](A)(s,t,2);

Well, it not exactly the same. If `D/A` and A were not assigned then Maple may change the indexing [3,2,2] into [2,2,3]. I suppose this old post may be related.

@tomleslie Are floating-point implementations of the Heun function available in stock Matlab 2015b? Or does one have to resort to 3rd party code (such as by John Matthews)?

You appear to have omitted either a space or an explicit multiplication symbol at a few places.

For example, after the "2 u" in your very first line you have an opening round-bracket without any space or explicit multiplication symbol between them. This gets parsed as an instance of function application. Ie, as u(...) an application of the unassigned operator `u`. But you appear to have intended u*(...).

And then this issue continues throughout the document, as you subtitute in for `u`, etc.

acer

In case anyone was wondering about ways to reverse the order of integration, "by hand or using IntegrationTools".

Also, here too one must avoid use of typed literal `phi` and `theta` in the presence of escaped locals in the double integral returned by the `Flux` command.

restart;

with(VectorCalculus):

v1 := x^2 + y - sin(z):

v2 := x^2 + 1/y - 2*z:

v3 := y^2 + 3*x + z:

vv := VectorField(<v1, v2, v3>, 'cartesian'[x, y, z]):

G := Flux(vv, Sphere(<0, 0, 0>, r), inert);

Int(Int(-sin(phi)*(sin(phi)*cos(theta)^3*cos(phi)^2*r^3+sin(phi)*cos(theta)^2*sin(theta)*cos(phi)^2*r^3-cos(theta)^2*cos(phi)^3*r^3-sin(phi)*cos(theta)^3*r^3-r^3*sin(phi)*cos(theta)^2*sin(theta)+cos(theta)^2*cos(phi)*r^3+cos(theta)*sin(theta)*cos(phi)^2*r^2+cos(phi)^3*r^3-3*sin(phi)*cos(theta)*cos(phi)*r^2+2*r^2*cos(phi)*sin(phi)*sin(theta)+sin(phi)*cos(theta)*sin(r*cos(phi))*r-cos(theta)*sin(theta)*r^2-cos(phi)^2*r^2-cos(phi)*r^3-1)*r, phi = 0 .. Pi), theta = 0 .. 2*Pi)

 

Just as member vv wrote, this can be done "by hand or using IntegrationTools".

 

int(int(op([1,1],G), op(2,G)), op([1,2],G));

(4/3)*r^3*Pi+4*r*Pi

with(IntegrationTools):

H := GetIntegrand(G): # the inner integral

int(int(op(1,H), op(2,G)), op(2,H));

(4/3)*r^3*Pi+4*r*Pi

Int(Int(GetIntegrand(H), GetVariable(G)=GetRange(G)), GetVariable(H)=GetRange(H)):

value(%);

(4/3)*r^3*Pi+4*r*Pi

 

But here too care must be taken not to use literal `phi` and `theta`, unless the escaped local names in the integrand have been converted to globals. That's an inconvenient convenience of the `Flux` command.

 

Int(Int(GetIntegrand(H), theta=GetRange(G)), phi=GetRange(H)): # will go wrong

value(%); # wrong, due to local theta and phi in G

-2*sin(phi)*(sin(phi)*cos(theta)^3*cos(phi)^2*r^3+sin(phi)*cos(theta)^2*sin(theta)*cos(phi)^2*r^3-cos(theta)^2*cos(phi)^3*r^3-sin(phi)*cos(theta)^3*r^3-r^3*sin(phi)*cos(theta)^2*sin(theta)+cos(theta)^2*cos(phi)*r^3+cos(theta)*sin(theta)*cos(phi)^2*r^2+cos(phi)^3*r^3-3*sin(phi)*cos(theta)*cos(phi)*r^2+2*r^2*cos(phi)*sin(phi)*sin(theta)+sin(phi)*cos(theta)*sin(r*cos(phi))*r-cos(theta)*sin(theta)*r^2-cos(phi)^2*r^2-cos(phi)*r^3-1)*r*Pi^2

int(int(op([1,1],G), theta=0..2*Pi), phi=0..Pi); # wrong, due to local theta and phi in G

-2*sin(phi)*(sin(phi)*cos(theta)^3*cos(phi)^2*r^3+sin(phi)*cos(theta)^2*sin(theta)*cos(phi)^2*r^3-cos(theta)^2*cos(phi)^3*r^3-sin(phi)*cos(theta)^3*r^3-r^3*sin(phi)*cos(theta)^2*sin(theta)+cos(theta)^2*cos(phi)*r^3+cos(theta)*sin(theta)*cos(phi)^2*r^2+cos(phi)^3*r^3-3*sin(phi)*cos(theta)*cos(phi)*r^2+2*r^2*cos(phi)*sin(phi)*sin(theta)+sin(phi)*cos(theta)*sin(r*cos(phi))*r-cos(theta)*sin(theta)*r^2-cos(phi)^2*r^2-cos(phi)*r^3-1)*r*Pi^2

int(int(convert(op([1,1],G),`global`), theta=0..2*Pi), phi=0..Pi);

(4/3)*r^3*Pi+4*r*Pi

 


Download fluxfoo2.mw

Intsead of converting the names to `global` and typing in the literal name `phi` I could also have used IntegrationTools:-GetVariable.

with(IntegrationTools):
Change(op(1,G), cos(GetVariable(op(1,G)))=t, t);

@Axel Vogt The names `phi` and `theta` in G are locals. Presumably this is so to cover the case that the user had previously assigned values to either of them. This makes it awkward to use IntegrationTools:-Change, since its 2nd and 3rd arguments have to contain the appropriate names.


restart;

with(VectorCalculus):

v1 := x^2 + y - sin(z):

v2 := x^2 + 1/y - 2*z:

v3 := y^2 + 3*x + z:

vv := VectorField(<v1, v2, v3>, 'cartesian'[x, y, z]):

G := Flux(vv, Sphere(`<,>`(0, 0, 0), r), inert);

Int(Int(-sin(phi)*(sin(phi)*cos(theta)^3*cos(phi)^2*r^3+sin(phi)*cos(theta)^2*sin(theta)*cos(phi)^2*r^3-cos(theta)^2*cos(phi)^3*r^3-sin(phi)*cos(theta)^3*r^3-r^3*sin(phi)*cos(theta)^2*sin(theta)+cos(theta)^2*cos(phi)*r^3+cos(theta)*sin(theta)*cos(phi)^2*r^2+cos(phi)^3*r^3-3*sin(phi)*cos(theta)*cos(phi)*r^2+2*r^2*cos(phi)*sin(phi)*sin(theta)+sin(phi)*cos(theta)*sin(r*cos(phi))*r-cos(theta)*sin(theta)*r^2-cos(phi)^2*r^2-cos(phi)*r^3-1)*r, phi = 0 .. Pi), theta = 0 .. 2*Pi)

L:=[indets(G,And(name,Non(constant)))[]];

[phi, r, theta]

for nm in L do
  if addressof(nm) <> addressof(convert(nm,`global`)) then
    print(nm, addressof(nm), addressof(convert(nm,`global`)));
  else
    print(nm, "ok");
  end if;
end do;

phi, 18446884655745329310, 18446884655745292254

r, "ok"

theta, 18446884655745329278, 18446884655745328862

op(1,G);

Int(-sin(phi)*(sin(phi)*cos(theta)^3*cos(phi)^2*r^3+sin(phi)*cos(theta)^2*sin(theta)*cos(phi)^2*r^3-cos(theta)^2*cos(phi)^3*r^3-sin(phi)*cos(theta)^3*r^3-r^3*sin(phi)*cos(theta)^2*sin(theta)+cos(theta)^2*cos(phi)*r^3+cos(theta)*sin(theta)*cos(phi)^2*r^2+cos(phi)^3*r^3-3*sin(phi)*cos(theta)*cos(phi)*r^2+2*r^2*cos(phi)*sin(phi)*sin(theta)+sin(phi)*cos(theta)*sin(r*cos(phi))*r-cos(theta)*sin(theta)*r^2-cos(phi)^2*r^2-cos(phi)*r^3-1)*r, phi = 0 .. Pi)

IntegrationTools:-Change(op(1,G), cos(phi)=t, t);

Error, (in IntegrationTools:-Change) the dependent variable(s) must be of type 'unknown', as in f(x, ...) or f[i](x, ...) (no rule for the derivative of f). Received cos(phi)

IntegrationTools:-Change(op(1,convert(G,`global`)), cos(phi)=t, t);

-r*(Int((-t^2+1)^(1/2)*cos(theta)^3*t^2*r^3+(-t^2+1)^(1/2)*cos(theta)^2*sin(theta)*t^2*r^3-cos(theta)^2*t^3*r^3-(-t^2+1)^(1/2)*cos(theta)^3*r^3-r^3*(-t^2+1)^(1/2)*cos(theta)^2*sin(theta)+cos(theta)^2*t*r^3+cos(theta)*sin(theta)*t^2*r^2+t^3*r^3-3*(-t^2+1)^(1/2)*cos(theta)*t*r^2+2*r^2*t*(-t^2+1)^(1/2)*sin(theta)+(-t^2+1)^(1/2)*cos(theta)*sin(r*t)*r-cos(theta)*sin(theta)*r^2-t^2*r^2-t*r^3-1, t = -1 .. 1))

student[changevar](cos(phi)=t, op(1,G), t);

Error, (in student/changevar/SingleSolve) unable to solve cos(phi) = t for phi

student[changevar](cos(phi)=t, op(1,convert(G,`global`)), t);

Int(-((-t^2+1)^(1/2)*cos(theta)^3*t^2*r^3+(-t^2+1)^(1/2)*cos(theta)^2*sin(theta)*t^2*r^3-cos(theta)^2*t^3*r^3-(-t^2+1)^(1/2)*cos(theta)^3*r^3-r^3*(-t^2+1)^(1/2)*cos(theta)^2*sin(theta)+cos(theta)^2*t*r^3+cos(theta)*sin(theta)*t^2*r^2+t^3*r^3-3*(-t^2+1)^(1/2)*cos(theta)*t*r^2+2*r^2*t*(-t^2+1)^(1/2)*sin(theta)+(-t^2+1)^(1/2)*cos(theta)*sin(r*t)*r-cos(theta)*sin(theta)*r^2-t^2*r^2-t*r^3-1)*r, t = -1 .. 1)

 


Download fluxbah.mw

First 326 327 328 329 330 331 332 Last Page 328 of 599