Items tagged with code code Tagged Items Feed


I need to be able to find the difference between the ith+1 and the ith element of a sequence and store that difference in another list. My code so far doesn't seem to be able to do that. My code is below. Thank you in advance to anyone taking their time looking at this, any help is greatly appreciated!



Kind regards,

Gambia Man

I'm trying to run c code generated from a simple MapleSim example (Spin Up Beam). To makes things even simpler, I set the input real expression to just time, and changed the input function in my c code to:

static void inpfn(double T, double *U)
U[0] = T;

I set all the state variables to 0 for the initial conditions. I ran the code and my output doesn't resemble the MapleSim output at all, and I'm getting errors. So my question is about the state variables, which I initially set to 0:

* State variable(s):
* x[ 0] = `Main.SpinUpBeam.FB3.uf1`(t)
* x[ 1] = diff(`Main.SpinUpBeam.FB3.uf1`(t),t)
* x[ 2] = `Main.SpinUpBeam.FB3.uf2`(t)
* x[ 3] = diff(`Main.SpinUpBeam.FB3.uf2`(t),t)
* x[ 4] = `Main.SpinUpBeam.FB3.vf1`(t)
* x[ 5] = diff(`Main.SpinUpBeam.FB3.vf1`(t),t)
* x[ 6] = `Main.SpinUpBeam.FB3.vf2`(t)
* x[ 7] = diff(`Main.SpinUpBeam.FB3.vf2`(t),t)

What do these represent for this flexible beam (FB3)? I.e. what is uf1, uf2, vf1, vf2? Should they be set to 0, or no?


The title pretty much says it, but I wrote a bunch of code that operates on a matrix of given size. Now I want to increment that size with a loop, how can I put a loop around all the code? It won't let me just copy paste it into my loop body for some reason. Thanks!

Social Golfer Problem

So we have 8 golfers : 2 golfers per group and 4 groups.Over several golfing days, how can they be arranged so no golfer plays with the same player twice.

turns out they can play for 7 days.

So my attempt in

For 3 players per group and 4 groups this is the arrangement over 4 days:

(these was done in wolfram demonstrations project but the code appears to be obfuscated)

 Maple code when open saved maple sheet?

and keep it can run code and show latest result after open

i mean user can not extend or find code or display code in maple sheet , just can run result


i have been looking to see if i could get the source code for some of the calculus functions in maple. So far, i have tried this

kernelopts(opaquemodules = false)

interface(verboseproc = 3)


which shows the result

module() ... end module

does anybody have any idea how i would:

1) get the full list of sub-procedures in the module

2) get the source code of any of the sub-procedures in the module?

Thanks in advance!!

I have a series of formulae arranged as a vector.  I need to do two things to this vector:

(1) Optimize it using 'tryhard'.  

(2) Use the optimized results to create a new procedure.


I can do either (1) or (2) alone, but when I try to combine them as one command it never works.  A simplified example of what I'm attempting with the resulting error message is below:

with(codegen, optimize, makeproc);
V := Vector(4);
V[1] := x+y;
V[2] := x^2+y^2;
V[3] := x^3+y^3;
V[4] := x^2+y^2+x+y;

T := makeproc([optimize(V, 'tryhard')], [x, y]);

Error, (in codegen/makeproc) Unrecognized input [t78 = x+y, t73 = y^2, t74 = x^2, t77 = t73+t74, t1 = (Vector(4, {(1) = t78, (2) = t77, (3) = t73*y+t74*x, (4) = t77+t78}))]

It seems that makeproc cannot handle a combination of optimized assignments and a vector of formulae.  Is there anyway to fix this?



I would like to import the code from Pg 90 on in the following document into Maple. Any suggestions for doing so with minimal editing required after pasting?


Is there a way to convert this FDTD code into Maple

Hy(1 to M)=0;

Ex(1 to M+1)=0;

For t=1 to T,


For k=1 to M,



For k=2 to M,




Thanks in advance.

I ran into a problem mentioned here before: With lots of code in one execution group, the standard GUI editor becomes very slow at least in older versions of Maple (I have reason to believe that this is mostly fixed in Maple 17 and, presumably, newer). With one of my packages this has become enough of a problem to force me to deal with it (and Modules and Packages have to be all in one execution group). I have some machines that cannot go beyond Maple 15 so I keep my stuff compatible with it (so far not a big sacrifice).

