On Wed, 28 May 2014 at 08:14AM -0700, George Hokke wrote:
> Hi,
> what I want to do is to solve an equation in which the function contains a 
> numerical integral in its definition.
> Something like this:
> 
> sage: d=lambda y: numerical_integral(x**2+y,0,1)[0]
> sage: d(0)
> 0.333333333333
> 
> works until here.
> But now I'd want to do:
> 
> sage: solve(d(y)==1,y)
> ValueError: Integral has wrong number of parameters
> 
> Even of I try to pass 'y' as parameter in function d, I get an error.
> 
> Is there any way to do it?

Try find_root(). You want a root of d(y) - 1, so try:

find_root(lambda x: d(x) -1, -1, 1)

which gives 0.666666666667.


Dan

-- 
---  Dan Drake
-----  www.math.wisc.edu/~ddrake/
-------

Attachment: signature.asc
Description: Digital signature

Reply via email to