Slawomir Kolodynski
2018-09-30 16:41:57 UTC
Suppose I have an expression like *(y-m)*sqrt(x)/s* . What I would like to
do is to give a name *e* to the *sqrt(x)/s* part and do some kind of
transformation on this expression so that I get *(y-m)*e *or equivalent as
the result*. *To do that I define a rule
substE := rule (('y-'m)*sqrt('x)/'s == ('y-'m)*'e)
However, when I try to apply this rule to the expression
substE (y-m)*sqrt(x)/s
I get the *(y-m)*sqrt(x)/s *expression back instead of *(y-m)*e. *It looks
like the left hand side of the equality in the rule substE does not pattern
match itself.
Curiously, without sqrt a similar rule works as expected:
substF := rule (('y-'m)*'x/'s == ('y-'m)*'e)
substF ((y-m)*x/s)
gives e*y - e*m
Can you explain what is the difference here and how to approach the goal of
substituting a subexpression with a symbol?
Thanks,
Slawomir
do is to give a name *e* to the *sqrt(x)/s* part and do some kind of
transformation on this expression so that I get *(y-m)*e *or equivalent as
the result*. *To do that I define a rule
substE := rule (('y-'m)*sqrt('x)/'s == ('y-'m)*'e)
However, when I try to apply this rule to the expression
substE (y-m)*sqrt(x)/s
I get the *(y-m)*sqrt(x)/s *expression back instead of *(y-m)*e. *It looks
like the left hand side of the equality in the rule substE does not pattern
match itself.
Curiously, without sqrt a similar rule works as expected:
substF := rule (('y-'m)*'x/'s == ('y-'m)*'e)
substF ((y-m)*x/s)
gives e*y - e*m
Can you explain what is the difference here and how to approach the goal of
substituting a subexpression with a symbol?
Thanks,
Slawomir
--
You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fricas-devel+***@googlegroups.com.
To post to this group, send email to fricas-***@googlegroups.com.
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fricas-devel+***@googlegroups.com.
To post to this group, send email to fricas-***@googlegroups.com.
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.