Joe Riel

7919 Reputation

22 Badges

14 years, 312 days

MaplePrimes Activity

These are answers submitted by Joe Riel

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


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.


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.


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');
       [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]);

frontend can be used here

y := -sin(alpha)*(sin(theta1)*cos(theta)-cos(theta1)*sin(theta)):
frontend(combine, [y], [{`+`,`*`},{theta,theta1}]); 
                        sin(alpha) sin(-theta1 + theta)

A better choice is to use add rather than sum.  Even better is to cache the results.  Consider

f1 := n->piecewise(n=0,1,n>=1,add(thisproc(k),k=0..n-1)):
f2 := proc( n :: nonnegint)
option cache;
local k;
    add(thisproc(k), k = 0..n-1);
end proc:
f2(0) := 1:  # Directly assign the value for n=1

n := 20:
memory used=0.53GiB, alloc change=32.00MiB, cpu time=9.94s, real time=9.94s, gc time=196.00ms
memory used=6.08KiB, alloc change=0 bytes, cpu time=0ns, real time=0ns, gc time=0ns

The second version runs much faster.

Apologies for the belated reply.  The basic problem is that there are bugs in that version of CodeBuilder.  I've uploaded a new version to the MapleCloud (but not to the Maple Application Center).  With Maple 2017 you should be able to download it from the MapleCloud palette.  Alternatively, you can do execute the following statement, which should install it.

First 6 7 8 9 10 11 12 Last Page 8 of 102