pagan

5147 Reputation

23 Badges

17 years, 124 days

 

 

"A map that tried to pin down a sheep trail was just credible,

 but it was an optimistic map that tried to fix a the path made by the wind,

 or a path made across the grass by the shadow of flying birds."

                                                                 - _A Walk through H_, Peter Greenaway

 

MaplePrimes Activity


These are answers submitted by pagan

The top two hits using the Maple program's own Help (Text search, not Topic) in my Maple 14 are

StringTools,ParseTime
StringTools,FormatTime

which looks pretty good. Having pages and pages of hits is not bad in itself, as long as the top hits are relevant and the process doesn't take too long. Unfortunately, such a Text search does take too long even on a fast machine, using Maple's own Help. It ought to be much faster.

An often faster alternative is to use the Online Help, on the web. That is usually speedy, and allows for multiple keywords without having to toggle between Topic and Text (as in Maple's own Help Search). Unfortunately such a search for date format brings up some Finance toolbox hits amongst the top half dozen. This aspect is less useful for the majority of people, who wouldn't have that toolbox installed. And apparently toolbox specific results cannot be turned off in the query.

It helps to show the axes, if you want the axes' labels to show.

plot3d(sin(x*y),x=-6..5,y=-6..6,labels=[a,b,c],axes=boxed);

What error message do you get?

Have you previously assigned anything to x or y? If so, then does it work if you unassign them before the plot call? ie. unassign('x') and/or unassign('y') ?

The reflection across the x-axis is not hard. Getting the y-tickmarks right might be trickier.

P:=plot(x^2,x=0..5):
P;

plot(-x^2,x=0..5,tickmarks=[default,[seq(-5*i=convert(5*i,string),i=1..5)]]);

plots:-display(plottools:-reflect(P,[[0,0],[1,0]]),
               tickmarks=[default,[seq(-5*i=convert(5*i,string),i=1..5)]]);

Neither of those two ways is fully automatic. (The second way requires some knowledge of the tickmark spacing. So the manually constructed y-tickmark spacing would need to be something like 100 instead of 5 for plotting x^2 from 0 to 30, say.)

Compare these:

plot(cos(height),height=6..8);

plottools:-reflect(plot(cos(height),height=6..8),[[0,0],[1,1]]);

plot(z->2000+5*z);

plottools:-reflect(plot(z->2000+5*z),[[0,0],[1,1]]);

Sometimes you can invert the formula (which Maple is often good at, and in your linear example is very easy). But if you don't want to figure out the domain for the inversion for some smartplot, or deal with potential jaggedness of an implicit plot if the formula is not explicitly invertible, then a simple reflection across the line x=y can be easiest.

An alternative to mere plot reflection could be this:

E := z->2000+5*z;
e := unapply(rhs(isolate(E(T)=Z,T)),Z);
plot(e,1950..2050);

There are several ways to do it. At your current skill level (absolutely no offense intended), you might be better off with something which is simpler (as opposed to something maximally efficient.)

> mx, mn := rtable_scanblock( M, [1..20,2..2], Maximum, Minimum);

                              mx, mn := 10, -10

> seq(`if`(M[i][2]=mx,i,NULL), i=1..20);

                                    8, 14

> seq(`if`(M[i][2]=mn,i,NULL), i=1..20);

                                  5, 11, 17

That approach requires Maple to "walk" the structure M three times.

There are several ways to produce a list of the solutions (for each a[i]). Here are a few.

> equ := 2+(s+1)*exp(tau*s) = 0:

> a := [0, .8, 2*Pi/(3*sqrt(3)), 4*Pi/(3*sqrt(3))]:

> for i to nops(a) do
>    Sol[i] := evalf(solve(subs(tau = a[i], equ), s));
> end do:

> a[2], Sol[2]; # Sol is a table
               0.8, -0.2588952670 + 2.345975056 I

> Sol_list:= [seq(Sol[i], i = 1..nops(a))]: # turn Sol into a list

Sol_list;

     [-3.000000000, -0.2588952670 + 2.345975056 I, 
       -0. + 1.732050809 I, 0.1191146787 + 0.9979236241 I]

> a[2], Sol_list[2];
               0.8, -0.2588952670 + 2.345975056 I

> isol_equ := solve(equ, s); # general formula approach

                LambertW(-2 tau exp(tau)) - tau
                -------------------------------
                              tau              

> Sol_list:= [seq( fnormal(evalf(limit(isol_equ, tau=a[i]))), i=1..nops(a))];

   [-3., -0.2588952675 + 2.345975056 I, 0. + 1.732050808 I, 
     0.1191146788 + 0.9979236242 I]

> a[2], Sol_list[2];
               0.8, -0.2588952675 + 2.345975056 I

You asked about appending a number to a list. You could do that, each time through your original loop. Here is a popular but bad way to accomplish such tasks:

> Sol_list := []:
> for i to nops(a) do
>    Sol_list := [op(Sol_list), evalf(solve(subs(tau = a[i], equ), s))];
> end do:

> Sol_list;

     [-3.000000000, -0.2588952670 + 2.345975056 I, 
       -0. + 1.732050809 I, 0.1191146787 + 0.9979236241 I]

But it's not efficient as it generates a bunch of smaller partial lists along the way (which aren't needed in the end). For a very large list `a` the difference in consumed time and memory resources might become important. Repeated appending to a list is thus a famous "bad way to do it" in Maple. That's why above I produced Sol as a table instead in the very first approach above, since a table is a structure for which new entries may be added more efficiently. Of course you could also generate the solution list using `seq` (which I used for the second example, but which would also be possible for the first instead of a for-loop).

