Double Integration of Six Functions Using Three Different Quadrature Algorithms (c) January 15, 2024, by James Pate Williams, Jr. All Applicable Rights Reserved

I utilized six functions that have two independent variables. The integration methods were a Monte Carlo probabilistic procedure, TRICUB from “A Numerical Library in C for Scientists and Engineers” by H. T. Lau, PhD, and an algorithm from the ACM publication. I translated the ACM method from FORTRAN to C. See the following online references:

https://math.libretexts.org/Bookshelves/Calculus/Vector_Calculus_(Corral)/03%3A_Multiple_Integrals/3.04%3A_Numerical_Approximation_of_Multiple_Integrals
https://tutorial.math.lamar.edu/Classes/CalcIII/IteratedIntegrals.aspx

== Menu ==

1 8 * x + 6 * y
2 6 * x * y * y
3 2 * x - 4 * y * y * y
4 x * x * y * y + cos(pi * x) + sin(pi * y)
5 pow(2 * x + 3 * y, -2)
6 x * exp(x * y)
7 Exit
Option: 1
f(x, y) = 8x + 6y
[0.000000, 1.000000] x [0.000000, 2.000000]
N Integral +-Error % Error
10 18.398218 2.687822 8.008911
100 19.546981 0.838888 2.265096
1000 19.859442 0.266101 0.702789
10000 20.152819 0.082772 0.764093
100000 20.014598 0.026273 0.072988
1000000 20.013430 0.008323 0.067150
NUMAL Integral Value and Percent Error: 22.666667 13.333333
nQuadrature Integral Value and Percent Error: 19.999968 0.000160
== Menu ==
1 8 * x + 6 * y
2 6 * x * y * y
3 2 * x - 4 * y * y * y
4 x * x * y * y + cos(pi * x) + sin(pi * y)
5 pow(2 * x + 3 * y, -2)
6 x * exp(x * y)
7 Exit
Option:
== Menu ==
1 8 * x + 6 * y
2 6 * x * y * y
3 2 * x - 4 * y * y * y
4 x * x * y * y + cos(pi * x) + sin(pi * y)
5 pow(2 * x + 3 * y, -2)
6 x * exp(x * y)
7 Exit
Option: 2
f(x, y) = 6 * x * y * y
[1.000000, 2.000000] x [2.000000, 4.000000]
N Integral +-Error % Error
10 6.400786 2.133333 92.380017
100 7.528110 0.951714 91.037965
1000 7.951653 0.294436 90.533746
10000 8.083377 0.094959 90.376933
100000 8.001852 0.029859 90.473986
1000000 8.010457 0.009474 90.463742
NUMAL Integral Value and Percent Error: 204.800000 143.809524
nQuadrature Integral Value and Percent Error: 167.999730 99.999679
== Menu ==
1 8 * x + 6 * y
2 6 * x * y * y
3 2 * x - 4 * y * y * y
4 x * x * y * y + cos(pi * x) + sin(pi * y)
5 pow(2 * x + 3 * y, -2)
6 x * exp(x * y)
7 Exit
Option:
== Menu ==
1 8 * x + 6 * y
2 6 * x * y * y
3 2 * x - 4 * y * y * y
4 x * x * y * y + cos(pi * x) + sin(pi * y)
5 pow(2 * x + 3 * y, -2)
6 x * exp(x * y)
7 Exit
Option: 3
f(x, y) = 2 * x - 4 * y * y * y
[-5.000000, 4.000000] x [0.000000, 3.000000]
N Integral +-Error % Error
10 -645.214459 239.379239 14.654172
100 -436.170436 84.138767 42.305498
1000 -471.478924 25.861533 37.635063
10000 -486.066536 8.338088 35.705485
100000 -484.301805 2.644031 35.938915
1000000 -486.527596 0.839338 35.644498
NUMAL Integral Value and Percent Error: -765.000000 1.190476
nQuadrature Integral Value and Percent Error: -755.998734 0.000167
== Menu ==
1 8 * x + 6 * y
2 6 * x * y * y
3 2 * x - 4 * y * y * y
4 x * x * y * y + cos(pi * x) + sin(pi * y)
5 pow(2 * x + 3 * y, -2)
6 x * exp(x * y)
7 Exit
Option:
== Menu ==
1 8 * x + 6 * y
2 6 * x * y * y
3 2 * x - 4 * y * y * y
4 x * x * y * y + cos(pi * x) + sin(pi * y)
5 pow(2 * x + 3 * y, -2)
6 x * exp(x * y)
7 Exit
Option: 4
f(x, y) = x * x * y * y + cos(pi * x) + sin(pi * y)
[-2.000000, -1.000000] x [0.000000, 1.000000]
N Integral +-Error % Error
10 1.103184 0.173977 22.003269
100 0.708005 0.063869 49.942995
1000 0.757961 0.021546 46.411062
10000 0.744889 0.006866 47.335224
100000 0.748463 0.002171 47.082576
1000000 0.746892 0.000686 47.193609
NUMAL Integral Value and Percent Error: 1.449491 2.481177
nQuadrature Integral Value and Percent Error: 1.414395 0.000160
== Menu ==
1 8 * x + 6 * y
2 6 * x * y * y
3 2 * x - 4 * y * y * y
4 x * x * y * y + cos(pi * x) + sin(pi * y)
5 pow(2 * x + 3 * y, -2)
6 x * exp(x * y)
7 Exit
Option:
== Menu ==
1 8 * x + 6 * y
2 6 * x * y * y
3 2 * x - 4 * y * y * y
4 x * x * y * y + cos(pi * x) + sin(pi * y)
5 pow(2 * x + 3 * y, -2)
6 x * exp(x * y)
7 Exit
Option: 5
f(x, y) = pow(2 * x + 3 * y, -2)
[0.000000, 1.000000] x [1.000000, 2.000000]
N Integral +-Error % Error
10 0.555876 0.235032 1394.669315
100 0.752953 0.323309 1924.579264
1000 0.826769 0.275474 2123.058629
10000 0.927229 0.177631 2393.180482
100000 0.995193 0.097358 2575.927399
1000000 1.291253 0.127325 3371.987619
NUMAL Integral Value and Percent Error: 0.034125 8.243058
nQuadrature Integral Value and Percent Error: 0.037190 0.000639
== Menu ==
1 8 * x + 6 * y
2 6 * x * y * y
3 2 * x - 4 * y * y * y
4 x * x * y * y + cos(pi * x) + sin(pi * y)
5 pow(2 * x + 3 * y, -2)
6 x * exp(x * y)
7 Exit
Option:
== Menu ==
1 8 * x + 6 * y
2 6 * x * y * y
3 2 * x - 4 * y * y * y
4 x * x * y * y + cos(pi * x) + sin(pi * y)
5 pow(2 * x + 3 * y, -2)
6 x * exp(x * y)
7 Exit
Option: 6
f(x, y) = x * exp(x * y)
[0.000000, 1.000000] x [-1.000000, 2.000000]
N Integral +-Error % Error
10 3.217934 1.437426 inf
100 5.562365 0.873166 inf
1000 5.325378 0.225123 inf
10000 5.497069 0.075770 inf
100000 5.362919 0.023344 inf
1000000 5.371802 0.007410 inf
NUMAL Integral Value and Percent Error: 6.162907 inf
nQuadrature Integral Value and Percent Error: 2.562339 inf
Unknown option, please try again.== Menu ==
1 8 * x + 6 * y
2 6 * x * y * y
3 2 * x - 4 * y * y * y
4 x * x * y * y + cos(pi * x) + sin(pi * y)
5 pow(2 * x + 3 * y, -2)
6 x * exp(x * y)
7 Exit
Option:
Unknown's avatar

