6247 Reputation

17 Badges

10 years, 107 days

MaplePrimes Activity

These are answers submitted by tomleslie

as implemented, because the command

CodeTools:-Usage( f1(X) ):

executes the procedure once and returns a single 1000X10 Matrix, whereas the command

CodeTools:-Usage( seq(f1(X), k=1..100) )

executes the procedure 100 times and returns a sequence of 100, 1000X10 Matrices

Since in the first case your "active" workspace contains a single matrix, and in the second case your "active" workspace contains 100 matrices, it would be unreasonable to expect the overall memory footprint to be the same


I've seen this one before, but can't find it

Anyhow, the attached (whihc still won't display inline)


will produce the following animation

the attached worked for me - and it still won't display inline on this site!!

but I don't understand why (s)he has used 5*cos(Pi*x) as a boundary condition.

Annyhow, for what it is worth, my solution is attahced - almost exactly the sam as nm, (with the boundary condiion changed)

And inline posting of worksheets is STILL broken:-)

It is always a risk to include a name 'm' and an indexed variable 'm[o]' in the same worksheet.

The latter repesents the o-th entry in the table named 'm' - but what then is represented by the former? A table with some entries? Did you mean to include a table (implicitly) and the o-th entry of that table.

Similar argument applies to r(t), r(0) and r[o] - again the last of these represents the o-th entry of a table 'r'. The first two refer to a function r() evaulated either at 't' or '0' - but what relation to these have to the table?

Do yourself a favour and just avoid this kind of confusing nomenclature.

If I fix these problems with some variable renaming,  I still cannot obtain an analytic solution for your ODE system. However if I assign pretty much random values to all of the unknown parameters, then I can obtain a numeric solution

The attached may (or may not) be what you intend (Pick your own values for the parameters  g, m,: r__o:,m__o, l:=1, and k)

And worksheets still will not display inline on this site - this has been broken for several days now - so you will have to download the attached to read/re-execute



If I just "lift" expressions for 'beta', 'j1',  'j2' and the integral 'V' from the reference you provide, then the attached produces the required answer after about 5seconds.

Comparing the integral being performed in the attached with that given as eq(11) in the worksheet you provide, there are a few discrepancies - not sure which of these are significant, but it may give you something to think about!

And inline display of worksheets is still broken, so you will have to download


I just tried to reproduce this problem in Maple 2020 on 64-bit Windows 7.

The eps file for

plot3d(x^2+y^2, x=0..1, y=0..1);

took waaaaay longer to produce than I would have expected - about 30secs on my machine to produce a 2.08MB file: that's not good

However the resulting eps file, looks just fine in GIMP (which just happens to be my "goto" for all graphics formats)

sensibly approximate a function containing powers such as x^57 into anything which contains powers less than x^57 - so give up on this thought process.

You state that

I need to replace x with a series of sin and cos functions and then find specific coefficients that have that sin or cos. In the current form Maple cannot find the coefficients of sin and cos.

which is also incorrect.

I suggest you xampine the attached "toy" example very carefully - and if the basic technioques do not satisfy your requirement, then you are going to have to explain your specific problem a lot more clearly

This site is still currently refusing to display worksheets inline (been broken for a few days now), so you will have to download the attached to examine)


but apparently not.

coeff() can only consistently be used with polynomials whihc have integer powers of the target variable. You expression has fractional powers of 'epsilon'

However it is relatively straightforward to define a 'dummy' variable (say XX) equal to epsilon^(1/2) and the expresssion now becomes a polynomial in this dummy variable, with (for example) the coefficient of XX^5 be identical to the coefficient of epsilon^(5/2)

The method is shown iin the attached, which still won't display inline here


emphasis added

Unlike arrays, where indices must be integers, the indices (or keys) of a table can be any value.

I always think of a table as having keys and entries - for example


is a perfectly reasonable way to create a table with two entries and


will return

table([bar = 2, foo = 1])

It is of course possible to use integers as the keys of a table - although if you are doing this, it might (?) be better to consider using an Array() instead

The coeff() command only works on polynomials - ie where the target variable is raised to integer powers. Since your expression contains epsilon^(5/2) and epsilon^(3/2), it is not a polynomial, and hence coeff() cannot be expected to work.

However one can transform your expression into a polynomial by making the (formal) substitution  epsilon^(1/2)=XX, at which point the coeff() function will "work".

coeff(expr, XX, 4) is the coefficient of epsilon^2
coeff(expr, XX, 2) is the coefficient of epsilon^1

See the attached, where

  1. I have written your 'PDE' properly
  2. I have only been able to verify correctness back as far as Maple 18 (about 6 years old). I haven't got access to Maple 11 (about 13 years old)

And worksheets still won't display "inline" here - this facility has been broken for a few days now!


The first loop in your procedure starts with

for i to n do
local Z:= Matrix(3^(i-1)$2, 0);

and the second loop uses

for j to n do
local Z:= Matrix(3^(i-1)$2, 0);  # ,<- should be Matrix(3^(j-1)$2, 0)??

In the attached I have fixed this - inline display of worksheets on this site seems to be broken (again!!!), so you will have to download




For any value of the initial condition, I'd say that this ODE always has a singularity - either at x=0, or very shortly afterwards.

See the attached, which for some reason isn't displaying "inline" here


This problem is "small" enough that a brute force search, as given in the attached, is feasible (although more "elegant/efficient" approaches may exist?)

Note the attached lists all combinations for a given target number, eg

129=2^2+5^2+10^2,   2^2+3^2+4^2+10^2,    4^2+7^2+8^2,   2^2+5^2+6^2+8^2,   2^2+3^2+4^2+6^2+8^2

(For some reason this worksheet isn't displaying inline here - haven't got the time/energy to figure out why!)


You want to know,

"in which range of K, Q is purely imaginary. in which range of K, Q is real and in which range of K, Q is complex."

Consider, for example, solutions when K=1:

solve(eval(eq, [p=1e-04, s=7.14, K=1]))

will return thirteen solutions

0., -1., -10.99068623 - 11.18527722*I, -10.99068623 + 11.18527722*I, -4.423980687*I, 4.423980687*I, -7.691130103*I, 7.691130103*I, -10.88102438*I, 10.88102438*I, 1.

of which

three are real,
six are purely imaginary, and
four are complex

3 4 5 6 7 8 9 Last Page 5 of 132