Joe Riel

7712 Reputation

22 Badges

14 years, 133 days

MaplePrimes Activity


These are answers submitted by Joe Riel

Because s is a global, it won't use the local values passed to x and y as parameters. You could workaround that by doing

si := proc(x,y) 
    if R < x^2+y^2 then
        eval(s, [':-x'=x, ':-y'=y]);
    else
       ...
    end if;
end proc:

Any O/S tool that can search for a string in files will suffice. If all the worksheets are in one directory you could do, say, 

grep VariationalCalculus *.mw

If they are in different directories you could use a find or locate facility. However, I suspect that if you had these tools you would probably already have used them.

Use the form of savelib that specifies the archive. For example

savelib('Plotter',"plotter.mla");

The simple reason is that it does so, by design.  Probably it would be useful to have an option that prevents that. Why do you need the second form?

One approach is

Plots:-PointPlot([[seq([t,R(t)], t=500..5000)]);

Why are you using matrix rather than Matrix?  Here's how I do that with a Matrix; I believe a similar form is doable with matrix.

 Matrix(3, (i,j) -> cat(s,i,j)/cat(x,j));

The reason that doesn't work is that the two matrices are different. Each invocation of Matrix creates a distinct matrix. Similarly for Vectors and all mutable elements.  A mutable element is a structure whose content can be modified without creating an entirely new element. 

The part that I'm finding strange is that you seem to have an algebraic expression with Matrices as elements.  That's a bit strange, as a Maple expression. Could you give a simplified example of what you are dealing with?

Kitonum's response gets the job done. An extension to this question, which the user should consider, is how to do the same thing in three dimensions.  From the given response, one might expect that the natural extension would be

plot([xt,yt,zt,t=0..1]);

where xt, yt, and zt are the x, y, and z algebraic expressions of t. Alas, that won't work. There are two problems with it. First, the proper command for a 3D plot is plot3d, not plot. Second, the same parametric notation used for a 2D curve does not work in 3D. The usual way to do this is to use the plots:-spacecurve command:

plots:-spacecurve([xt,yt,zt], t=0..1);

plot3d does have a notation for handling parameric surfaces, not curves; see its help page for details

The predicate (first argument) to select must be a procedure that returns a boolean. Use the following

select(p->findOrderOf(2,p)=p-1 and findOrderOf(3,p)=p-1,primes);

What do you expect as the output?  The usual way to run Maple from a command line is to run maple scripts (typically .mpl files); they contain standard Maple commands. I do this regularly, though from Linux, not Windows. You can convert a .mw file to a .mpl file by exporting it as such (File > Export As, then select Maple Input (.mpl). To execute the script, you pass it to tty maple, which on Windows is named cmaple and is in the bin subdirectory of the Maple installation.

Followup

On Windows the executable is in bin.X86_64_WINDOWS, at least on a 64 bit install. Ideally you would set %PATH% to access the directory, but without that you can do, at a DOS prompt

> "c:\Program Files\Maple 2017\bin.X86_64_WINDOWS\cmaple.exe" myfile.mpl

where myfile.mpl is the Maple script file you want to run.

If you double-click the Probe Plots selection in the bottom left pane of the Simultion Results window, the plot will appear. I'm not sure why it isn't appearing automatically.

Further 

It appears as though the visibility of that plot is initially off.  Maybe it was accidentally toggled before the file was saved. Double-clicking toggles the visibility; you can also right-click to bring up a context menu.

You have a space or something between the first ::.  The following works

patt := x::symbol^n::symbol /  y::symbol^n::symbol: # verify this is parsed correctly
patmatch(x^n/y^n, patt, 'eqs');
                                true
eqs;
       [n = n, x = x, y = y]

The result is, uhh, correct.  The condition a > b evaluates to 1 > 3 which is false, so the else clause is executed.

It seems to work here; moving the sliders updates the corresponding figure and adds data to the tables. 

A few comments.  There is no good reason to use with(DocumentTools) inside a use DocumentTools in ... end use; structure (that is done in the code for DataTable0). Putting a restart in embedded code has no effect; a restart is only available at the top level (that also exists in the code for DataTable0).

Further The code for the first slider is updating DataTable1, not DataTable0, which is the data table that is adjacent to it. So maybe that's your problem.

P operates on lists. To use it with map, the mapped structure should be a list of lists. So

map(P, [[A1, A2, A3, A4]], [B1, B2, B3, B4]);
4 5 6 7 8 9 10 Last Page 6 of 100