Carl Love

Carl Love

26822 Reputation

25 Badges

11 years, 276 days
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity

These are answers submitted by Carl Love

By adding sqrt(1+2*Pi), sqrt(1+4*Pi), sqrt(2*Pi), etc., to the bases used by identify (by using the extension option), I've identified several of the numerical solutions.  If cpu time becomes an issue, reduce the degree used by identify to 2 from its default 6. See ?identify

I'd like to take a look at this. What does it say when it crashes? What are the numbers for "Memory" and "Time" in the bottom edge, right side of your Maple window? What values do you get if you execute the commands kernelopts(cpulimit) and kernelopts(datalimit) in a fresh Maple session?

I took a look at your code, and I think that you're wasting cpu time by checking for small and medium factors with igcd, because isprime already does those checks. Take a look at showstat(isprime).

You set N:= (b-a)/h, with floating point a, b, h; so, N is floating point. But when you access N as the upper limit of a seq, it becomes integer. You should say N:= round((b-a)/h),

Just use eval(sol, _Z1= N) rather than eval(sol, _Z1~= N). A symbol with assumptions cannot be accessed by appending ~ to the name, even if you use name quotes (``); so eval(sol, `_Z1~`= N) will not work either. I don't think that the help is at all clear about this; it just shows an example of using indets to extract the name. 

You have made here a classic example of a programming mistake known as a "fencepost error." If a fence has 10 posts spaced one foot apart, how long is the fence? Nine feet, not 10. (Don't believe it? Then consider the case with just two posts.) Similarly a list with n elements has n-1 adjacent pairs of elements. The loop for i from 0 to c-1 do will execute c times.  If you change the lower bound from 0 to 1, then it executes c-1 times, which is the essence of Adri's brief answer.

If you continue with programming, memorize this bit of mental arithmetic, which you will find yourself using often in any system, not just Maple: The loop for i from a to b executes b-a+1 times, for integers a and b.

Could you state in more precise mathematical (set theoretic) language what you want?  Do you want one of these:

  1. all k in {$1..10} such that there exists a pair (a,b) in A^2 such that the relation holds,
  2. all pairs (a,b) in A^2 such that there exists k in {$1..10} such that the relation holds,
  3. all triples (a,b,k) in A^2 x {$1..10} such that the relation holds?

Also, as Doug pointed out, is the relation a^k = b or a^k = b^2? If the latter, then we can immediately eliminate all odd k.

I tried to download the files from your website, but I could not.  Maybe you could upload them directly. 

Does the fsolve work at, say, Digits = 15?  Try using the fulldigits option to fsolve at your higher value of Digits, 90.


This behavior is not specific to matrices. The object created by making assignments to a subscripted (a.k.a. indexed) name is always a "table". If a list (or Vector, Array, etc.) already exists, then the entries can be accessed by subscripting.  The most common way to create a list is to create a sequence and enclose it in square brackets ("[ ]"). For your example:

M:= [seq(Matrix(2,2, [[1, i], [i, i^2]]), i= 1..4) ]

Function application (f(...)) automatically (i.e. inherently to the syntax) distributes over list (or set ({})) creation, so the above could be

M:= [seq] (Matrix(2,2, [[1, i], [i, i^2]]), i= 1..4)

which I much prefer the look of, especially when the seq command spans several lines of code.


One may be tempted to create a list by repetively appending to an existing list, as in

M:= [];

for i to 4 do

    M:= [M[], Matrix(...)]


This does create M as a list, but the problem is that it creates and discards 4 temporary copies of M.  The time complexity for this will be O(n2) where n is the list length. This will be a problem if n is large.  If one must use a for loop to create the list's entries, it is best to store them in a table within the loop, then convert the table to list outside the loop:

for i to 4 do  M[i]:= Matrix(...)  od;

M:= [seq](M[i], i= 1..4);





[1,2] + [3,4] *~ 3 *~ (x-1)^2;

Enter your integral in unevaluated form, i.e. as Int with a capital "I", and with symbolic e_0 as the upper limit:

t:= Int((1+121/304*e^2)^(1181/2299)*(1-e^2)^(-3/2)*e^(29/19), e= 0 .. e_0);

Then, simply,

plot(t, e_0= 0 .. 0.9);


Note to other readers: In this case, I needed to make sure that Maple did not try to evaluate the integral symbolically.  There is a very serious bug such that evaluating the integral (i.e. value(t)) causes the Maple kernel to utterly and completely crash after using about 11 seconds of processor time.




         dsolve(eval(sys, n= p), numeric)




     ,p in [0.1e-1, .1, .7, 1, 10]



You could use the spreadsheet package.  For example,

> with(Spread):

> CreateSpreadsheet("mySS");

> M:= <<a,b>|<c,d>>:

> SetMatrix("mySS",M):

For example,

plot(1+x, x= -2..2, linestyle= dash, thickness= 3, color= green);

The order of the options does not matter.  For more details see ?plot,options ---probably my most frequently visited help page.

Apparently, fsolve has trouble with double integrals presented in the Int(..., [x= ..., y= ...]) form as opposed to the Int(Int(..., x= ...), y= ...) form.  Note the difference in the following two examples. 

J:= Int(a*x+y, [x= 0..1, y= 0..1]):
fsolve(J=0, a);
Error, (in fsolve) {x, y} are in the equation, and are not solved for

J:= Int(Int(a*x+y, x= 0..1), y= 0..1):
fsolve(J=0, a);

Yet, for both forms type(J, freeof(x)) returns true

You can use the coeff command on either the series form or on the polynomial form that you had before converting it to a series.  If S is your series, then coeff(S,xi,0) and coeff(S,xi,2) will extract the expressions in your example.

First 383 384 385 Page 385 of 385