2015-01-20 7:58 UTC+01:00, Nils Bruin <nbr...@sfu.ca>:
> On Monday, January 19, 2015 at 9:27:44 PM UTC-8, Ondřej Čertík wrote:
>>
>>
>> and your approach returns a wrong number of terms, so something is
>> wrong. But it is quite fast.
>>
>
> The term count doesn't tell you that. The representation of sqrt3 and sqrt5
>
> doesn't consist of single term expressions:
>
> sage: fsqrt3
> -1/4*a^3 + 7/2*a
> sage: fsqrt5
> -1/4*a^3 + 9/2*a

Right. You can use

sage: len(f.monomials())

which is safer. I did not find a function for counting the number of
non-zero coefficients.

Vincent

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to