| So I have equations: (a##-d## are all decimals) And I want to double integrate over d and h. So just for example I can integrate over just d: and it evaluates just fine. Likewise if I put in an value for d and integrate over h, it also produces a value. So I want the numerical approximation of this double integral, but when I try for it using: At any rate, I think what is happening is that it is trying to evaluate the inside integral numerically first perhaps, which it is not able to do as it has a variable? I tried using the lambda in the first answer, and I was able to evaluate, but I had to set it to max_points=10 to get an answer that was even close to correct, plus I could find no way to plot that one. Thanks for any help! Wil |
| You could try with numerical_integral. You didn't provide definition of B(), so here is example with simpler function: BTW: I'd like to know how to do the above without 'lambda'. BTW2: Are you sure your integral converges at d=0?
Yes, even running it through numerical_integral I get the response of "Integrand has wrong number of parameters"
I broke down the equations to the smallest I could get and still get the error:
integral(integral((1/d)*h*e^d*e^(h/2),d,4,5),h,4,5)
That will cause the same error. Ideas?
willmwade (Aug 26 '10)
Hm. I am puzzled. This works for me:
sage: version()
'Sage Version 4.4.4, Release Date: 2010-06-23'
sage: numerical_integral(lambda h: numerical_integral(lambda d:(1/d)*h*e^d*e^(h/2),4,5)[0],4,5)[0]
894.91270304016609
kkumer (Aug 26 '10)
Well that does work for me as well. What is the "[0]" after each integral?
I am trying this on my original equation, but it will take a little while. I will post the result when it finally completes.
Thanks for your help!
willmwade (Aug 26 '10)
The full equation takes a really long time. I am guessing that it is just trying to be too precise. I don't need much. Anyway to decrease the precision?
willmwade (Aug 26 '10)
I figured out what the [0] was! It was limiting the return to only the value and leaving out the error calculation.
willmwade (Aug 26 '10) |
Asked: Aug 25 '10
Seen: 895 times
Last updated: Aug 26 '10
powered by ASKBOT version 0.7.22
Copyright Sage, 2010. Some rights reserved under creative commons license.