# Numerical integration in a function

 1 f(x,y)=numerical_integral(1/d*2*x*y,.01,Infinity)[0] Error  So what I want is to the integration wait until after the variables have been substituted so that it is able to numerically integrate. (Yes I need to numerically integrate. This is a simplified form that reproduces the same result.) f(3,1)=numerical_integral(1/d*2*3*1,.01,Infinity)[0] 406.69135669845798  I thought there might be a way using a lambda defined function, but I was unable to find one. asked Sep 01 '10 willmwade 47 ● 3 ● 5 ● 8

 4 This works for me: sage: var('d') d sage: f = lambda x,y: numerical_integral(1/d*2*x*y,.01,Infinity)[0] sage: f(3,1) 406.69135669845832  posted Sep 01 '10 burcin 1068 ● 10 ● 32 http://erocal.org/burcin This worked great! willmwade (Sep 01 '10) Great! However, you won't be able to take the derivative of this function, as far as I know. Maybe our f(x,y) should make a lambda function when it's not possible to make a symbolic function... but that sounds hard. kcrisman (Sep 01 '10)

[hide preview]

## Stats:

Asked: Sep 01 '10

Seen: 920 times

Last updated: Sep 01 '10