The fix is rather easy: In the GUI, export the code as "Maple Input" which creates a file with extension .mpl. Then, in the GUI have a small file that uses "read" to read-in and execute the code (of the module). In my case, I have the necessary LibTools statement to save as a .mla right after the package code ends so, bingo, I have just updated the package. I edit the .mpl file in Emacs.

So I installed Joe Riel's Emacs mode maplev-mode.el. This works rather well. However, it took not long for it to show its age: it does not recognize the multi-line comments (*...*). This is kind-of bad as this forces me to not use quotes in the comments since they mess-up the keyword highlighting esp. when using single quotes as in "I'll" and so on. Likewise, maplev-indent-buffer messes up the whole buffer as it interprets the multiline comments as code.

So my question is: is someone still working on this and using it?? I guess I can work around some of these things, but it would be nice if this worked.

Incidentally, my version of maplev-mode.el seems to be dated June 2005.

I know Joe is here on occasion, maybe he can chime in. It is not absolutely fatal; I could forgo using maplev, but if I am forced to go this route of readin in the package; using maplev-mode at least gives me something in return. Unfortunately my elisp skills are not quite up to fixing this myself; at least not in a reasonable time.

If it is relevant: I use Emacs 22.1 on Mac OS X. Yes, I could upgrade to at least Emace 23.4, if that were the issue.

Thanks in advance,

Mac Dude

Hello everyone!!

I am beggining to use Maple and i saw there are many Math Apps in the Library. I was wondering if I can see the source code of some of this Math Apps to learn how to do my own ones.

I got a code file and i dont know how to load it in Linux. In Windows i just type:

read "E:/code.txt"

But thing now i change to use Linux and cant do the same (Maple 2015 64bit Linux ver), try to load

read "/root/Desktop/code.txt"

It show me that:

I click Cancel and it show me:

Hope can help me another ways to use and load my code to run.


      I am a student doing some self study over the summer trying to work through some of the John Taylor computer problems from his classcial mechanics book. Currently I hit a snag that most likely comes from the fact I am not well acquinted with Maple for solving IVP and DE's (we used Matlab in my DE class). I just need to know how I remove the following error:

Error, (in dsolve/numeric/SC/IVPsetup) initial conditions must be numeric

Here is a copy of my code:

R := 5;
g := 9.8;
deq1 := {diff(x(t), [`$`(t, 2)]) = -g*sin(x(t))/R, x(0) = 20};
/ d / d \ \
{ --- |--- x(t)| = -1.960000000 sin(x(t)), x(0) = 20 }
\ dt \ dt / /
dsol1 := dsolve(deq1, numeric);
Error, (in dsolve/numeric/SC/IVPsetup) initial conditions must be numeric

My hunch is that I need to set x'(0)=0 or something like I do not have enough intial values to solve the problem, but I could be wrong. Anyway anyone who can point out my mistake feel free to do so! Thank you!

Dear Colleges

I have a problem with the following code. As you can see, procedure Q1 converges but I couldn't get the resutls from Q2.

I would be most grateful if you could help me on this problem.


Sincerely yours




reynolds:=12734151.135786774055543653356602;     #10^6;   #1.125*10^8:

Q:=proc(pp2) local res,F0,F1,F2;
if not type(pp2,numeric) then return 'procname(_passed)' end if:
end proc;

Q2:=proc(rr2) local solT,T0,T1;
if not type(rr2,numeric) then return 'procname(_passed)' end if:
end proc;



$15 is spread among four different bags. How  can you can make any whole number of dollars from $1 to $15 by selecting some of these bags of money, without taking any money out of the bags.
How is the money distributed ?

One bag must have $1 in it.
To be able to make $2, and each bag is different, so one bag must have $2 in it.
 can now make $3, but can’t make $4, so the third bag must have $4 in it.
With $1, $2 and $4 in three bags, can make every total up to $7. The last bag has the rest of his money in it – $8.

so the answer is $[1,2,4,8]

wondering how to do this with maple procedure. unsurprisingly my code doesn't work



1 2 3 4 5 6 7 Last Page 1 of 14