YauhenMardan

Untitled

May 25th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. package com.company;
  2.  
  3. public class FuncUtils {
  4. //problem 3
  5. public static double f(double x){
  6. double result=Math.pow(x,5.0)*(Math.pow(Math.log(Math.sqrt(x+1.0)),2.0)+2.0)-2.0;
  7. return result;
  8. }
  9. public static double fD2(double x){
  10. double result=Math.pow(x,5.0)*Math.log(Math.sqrt(x+1.0))/(x+1.0)+5.0*Math.pow(x,4.0)*(Math.pow(Math.log(Math.sqrt(x+1.0)),2.0)+2.0);
  11. return result;
  12. }
  13. public static double getI(double x, double n){
  14. //bounds are 0 and x, h=x/n
  15. double h=x/n;
  16. double sum=0.0;
  17. for(double k=1.0; k<=n;k++){
  18. sum+=f((k-1.0/2.0)*h);
  19. }
  20. return h*sum;
  21. }
  22. public static double getN(double a, double b){
  23. double result=Math.pow(10.0,3.0)*Math.sqrt(Math.pow(b-a,2)*fD2(b)/24.0);
  24. return Math.ceil(result);
  25. }
  26.  
  27. }
Add Comment
Please, Sign In to add comment