[sage-support] Re: Counting the number of square roots in an expression

2015-03-11 Thread Ralf Stephan
See also the answers to http://ask.sagemath.org/question/10256/how-can-extract-different-terms-from-a-symbolic-expression/ -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an

Re: [sage-support] Re: Counting the number of square roots in an expression

2015-03-09 Thread Ralf Stephan
On Monday, March 9, 2015 at 3:49:01 PM UTC+1, projetmbc wrote: > > The string trick would do the job, but maybe the tree method would be > nicer. How can I walk in the tree ? Is the tree the one of simply or > another one ? > Any symbolic expression (part) has 0+ operators and 0+ operands. See

Re: [sage-support] Re: Counting the number of square roots in an expression

2015-03-09 Thread Christophe Bal
The string trick would do the job, but maybe the tree method would be nicer. How can I walk in the tree ? Is the tree the one of simply or another one ? *Christophe BAL* *Enseignant de mathématiques en Lycée **et développeur Python amateur* *---* *French math teacher in a "Lycée" **and **Python *

[sage-support] Re: Counting the number of square roots in an expression

2015-03-09 Thread slelievre
slelievre: projetmbc: > > suppose that I have *sqrt(6)*(sqrt(3)+5)*. How can I count >> > the number of square root in this expression ? >> > > sage: a = sqrt(6)*(sqrt(3)+5) > sage: a > sqrt(6)*(sqrt(3) + 5) > sage: s = str(a) > sage: s > 'sqrt(6)*(sqrt(3) + 5)' > sage: s.count('sqrt') > 2 > or y

[sage-support] Re: Counting the number of square roots in an expression

2015-03-09 Thread slelievre
projetmbc: suppose that I have *sqrt(6)*(sqrt(3)+5)*. How can I count > the number of square root in this expression ? > sage: a = sqrt(6)*(sqrt(3)+5) sage: a sqrt(6)*(sqrt(3) + 5) sage: s = str(a) sage: s 'sqrt(6)*(sqrt(3) + 5)' sage: s.count('sqrt') 2 -- You received this message because yo