
Re: Symbolic manipulation with Sqrt[1] ?
Posted:
Dec 7, 2009 2:21 PM


clicliclic@freenet.de wrote: > Axel Vogt schrieb: ... >> And it does not work for constants like simplify( 1/sqrt(2), {2=y^2} >> ). > > Do I understand you correctly that it is impossible in Maple to > substitute something for arbitrary subexpressions? Are only variables > (and predefined constants like I) allowed? Would > > eval( 1/x^2, x^2 = y^4 ); > > or > > eval( 2*cos(x^2), cos(x^2) = sin(y) ); > > be forbidden syntactically? > > Martin.
G A Edgar already said it, here is a bit more ...
2*x; subs(2=a, %); # or eval(%, 2=a);
x a
For 1/sqrt(2) it does not work, since it is given by 1/2*2^(1/2).
Note however:
eval( 1/sqrt(2), 2=y^2); 2 1/2 (y )  2
thus the '2' in the two 1/2 of are not replaced. But with string processing one certainly could enforce that (which should work for replacing 'I' as well, but that is ugly for my taste).
I think that comes from the internal representation, which may be different from what 'we' see & recognize or is shown on the screen (Maple uses a DAG, a directed acyclic graph, but is too long ago that I played with that, for me as user it usually is too deep in the implementation details).
The simplify with side relations seems not to work for constants, but the usual command works
simplify( 2, {2=y^2}); 2
eval( 2, {2=y^2}); # or subs ... 2 y

