Re: [fricas-devel] Giving a name to a part of an expression

2018-10-01 Thread Bill Page
Maybe this would help:

http://axiom-wiki.newsynthesis.org/ManipulatingExpressions

On Mon, Oct 1, 2018 at 2:01 PM Slawomir Kolodynski  wrote:
>
> Thank you for looking into this.
>
> >Instead, various routines analyze structure of expressions using lower level 
> >operations.
>
> Could you give some examples of those lower level operations? Pattern 
> matching and rewrite rules seem very useful to me , but I am ok with doing 
> lower level operations if those fail. I know about numerator, denominator and 
>  monomials so for example I can do
>
> e1 := (y-m)*x/s
> (monomials numerator e1)(1)
>
> to get x*y
>
> However when I try to do something similar with
>
> e2 := (y-m)*sqrt(x)/s
> numerator e2
>
> to get (y-m)*sqrt(x), I don't know how then to extract the components of this 
> product. Also, I could not find a way to extract an argument of a function, 
> for example if I have an expression
>
> sin(a*x+b)
>
> how to get the "a*x+b" part?
> 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+unsubscr...@googlegroups.com.
To post to this group, send email to fricas-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [fricas-devel] Giving a name to a part of an expression

2018-10-01 Thread Slawomir Kolodynski
Thank you for looking into this.

>Instead, various routines analyze structure of expressions using lower 
level operations. 

Could you give some examples of those lower level operations? Pattern 
matching and rewrite rules seem very useful to me , but I am ok with doing 
lower level operations if those fail. I know about numerator, denominator 
and  monomials so for example I can do

e1 := (y-m)*x/s
(monomials numerator e1)(1)

to get x*y

However when I try to do something similar with 

e2 := (y-m)*sqrt(x)/s
numerator e2

to get (y-m)*sqrt(x), I don't know how then to extract the components of 
this product. Also, I could not find a way to extract an argument of a 
function, for example if I have an expression

sin(a*x+b)

how to get the "a*x+b" part?
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+unsubscr...@googlegroups.com.
To post to this group, send email to fricas-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [fricas-devel] Giving a name to a part of an expression

2018-10-01 Thread Waldek Hebisch
I wrote:
> 
> Slawomir Kolodynski wrote:
> > 
> > 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.
> 
> Yes.  In expression numerator is a sum, that is what you really
> have is:
> 
>   y*sqrt(x) - m*sqrt(x)
> 
> In pattern (to which left hand side of the rule is converted) we
> have product.  Product does not match sum...  I need to check
> is this is just a bug or an unavoidable misfeature.

AFAICS the problem is in convertion from polynomials to patterns.
Looks like a bug, but attempting to fix it showed other
problems with rules, so I need to dig deeper.

-- 
  Waldek Hebisch

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to fricas-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.