acer

32348 Reputation

29 Badges

19 years, 329 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

I must have been asleep to not see that it is a bvp and the second derivative is present and easily isolated from the de. Coffee time.

@Carl Love Don't you see Adri's original display( Array([P1,P2]) ) as showing the plots side-by-side?

For fun, an edit of Kitonum's code, which works in Maple 17.01 and 2018.1. Without an indexed Cube.

restart;

with(plottools): with(plots):

V1,V2,V3,V4,V5,V6,V7,V8:=[0,-1,0],[0,0,0],[1,0,0],[1,-1,0],[0,-1,1],[0,0,1],[1,0,1],[1,-1,1]:
Faces:=[[V1,V4,V8,V5],[V5,V6,V7,V8],[V2,V3,V7,V6],[V1,V2,V3,V4],[V3,V4,V8,V7],[V1,V2,V6,V5]]:
Colors:=[green,red,magenta,blue,grey,gold]: # The list of the colors

Cube:=display([seq(polygon(Faces[i],'color'=Colors[i]),i=1..6)]):

F:=(T,N)->rotate(Cube,T,[[0,N,0],[1,N,0]]):

for n from 1 to 7 do
  Cube:=F(-Pi/2,n-1):
  A[n]:=animate(display,['F'(t,n)], t=0..-Pi/2, 'paraminfo'=false);
od:

for m from 7 to 1 by -1 do
  B[m]:=animate(display,['F'(t,m)], t=-Pi/2..0, 'paraminfo'=false);
  Cube:=F(Pi/2,m-1):
od:

C1:=display([seq(A[k], k=1..7)], 'insequence'):
C2:=display([seq(B[k], k=7..1, -1)], 'insequence'):
display([C1,C2], 'insequence', 'scaling'='constrained', 'axes'=normal);

 

Download cuberoll.mw

@basha 666 In your latest example the differential equations have the independent variables x and eta, and those are used in the associated contour plot.

But your differential equations have the single independent variable y. So what would be the other independent variable in your desired contour plot?

Do you want the contours as curves of points with equal U values? Or (like your latest example's psi) do you want contours of some more complicated function of y, U, C, T, or W?

Do you want the fourth (only) iterate of R, for each Ha in L?

Why don't you answer my other queries, and give a detailed explanation?

 

@basha 666 

Don't you have any intention of explaining how your determinates C,T,U, and W might correspond to R,X and(?) Ns in the picture?

And why don't you respond to my comment about the role of Ha in your code? Your original code iterated 4 times (thus changing R), for a particular fixed Ha. Do you want each of those iterates (for several Ha values), or just the fourth?

Which of your parameters do you want to vary, as for Beta and epsilon in the picture?

@basha 666 Why do you not say what you mean by "contour" in this context?

The help-page for plottools:-rotate says, "The result of a call to rotate is a 2-D or 3-D plot structure or object that can be displayed with the plots[display] command."

That can only hold if the second argument to plottools:-rotate evaluates to something of type realcons. Otherwise the result would not be a plot stucture that can be displayed with the plots[display] command. There are no examples in that help-page with an unassigned symbolic name being passed as the second argument.

But the supplied code calls plots:-animate with arguments containing things like F[1](t) for unassigned t. And the code is set up so that it then calls plottools:-rotate with unassigned t as the second argument.

So it looks to me like it is one or the other of these cases (but not both):

1) It's a bug that plottools:-rotate does not throw an error when its second argument is not of type realcons, and another bug that its help page does not specifiy that requirement. And the supplied code above worked (previously) in part because of the incorrect lack of argument checking by plottools:-rotate. But the code is wrong to not protect against premature evaluation.

2) It's a bug that the plottools:-rotate help-page claims that the output of that command can necessarily be displayed as is (without any need for substitution of a numeric quantity to replace whatever was actually passed as the second argument, if that was not actually realcons). And it's a regression bug that the second argument can no longer be something not of type realcons. And the supplied code is correctly formed.

I suspect that it is case 1) which holds. I have a hazy recollection of a similar situation some years back, where another plotting routine was "corrected" to no longer admit some arguments which could not be taken as numeric.

But it is unclear, because there are other plottools commands whose help-pages are equally vague about any type restrictions on some arguments, but which also make the same claim that the output is a displayable plot structure. The following seems plain inconsistent:

plottools[line]([x1,y1], [x2,y2]);

            CURVES([[x1, y1], [x2, y2]])

plottools[polygon]([[a,b], [c,d], [e,f]]);
Error, (in Plot:-Structure:-Polygons) points cannot be converted to floating-point values

@tomleslie I agree.

@Honigmelone I got it to work without redefining everything. But using alist (or something done to it) rather than eval(alist,1) was key.

Unfortunately I'm away from a computer for two weeks, sorry.

