diff options
Diffstat (limited to 'Numerical_Methods_by_E_Balaguruswamy/CH12/EX12.8/Ex12_8.R')
-rw-r--r-- | Numerical_Methods_by_E_Balaguruswamy/CH12/EX12.8/Ex12_8.R | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Numerical_Methods_by_E_Balaguruswamy/CH12/EX12.8/Ex12_8.R b/Numerical_Methods_by_E_Balaguruswamy/CH12/EX12.8/Ex12_8.R new file mode 100644 index 00000000..a7d66c5d --- /dev/null +++ b/Numerical_Methods_by_E_Balaguruswamy/CH12/EX12.8/Ex12_8.R @@ -0,0 +1,17 @@ +# Example 8 Chapter 12 Page no.: 397
+#Gauss-Legendre Two point formula
+
+#Given functions and values
+f <- function(x){
+ exp(x)
+}
+a1 <- -1
+b1 <- 1
+
+#Gauss-Legendre Two point formula
+I <- function(a,b){
+ return(f(a/sqrt(3))+f(b/sqrt(3)))
+}
+
+I1 <- I(a1,b1)
+cat("The Gauss-Legendre two point integral of exp(x) is", signif(I1, digits = 8))
\ No newline at end of file |