The call interface(rtablesize=50) should allow Vectors/Arrays/Matrices of dimension <= 50 to be explicitly visible.

Note that, as for other similar commands, the return value of the call is the old (and now replaced) value.

There are pertinent supported file formats available using Export from the Standard GUI's right-click menu.

For example, there are the more modern (XML based) X3D (.x3d) and Collada (.dae) as well as the Persistence of Vision (.pov) and Drawing Exchange Format (autocad's .dxf). Those former two were added in Maple 13 but are not covered in ?plot,device

The documentation of the Export menu in the Standard GUI's 3-dimensional plots could be improved. It is not clear what is meant by its "X3D Geometry". And why is one format labelled "Extensible 3D" when that just stands for X3D anyway? What is the difference between those two choices in the menu?

All the exported formats should be documented for the Worksheet as well as they are documented in the ?plot,device help page. Unfortunately, the relevent ?exportplot help page and the faq are both lacking detail. Those newer supported formats should be documented in ?plot,device at least as clearly as are .pov and .dxf.

I find the submitter's questions hard to understand. I think he might have been asking what is the best all-rounder, so that there is the best chance of further 3rd party conversion down the line. If that is right, then I would suspect that X3D or Collada are not bad choices -- perhaps less limiting that either .pov or .dxf in terms of which applications can handle them (now, and into the future, and at what cost). Some people might want exports in a more popular format even if it entails a cost to handle it. Some other people might prefer exports in a format that is cheap to handle but not in such widespread use. Very tough call, to predict what some particular person wants. And every choice is open to some criticism.

Do you mean something similar to this?

nn,kk:=2,2:

LinearAlgebra:-GenerateMatrix(
  {seq(ap[k]=add(a[n]*sin(n*theta)*f(n,k),n=1..nn),k=1..kk),
   seq(a[n]=add(ap[k]*g(n,k),k=1..kk),n=1..nn)},
  [seq(ap[k],k=1..kk),seq(a[n],n=1..nn)]);

Addressing your coding question (rather than your MapleSim question):

restart:
with(DynamicSystems):
with(numapprox):
L := [0, .8, 2*Pi/(3*sqrt(3)), 4*Pi/(3*sqrt(3))]:
pstyles:=[asterisk, box, circle, cross]:
pcolors:=[blue,green,cyan,gold]:
for tau from 1 to nops(L) do
  sys1 := TransferFunction(pade(exp(-L[tau]*s), s, [3, 3]));
  sys2 := TransferFunction(2/(s+1));
  sys3 := SystemConnect(sys1, sys2, connection = serial);
  sys := SystemConnect(sys3, connection = negativefeedback);
  P[tau]:=ResponsePlot(sys, Step(), duration = 20,
                       legend=[delay=L[tau]], style=point,
                       symbol=pstyles[tau], symbolsize=6,
                       color=pcolors[tau]);
end do:
plots:-display([seq(P[tau], tau=1..nops(L))]);

Something like this?

restart:
eq:=j1*a + j2*b + j3*c + k/d*X = Q:                          
neweq:=isolate(eq,X):                                        

S:=[seq(seq(seq(seq(eval(neweq,[X=cat(X,i),Q=cat(Q,i),       
          j1=r,j2=s,j3=t]),i=1..27),r=0..2),s=0..2),t=0..2)]:

interface(echo=0):
writeto(cat(kernelopts(homedir),kernelopts(dirsep),"jj.tex")):
printf("\$\n"); for ee in S do latex(ee); printf("\\\\\n"); end do: printf("\$\n");
writeto(terminal):
interface(echo=1):

Of course, switch the i=1..27 sequence to be outermost, if you want them grouped by Xi.

The .eps export from Standard, using its default plot device, supports color output.

Use the Standard GUI for this, not the Classic GUI.

In the Standard GUI, use the Layout palette to insert prettyprinted objects like x-subscript-r or conjugate(x) as x-overbar. You can insert those right inside the plot command, in 2D Math mode. Also see the ?plot,typesetting help page.

If you insist on using the Classic GUI, you can set the plot device to maplet.

   plotsetup(maplet);
plot(sin(x),labels=[conjugate(x)*x[r],x^`&ast;`]);

Or you can use a marked-up syntax for those objects (a little like MathML). For example

   plotsetup(maplet);
plot( sin(x), labels=[conjugate(x) * `#msub(mi("x"),mi("r"))`,
`#msup(mi("x"),mo("&ast;"))`] );

How do you get that marked-up 1D syntax for such objects, or for similar objects which don't have a more common presence in 1D notation? How do you discover `&ast;` you might ask? Well, you'd likely have to use the Standard GUI to discover them (once again, most easily using the Layout palette in 2D Math input mode, followed by lprint of the results).

So, it is much easier to just use the Standard GUI altogether, for this sort of thing.

Have you looked into MapleSim? (Yes, it costs. But it looks very impressive. Block diagrams of models are just a tiny part of it.)

I realize that you may be interested only in using Maple to (somehow) create a very small portion of MapleSim's functionality.

First 20 21 22 23 24 25 26 Last Page 22 of 48