## 584 Reputation

12 years, 348 days

## get name of current document/worksheet...

does maple provide a way to programatically get the name of the "current" worksheet file?

I'm looking for something analogous to
interface(worksheetdir);

which gives the directory the worksheet file is in.

thanks.

## best way to split up expressions...

Maple

what is the best way to "extract" a list of terms from a sum of terms.

So something like this::

split_expr(a+b+3) should return [a,b,3]

split_expr(diff(x(t),t)) should return  [ diff(x(t),t)]

split_expr(Int(abc(t), t=2..3) + 3) should return [Int(abc(t), t=2..3) , 3]

I very often have expressions with sums of many terms, and need to run some command on each element (say simplify, or collect, etc)... i've been using convert(expr, list) to split things up, apply a command and recombine, but the convert command breaks on some cases. Maybe this is something that maple can do natively?

thanks!

## coeff with negative powers...

Maple

what is the most elegant way to get coefficients of a series that contains negative powers.

for example in this:

tt := a*N__s^3 + N__s + CSxSx__0 + CSxSx__1/N__s + CSxSx__2/N__s^2 + CSxSx__3/N__s^3;

i would like

fancy_coeff(tt, 1/N__s, 3)

to give me `CSxSx__3`

while

fancy_coeff(tt, 1/N__s, -3)

give me `a`

(the standard coeff call doesn't work with this, as would be known to people here)

thanks!

## simplify expression under sqrt ...

Maple

what's the easiest way to have maple simplify the expression below from 'expr1' to the form of 'desired_form'? mathematica automatically simplifies to that (subjectively of course!) much nicer looking form.

 > restart:
 >
 > expr1:=-lambda-(1/2)*kappa__c-gamma__p-(1/2)*sqrt(-16*N*g^2+4*lambda^2-8*lambda*gamma__p+4*lambda*kappa__c+4*gamma__p^2-4*gamma__p*kappa__c+kappa__c^2);
 (1)
 > desired_form:=1/2*(-2*gamma__p - kappa__c - 2 *lambda - sqrt(-16*N*g^2 + (-2 * gamma__p + kappa__c + 2 * lambda)^2));
 (2)
 > expr1- desired_form: simplify(%);
 (3)
 >

## Implicit=false in Eigenvectors() vs Eige...

Maple

how can i get an 'implicit=false' form (no RootOf) of my eigenvalues from the Eigenvectors() command? Should one expect the behavior be the same in Eigenvectors() and Eigenvalues()?

thanks

 > restart:
 >
 >
 > M:=Matrix(3, 3, [[-2*lambda-kappa__c, -2*sqrt(2)*g, 0], [(1/2)*g*N*sqrt(2), -lambda-(1/2)*kappa__c-gamma__phi, -sqrt(2)*g], [0, g*N*sqrt(2), -2*gamma__phi]])
 (1)
 > LinearAlgebra:-Eigenvalues(M); #this is what i want but from Eigenvectors()
 (2)
 > LinearAlgebra:-Eigenvalues(M, implicit=true); #RootOf notation; not what i want, but option works here
 (3)
 > evals, evecs:=LinearAlgebra:-Eigenvectors(M); #RootOf everywhere;
 (4)
 >
 >
 > evals, evecs:=LinearAlgebra:-Eigenvectors(M, implicit=false); #still RootOf everywhere;
 (5)
 >
 >