## dharr

Dr. David Harrington

## 6277 Reputation

19 years, 347 days
University of Victoria
Professor or university staff

## Social Networks and Content at Maplesoft.com

I am a professor of chemistry at the University of Victoria, BC, Canada, where my research areas are electrochemistry and surface science. I have been a user of Maple since about 1990.

## Thanks for the help on help...

Thanks for pointing me there, I would never have found. I can now do what I want to. BTW, you can save at least simple *.mw files as help pages with makehelp (which just reads the lines and calls INTERFACE_HELP), but not sure which features you might lose.

## It is a problem in a program...

I agree about the difficulty and annoyance in a long code of finding such problems. But qualified responses could quickly get complicated. Consider solve(a*x^2+b*x+c,x); This needs a qualification that a<>0, which is simple enough. But should it also be mentioned that there is one answer, not two, if b^2=4*a*c? And that if a=0, then the solution is -c/b unless b=0, in which case the equation doesn't have x in it any more ... Cheers, David.

## implicit restrictions...

I think Maple frequently gives results that have restrictions; a simpler example is simplify(c/c), which is also not true for c=0. Likewise solve(1=(x+1)/(x+1),x); returns x, but x=-1 is not acceptable. If Maple is too fussy, then one never gets to a useful result, so I don't consider this a bug as such.

## StringTools can help...

Try with(StringTools): sentence:="This sentence, isn't interesting"; Split(sentence);remove(type,%,"");Join( %, " " ); Words(sentence);Join( %, " " ); Split keeps punctuation, but Words throws it away, so it depends on what you want.

## Descartes rule of signs...

Sorry, I was thinking all roots real. If the signs of the coefficients are known, then Descartes' rule of signs can tell max number of real roots, but there can be less, so finding when there is an exact number of real roots is a pretty difficult problem.

## Hurwitz function can help...

Try: R:=alpha->3*alpha^6-6*alpha^5*delta+(6*delta*a-c_p+mu^2-4*a^2)*alpha^4+mu^2*(6*delta*a-c_p+mu^2-4*a^2)*alpha^2-6*delta*alpha*mu^4+3*mu^6: with(PolynomialTools): Hurwitz(R(alpha),alpha,'s','g'); s; which gives the output [0, -1/2*alpha/delta, -6*alpha*delta/(6*delta*a-c_p+mu^2-4*a^2), 1/6*(6*delta*a-c_p+mu^2-4*a^2)^2*alpha/(mu^2*(-2*mu^2-4*a^2+6*delta*a-c_p)*delta), (-12*mu^2-24*a^2+36*delta*a-6*c_p)*delta*alpha/((6*delta*a-c_p+mu^2-4*a^2)*(-2*c_p-mu^2-8*a^2+12*delta*a)), -1/12*(-2*c_p-mu^2-8*a^2+12*delta*a)^2*alpha/(mu^2*(-2*mu^2-4*a^2+6*delta*a-c_p)*delta), -4*(-2*mu^2-4*a^2+6*delta*a-c_p)*delta*alpha/(mu^2*(-2*c_p-mu^2-8*a^2+12*delta*a))] I haven't used this much, but understand that for real roots you need the coefficients of alpha in the (Stieltjes) sequence (after the first entry) all to be positive. So looking at the second entry: -1/2*alpha/delta delta must be negative. So now looking at the next one: -6*alpha*delta/(6*delta*a-c_p+mu^2-4*a^2) Since delta is negative the denomimator must be negative to get this positive, etc, etc. So you can build up conditions on the parameters to get real roots. More information of this method is given in the reference at the end of the Hurwitz help page: N. Levinson and R.M. Redhoffer, Complex Variable, 1970.

## complicated expressions...

Hi, Thomas, I think I owe you one. Hard to say without seeing it, but sounds like you just need to force Maple to re-order it, perhaps to get terms close enough. I'd try collect (in z1 or some combination of the variables; probably not important which) and then simplify again. Sort might work as well. Cheers, David.

## asymptotic expressions for Bessel functi...

If you specify an order, it can give a series, e.g., asympt(BesselI(2,x),x); works. I suspect that the form of the series depends strongly on the order (e.g., integer or half integer) and Maple doesn't want want to give a universal answer. What answer did you expect?

## substitute a name...

Not elegant but this works y:=x^2+2*x+5; eval(y,x=`2`); # or: subs(x=`2`,y);

## built in command...

Maple can check for positive definite using the IsDefinite command from the LinearAlgebra package.

## new line, same execution group...

Use shift-enter to generate a new line without executing the command.

## networks package...

The networks package produces the adjacency matrix from a graph, but not the other way around. So you could program yourself to go from the matrix to the graph using the addvertex and addedge commands, then "draw" would plot the graph.