diff options
Diffstat (limited to 'Numerical_Methods_by_E_Balaguruswamy/CH12/EX12.6/Ex12_6.R')
-rw-r--r-- | Numerical_Methods_by_E_Balaguruswamy/CH12/EX12.6/Ex12_6.R | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Numerical_Methods_by_E_Balaguruswamy/CH12/EX12.6/Ex12_6.R b/Numerical_Methods_by_E_Balaguruswamy/CH12/EX12.6/Ex12_6.R new file mode 100644 index 00000000..c2fa7c5e --- /dev/null +++ b/Numerical_Methods_by_E_Balaguruswamy/CH12/EX12.6/Ex12_6.R @@ -0,0 +1,20 @@ +# Example 6 Chapter 12 Page no.: 387
+#Boole's five point Formula
+
+#Given function
+f <- function(x){
+ sqrt(sin(x))
+}
+
+a1 <- 0
+b1 <- pi/2
+h1 <- (b1-a1)/4 #Since there are 5 sampling points the value of n is 4
+
+# Boole's function
+
+Bl <- function(a,b,h){
+ return(((2*h)/45)*((7*f(a))+(7*f(b))+(32*f(a+h))+(12*f(a+(2*h)))+(32*f(a+(3*h)))))
+}
+
+BL1 <- Bl(a1,b1,h1)
+cat("The Boole integrant value of sqrt(sin(x)) between 0 and pi/2 is", signif(BL1, digits = 6))
\ No newline at end of file |