Thanks Dima,
this will at least allow me to do what I need.

note, I have avoided using f=x^2, for a while now due to deprecation 
warnings like this:
sage: f=x^2
sage: f(5)
/usr/lib/sagemath/local/lib/python2.7/site-packages/IPython/core/
interactiveshell.py:2885:
 DeprecationWarning: Substitution using function-call syntax and unnamed
 arguments is deprecated and will be removed from a future release of 
Sage; you can use named arguments instead, like EXPR(x=..., y=...)
See http://trac.sagemath.org/5930 for details.
  exec(code_obj, self.user_global_ns, self.user_ns)
25

and it feels a bit clunky to specify g(x) in 
indefinite_integral(g(x),x) 

especially when I try to use it in a more generalized function (in 
notebook) like so:
def show_evaluaton(f,*bound):
    b=bound[0]
    fi = indefinite_integral(f(b[0]), b[0])  # why do we need to specify 
the variable twice?
    return LatexExpr("["+latex(fi.simplify())+"|_{%s=%s}^{%s}"%(b))
    
show_evaluaton(f, (x,0,1), (y,0,1))

>>  "[ \frac{1}{3} \, x^{3} |_{x=0}^{1}"



On Saturday, April 9, 2016 at 11:12:58 AM UTC-5, Dima Pasechnik wrote:
>
>
>
> On Saturday, April 9, 2016 at 4:53:50 PM UTC+1, lundy....@gmail.com wrote:
>>
>> I believe I have found a bug, and was not able to find any previous 
>> report or ticket to have it fixed.
>>
>> I would expect the indefinite_integral method to accept a function and 
>> provide output, but it only works if I input the symbolic expression itself.
>>
>> EX:
>>
>> sage: from sage.symbolic.integration.integral import indefinite_integral
>> sage: indefinite_integral(x^2, x)
>> 1/3*x^3
>> sage: f(x) = x^2
>> sage: indefinite_integral(f,x)
>>
>> ---------------------------------------------------------------------------
>> TypeError                                 Traceback (most recent call 
>> last)
>> <ipython-input-4-352b9c71db7d> in <module>()
>> ----> 1 indefinite_integral(f,x)
>>
>> sage/symbolic/function.pyx in 
>> sage.symbolic.function.BuiltinFunction.__call__ 
>> (/usr/lib/sagemath//src/build/cythonized/sage/symbolic/function.cpp:11320)()
>>
>> sage/symbolic/function.pyx in sage.symbolic.function.Function.__call__ 
>> (/usr/lib/sagemath//src/build/cythonized/sage/symbolic/function.cpp:6889)()
>>
>> TypeError: cannot coerce arguments: no canonical coercion from Callable 
>> function ring with argument x to Symbolic Ring
>>
>
> this is not a bug, IMHO (although Sage's error reporting here is not very 
> clear).
> The following works:
>
> sage: from sage.symbolic.integration.integral import indefinite_integral
> sage: f=x^2
> sage: indefinite_integral(f,x)
> 1/3*x^3
> sage: g(x)=x^2
> sage: indefinite_integral(g(x),x)
> 1/3*x^3
>
>
>  
>

-- 
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 https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to