ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 26 Jan 2011 11:25:56 +0100How do I nest functions?https://ask.sagemath.org/question/7898/how-do-i-nest-functions/The following code
EllipticCurve([0,1]).reduction(5).cardinality()
returns an error, while the code
e = EllipticCurve([0,1]).reduction(5)
e.cardinality()
works fine. Is there a way to do this on one line? (Note: I don't particularly care about this with elliptic curves, I'd just like to be able to do things like this in one line. In other words, I'm not looking for a mathematical answer. Also, I'm asking for something different than, say, this
e = EllipticCurve([0,1]).reduction(5); e.cardinality()
.)
Tue, 25 Jan 2011 23:05:37 +0100https://ask.sagemath.org/question/7898/how-do-i-nest-functions/Answer by Shashank for <p>The following code</p>
<pre><code>EllipticCurve([0,1]).reduction(5).cardinality()
</code></pre>
<p>returns an error, while the code</p>
<pre><code>e = EllipticCurve([0,1]).reduction(5)
e.cardinality()
</code></pre>
<p>works fine. Is there a way to do this on one line? (Note: I don't particularly care about this with elliptic curves, I'd just like to be able to do things like this in one line. In other words, I'm not looking for a mathematical answer. Also, I'm asking for something different than, say, this</p>
<pre><code>e = EllipticCurve([0,1]).reduction(5); e.cardinality()
</code></pre>
<p>.)</p>
https://ask.sagemath.org/question/7898/how-do-i-nest-functions/?answer=12007#post-id-12007Actually it works. Can you post the error?
sage: EllipticCurve([0,1]).reduction(5).cardinality()
6Tue, 25 Jan 2011 23:15:44 +0100https://ask.sagemath.org/question/7898/how-do-i-nest-functions/?answer=12007#post-id-12007Comment by Mike for <p>Actually it works. Can you post the error?</p>
<pre><code>sage: EllipticCurve([0,1]).reduction(5).cardinality()
6
</code></pre>
https://ask.sagemath.org/question/7898/how-do-i-nest-functions/?comment=22245#post-id-22245I was spelling cardinality wrong in sage...Wed, 26 Jan 2011 11:25:56 +0100https://ask.sagemath.org/question/7898/how-do-i-nest-functions/?comment=22245#post-id-22245