Orang-orang Ilmu Komputasi:
Saya awalnya memposting pertanyaan ini di Math Stack Exchange dan seseorang berkomentar bahwa saya mungkin mendapatkan jawaban "jauh lebih baik" di sini:
Saya seorang pemula dalam metode numerik dan Matlab. Saya mencoba untuk mengevaluasi jumlah berikut dari dua integral tiga (ini jelas dapat ditulis lebih sederhana, tetapi Anda masih tidak dapat mengevaluasinya secara simbolis (?)). Saya kesulitan mendapatkan bekerja di sini, jadi saya dengan enggan memecah-mecahnya menjadi beberapa bagian di sini: Saya ingin mencari jumlah
dan
dimana
and
EDIT (2 Maret 2013): Seseorang menjawab bahwa mereka mendapat Mathematica untuk melakukan integral secara simbolis. Saya hanya berusaha melakukan ini (dengan versi yang disederhanakan dari integral) dan Mathematica hanya bisa melakukan dua yang terluar dari yang pertama, dan berhenti pada yang kedua. Saya akan sangat menghargai bantuan. Inilah yang saya lakukan .:
Saya berusaha mengevaluasi
Integrate[r1^3/r2^3*t^2*Exp (-t^2), {t, 0, r2 - r1}, {r1, 1, r2}, {r2, 1, 2}]
and Mathematica returns (I had trouble with the here because the result is long. I broke it into two equations. if anyone knows a good way to display this please tell me):
Then I tried to evaluate
using
Integrate[(r1 + r2 - t)^4*(t^2 + 2*t*(r1 + r2) - 3*(r2 - r1)^2)^2* Exp[-t^2]/r1^3/r2^3, {r2, 1, 2}, {r1, 1, r2}, {t, r2-r1, r2 + r1}]
just now, and Mathematica has not returned an answer after about half an hour (but I am having computer network problems right now, and they may be to blame).
[END OF MARCH 2 EDIT]
I used Matlab's "triplequad" command, with no extra options. I handled the variable limits of integration by means of heaviside functions, because I didn't know any other way to do it. Matlab gave me .
I know Matlab is good software, but I have heard that numerical triple integrals are hard to do accurately, and mathematicians are supposed to be skeptical, so I want some way to verify the accuracy of this answer. The integrals give the expected value of a certain experiment (if anyone wants, I can edit this question to describe the experiment): I implemented the experiment in Matlab using appropriately randomly generated numbers, a million times, and averaged the results. I repeated this process four times. Here are the results (I apologize if I have used the word "trial" improperly):
Trial 1:
Trial 2:
Trial 3:
Trial 4:
Trial 5:
Although each trial used a million samples, the simulation values only agree in the first significant digit. They are not close enough to each to each other for me to determine whether the numerical triple integral is accurate.
So can anyone tell me whether I can trust the result of "triplequad" here, and under what circumstances one can trust it in general?
One suggestion I got at Math Stack Exchange was to try other software like Mathematica, Octave, Maple, and SciPy. Is this good advice? Do people actually do numerical work in Mathematica and Maple? Octave is kind of a Matlab clone, so can I assume it uses the same integration algorithms? I haven't even heard of SciPy before and would appreciate any opinions about it.
UPDATE: Someone from Math Stack Exchange did it in Maple and got . That is agreement to three significant figures. That is a good sign.
Also, I would appreciate suggestions on how to enter long, multi-line expression in in Stack Exchange. Can you use the "aligned" environment here? I tried, and I couldn't get it to work.
Jawaban:
First of all, it is not the software (or at least it shouldn't be) that determines the quality of the solution to a problem, it's the quality and appropriateness of the algorithm that is applied. You should check what algorithm is being used by triplequad in Matlab (I would guess it uses a nested adaptive Gaussian quadrature). And you should check what the requested tolerances are (required absolute and relative tolerance). Chances are that, by default, it only asks for10−8 relative precision.
The answer coming from Maple is probably done by Computer Algebra and maybe it could find a closed solution which was then evaluated using double precision floating point. This has the advantage that you are not approximating the integral by a finite summation (and hence are introducing approximation errors) but the Computer Algebra System will find an expression for the integral which can then be evaluated. Of course, care must be taken when evaluating this expression (for round-off).
If you would want to do this with SciPy, you would also need to resort to nested adaptive Gaussian quadrature using the underlying Quadpack (Piessens et al.) routines. In Octave, you'll have the same approach. And I wouldn't be too surprised if Matlab also uses Quadpack as quadrature engine (since it is the reference).
sumber
infolevel[`evalf/int`] := 4
. Are you sure Mape can't find a closed solution? The integral doesn't seem to be too complicated. Could you make your Maple sheet public somewhere?