Michael

212 Reputation

11 Badges

17 years, 286 days

MaplePrimes Activity


These are questions asked by Michael

Hi:

I am using solve(...,allsolutions)

and Maple is giving me the default "_Z1~" as part of the solution. No problem.

But when I go back and run the same statement again without a restart, it gives me "_Z2~" and my program fails because it is looking to substitute a value for "_Z1".

How do I reset the naming convention without restarting so I can get the same output each time I run the same statement. (BTW: The same thing happens with Veil where it increments the indices of the Veil symbol each time you run the same statement)..

Thank you.

I have an expression of the form X=a/f^b where a and b are both numeric. How do I elegantly extract the numerical values of "a" and "b" given X? See below for my kludge solution.

Problem: extract two numerical values from an expression. Surely there is a more elegant way?
Here is the form of the expression.

restart;
X:=a/f^b;

a/f^b

(1)

Find a and b when they are numbers.
X1:=subs(a=1.234,b=6.789,X);

1.234/f^6.789

(2)

indets(X1);
fterm:=op(2,%);
log(fterm);This sometimes works and yields 6.789*log(f) but I've never been able to figure out when it is going to work and when it won't work.
#log(fterm,f);This never works

{f, 1/f^6.789}

 

1/f^6.789

 

ln(1/f^6.789)

(3)

b:=-op(2,fterm);

6.789

(4)

a:=X1*f^b;

1.234

(5)

Isn't there a better way? This requires that the "op" indices won't ever change and that is asking a lot if this is embedded in a larger program.


 

Download Extract.mw

 

In Hansen's book "A table of Series and Products" there is an unsourced listed identity 43.6.1:

S1 := Sum(2^k*tanh(2^k*x), k = 0 .. n - 1) = 2^n*coth(2^n*x) -   coth(x)

It appears to be to be numerically correct, and can be obtained from a second identity

S6:=Sum(2^(-k)*tanh(2^(-k)*x), k = 1 .. n) =- 2^(-n)*coth(2^(-n)*x) + coth(x)

by "summing in reverse order". S6 is also numerically correct.

Starting from S1 and reversing the order, gives

S2 := Sum(2^(n - k - 1)*tanh(2^(n - k - 1)*x), k = 0 .. n - 1) = 2^n*coth(2^n*x) - coth(x)

Then shifting the index gives

 S3 := Sum(2^(-k)*tanh(2^(-k)*x), k = -n + 1 .. 0) =  2^n*coth(2^n*x) - coth(x)

both of which test OK numerically since n>0. Now it begins to get strange.

In S3, let n->-n (highly illegal) to obtain

S4 := Sum(2^(-k)*tanh(2^(-k)*x), k = n + 1 .. 0) = 2^(-n)*coth(2^(-n)*x) - coth(x)

and, surprisingly Maple tests S4 to be correct numerically.

Here's how that happened. The lower limit of the S4 sum exceeds the upper limit, so there are three possible ways to interpret this:

1. In standard mathematical usage, this is usually set to zero by caveat;

2. In a practical sense, one might expect the order of summation to be irrelevant so S4 is the same as

S5:= Sum(2^(-k)*tanh(2^(-k)*x), k = 0 .. n + 1) = 2^(-n)*coth(2^(-n)*x) - coth(x)

but that fails numerically.

3. Maple has a built-in algorithm (see the help page on "Sum") that interprets

Sum(f(k), k = m .. n) = -Sum(f(k), k = n + 1 .. m - 1)

when m exceeds n and that is why S4 works numerically and, when applied to S4 gives the result S6.

So where did Maple's prescription come from, and what is it's justification?

Thank you

I want to know the exponent of one particular factor of an integer. For example:

k:=24;

ifactor(k) = (2)^3(3)

and I want to write a module to extract the exponent of (3) for any arbitrary k.

I can't select for the presence of 3 because it will pick up the factor (2)^3 and then it gets complicated to decide that I don't want this factor anyway.

If I somehow manage to select the factor (3) using "op" and scanning through each factor in turn, then substitute 3=x, it turns out that degree(%,x) doesn't work because the factor x is enclosed in brackets; similarly trying

log(%,3) fails for the same reason.

There has to be a simple way, but I just don't see it.

Any suggestions are appreciated.

1. How did Maple come up with this answer?

I've tried all the packages in SumTools and none of them give an answer except Hypergeometric.

2. Is there a way to trace the steps Maple is using so I can try and answer this myself?

3. Why did it sum the series when I didn't even ask - I deliberately used the inert form (no arguments though - I like what it did).

Thank you.

______________________________________________________________________________

H1a := Sum(GAMMA(2*b - 1 + 2*n)*GAMMA(2*n - s)*(b - 1/2 + 2*n)/(GAMMA(2*b + 2*n + s)*GAMMA(2*n + 1)), n = 0 .. infinity);

H1b:=convert(H1a,Hypergeom);

The answer H1b it came up with is 

GAMMA(-s)*2^(1 + 2*b)*GAMMA(b)/(8*GAMMA(b + s)*2^(2*b));

which seems to be correct.

1 2 3 4 5 6 7 Page 1 of 8