Carl Love

Carl Love

28100 Reputation

25 Badges

13 years, 106 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are replies submitted by Carl Love

@Kitonum 

Your code fails for many special cases, such as when the variable appears to power 1, when the variable appears multiple times in the expression, and when the variable does not appear in the expression.

@liushunyi To obtain just the sequence do

seq(coeff(p, x, k), k= degree(p,x)..0, -1);

or

PolynomialTools:-CoefficientList(p, x, termorder= reverse)[];

In general, if L is a list or set, then L[] is the corresponding sequence. The same thing can be achieved with op(L), but the operation is so common that that just clutters up the code.

@Mac Dude Indeed, I'd recommend that the OP use the interface command that you gave because "I don't want to click on 'properties' each time I execute my worksheet."

Please give us the commands that you are using to do the export.

@casperyc 

S:= map(x-> sprintf("%a", lhs(x)), v1):
S:= map(StringTools:-PadRight, S, max(length~(S))):
R:= rhs~(v1):
seq(
     printf("%s = %s %3.3f\n", S[k], `if`(R[k]<0, "-", "  "), abs(R[k])),
     k= 1..numelems(v1)
);

eta[p2]   =    0.260
eta[p3]   =    0.113
eta[p4]   = - 0.013
eta[p5]   =    0.215
eta[p6]   = - 0.189
eta[phi2] =    0.020
eta[phi3] =    0.063
eta[phi4] = - 0.014
eta[phi5] = - 0.414
eta[phi6] =    0.067
mu[p]     =    0.466
mu[phi]   = - 0.169
tau[p3]   =    0.000
tau[p4]   =    0.000
w[1]      =    0.023
w[2]      = - 0.447
w[3]      = - 0.110
w[4]      =    0.035
w[5]      =    0.445

@Alejandro Jakubi Thanks for the powsubs info. Yes, that's the key to what's unusual about this particular usage of changevar. I noticed that

subs(sinh(x)= sqrt(tanh(x)^2/(1-tanh(x)^2)), e)

yields a more-complicated expression.

@Mac Dude In your code

Matrix(<seq(<x|x^2>,x=1..10)>);

the Matrix is superfluous. The angle brackets already make it a Matrix.

@mehdi jafari 

P:= proc(M::seq(realcons))
local n,x;
     plot([seq](1+2*(1+x)^n, n= M), x= 0..5, legend= [seq]('n'=n, n= M))
end proc:

P(-1, -1/2, 0, 1/2, 1);

@nm How did it occur to you that student[changevar] would do the trick?

Welcome to MaplePrimes, Roby. It is very helpful for the people who will debug your code here that you either post your code in plaintext form or that you attach a worksheet or both. That way they do not need to retype it. You can attach a worksheet by using the green arrow, which is the last item in the second row of the toolbar of the MaplePrimes editor.

Float(undefined) is not always an indication of an error. For example, it is a reasonable and correct answer to

evalf(Int(sin(x), x= 0..infinity));

 

When you're asking Maple for an exact solution, it is best to avoid the use of floating-point constants. You should change 0.048 to 48/1000. If you still get Float(undefined) (rather than simply undefined), that would be an indication of an error.

@gkokovidis wrote:

plot([seq(1/x, x = 0.1 .. 1,.1)], ([seq(x^2, x = 0.1 .. 1,.1)]), style = line);

The same thing can be achieved with

plot([1/x, x^2, x= 0.1..1]);

with the added benefit that plot chooses the intermediate values of x.

@Carl Love 

In Maple 16, I am having the same problem as the OP with releasing the memory, even after I clear %, %%, and %%% and run gc() several more times!

@casperyc 

Yes, if the operation is adding a new element to an existing container, it seems that the best container to use is a Vector. This is surprising; stretching a Vector past its declared bounds is an expensive operation in many languages. I don't know how Maple manages this.

It is best to use seq and other built-in list-processing commands such as select rather than a for loop. Though sometimes there's no way to avoid the for loop. However one can always avoid the dreaded list-stretching operation L:= [op(L), x].

@Joe Riel 

Thanks, Joe. I knew about _rest at one point, but I had forgotten. Code updated in Answer.

@Muhammad Ali 

I am using Maple 18.00 / 64 on Windows 8.1 / 64.

First 536 537 538 539 540 541 542 Last Page 538 of 709