Author: jamespatewilliamsjr

My whole legal name is James Pate Williams, Jr. I was born in LaGrange, Georgia approximately 70 years ago. I barely graduated from LaGrange High School with low marks in June 1971. Later in June 1979, I graduated from LaGrange College with a Bachelor of Arts in Chemistry with a little over a 3 out 4 Grade Point Average (GPA). In the Spring Quarter of 1978, I taught myself how to program a Texas Instruments desktop programmable calculator and in the Summer Quarter of 1978 I taught myself Dayton BASIC (Beginner's All-purpose Symbolic Instruction Code) on LaGrange College's Data General Eclipse minicomputer. I took courses in BASIC in the Fall Quarter of 1978 and FORTRAN IV (Formula Translator IV) in the Winter Quarter of 1979. Professor Kenneth Cooper, a genius poly-scientist taught me a course in the Intel 8085 microprocessor architecture and assembly and machine language. We would hand assemble our programs and insert the resulting machine code into our crude wooden box computer which was designed and built by Professor Cooper. From 1990 to 1994 I earned a Bachelor of Science in Computer Science from LaGrange College. I had a 4 out of 4 GPA in the period 1990 to 1994. I took courses in C, COBOL, and Pascal during my BS work. After graduating from LaGrange College a second time in May 1994, I taught myself C++. In December 1995, I started using the Internet and taught myself client-server programming. I created a website in 1997 which had C and C# implementations of algorithms from the "Handbook of Applied Cryptography" by Alfred J. Menezes, et. al., and some other cryptography and number theory textbooks and treatises.

Leave a comment