@mmcdara Yes, using unapply can work here.

Did you mean   unapply('P'(i,1,1,x), x)  so that a procedure P doen't get its call evaluated there?

Using unapply is simpler. You may find it not easy to remember, but it's more convenient than applying subs to an anonymous procedure.

Using subs on a procedure is more powerful, but also more advanced.

That's a common dynamic: flexibility and power versus complexity of usage.

There are other ways, eg. codegen[makeproc] which has some additional kinds of generality.

What is the reason for using eval(alist,1) in the second argument passed to makeproc?

Your attempts to remove assumptions on x and y don't clear this.

hasassumptions(eval(alist,1));
                              true
about(eval(alist,1));
[x, y]:
  is used in the following assumed objects
  [x] assumed real
  [y] assumed real

The result of the implicitlot3d command has its computed data inside an ISOSURFACE call within the PLOT3D structure.

But that substrucure only contains the functional evaluations at all the 3-d points used (taken from the ranges). It does not contain the detail of specific points on the surface (eg, where the expression is zero). That is to say, the structure does not explicitly contain values where the surface lies.

The GUI plot renderer is computing/interpolating the displayed surface on-the-fly, using the values and sign-changes of that full data.

From the help page on Maple's plot structures,

  "The ISOSURFACE structure contains the samples of a function taken over a
   regular grid in 3-D space and is rendered as a 3-D surface approximating the
   zero surface of the function. TheISOSURFACE structure takes the form
   ISOSURFACE(A) where A is a four-dimensional Array. If you have an
   m-by-n-by-p grid, then A[i, j, k, 1..3] gives the (x, y, z) coordinates of grid
   point (i, j, k) and A[i, j, k, 4] is the function value at that point, for i in 1..m,
   j in 1..n and k in 1..p.  The Array A can be replaced by a list of m lists.
   Each sublist in turn contains n lists withp elements, each of which is a
   list [xijk, yijk, zijk, fijk], representing the (x, y, z) coordinates and the function
   value of grid point (i, j, k)."

So unless your other software can do the same computation to render a surface from that full 3-d grid of data then there's not much point in exporting it.

@Carl Love Some time ago I submitted a suggestion that the seq command be given an option to allow the user to specify the number of elements.

I did this because I get tired of writing things like seq(a+(i-1)*(b-a)/(N-1), i=1..N) . And it's error prone to have people remember that kind of syntax over and over. The analog of "fencepost" mistakes crops up.

The currently available optional 3rd parameter of the seq command (increment) doesn't make it less error prone, or much more convenient.  Eg, seq(a..b, (b-a)/(N-1))

The question is: how could this functionality be provided by the seq command? If it were to be a keyword option then what keyword would be good?

@nm I originally wrote it so that it (always) line-printed the result and then returned NULL, which is the default behavior of the stock latex command.

latex( 'sqrt'(x) + sin(x) );
 \sqrt{x}+\sin \left( x \right) 

lprint(%);
NULL

But here's a version that accepts options like the stock latex command. So, like the latex command it line-prints and returns NULL by default, but it also accepts the output option to optionally return a string.

restart;

 

aliasedlatex:=proc(e,
                   {output::identical(file,string,terminal):=':-terminal'})
local lookup, res;
lookup:=op(eval(alias:-ContentToGlobal));
res := :-latex(subs(lookup,e),':-output'=output,_rest);
if output=':-string' then
  return res;
else
  return NULL;
end if;
end proc:

 

alias(C[1]=_C1):

 

aliasedlatex(dsolve( diff(y(x),x)=1,y(x)) );

y \left( x \right) =x+C_{{1}}

 

 

aliasedlatex(dsolve( diff(y(x),x)=1,y(x)),
             output = string );

"y \left( x \right) =x+C_{{1}}"

(1)

 

Download alias_latex.mw

Of course that can be easily changed so that the default value for the keyword option output is string instead.  And, here, that default can be overridden to get terminal line-printing.

restart;

 

aliasedlatex:=proc(e,
                   {output::identical(file,string,terminal):=':-string'})
local lookup, res;
lookup:=op(eval(alias:-ContentToGlobal));
res := :-latex(subs(lookup,e),':-output'=output,_rest);
if output=':-string' then
  return res;
else
  return NULL;
end if;
end proc:

 

alias(C[1]=_C1):

 

aliasedlatex(dsolve( diff(y(x),x)=1,y(x)) );

"y \left( x \right) =x+C_{{1}}"

(1)

 

aliasedlatex(dsolve( diff(y(x),x)=1,y(x)),
             output = terminal );

y \left( x \right) =x+C_{{1}}

 

 

Download alias_latex_string.mw

 

 

Tell us the values of a,b,c,d, and e.

First 247 248 249 250 251 252 253 Last Page 249 of 592