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.Thu, 09 Jul 2015 16:55:43 +0200problem plotting numerical integralhttps://ask.sagemath.org/question/27294/problem-plotting-numerical-integral/ Why does the following give an error "TypeError: unable to simplify to float approximation"?
def f(y): return numerical_integral(1,0,y)[0]
plot(f(y),(y,0,1))Thu, 09 Jul 2015 11:34:34 +0200https://ask.sagemath.org/question/27294/problem-plotting-numerical-integral/Answer by tmonteil for <p>Why does the following give an error "TypeError: unable to simplify to float approximation"?</p>
<pre><code>def f(y): return numerical_integral(1,0,y)[0]
plot(f(y),(y,0,1))
</code></pre>
https://ask.sagemath.org/question/27294/problem-plotting-numerical-integral/?answer=27295#post-id-27295The way you define `f` is a Python function, not a symbolic expression. In particular, the name of the input does not matter. So, there is no point to deal with `f(y)` which requires that `y` is defined (as a symbol).
What you can do is the following:
sage: plot(f,(0,1))
Launched png viewer for Graphics object consisting of 1 graphics primitive
Thu, 09 Jul 2015 16:55:43 +0200https://ask.sagemath.org/question/27294/problem-plotting-numerical-integral/?answer=27295#post-id-27295