Advertisement
Guest User

RunKut()

a guest
Jan 16th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.27 KB | None | 0 0
  1. void RunKut(double a, double b, double h, double y0, double(*f)(double, double), FILE *file) {
  2.     double x = a, y = y0;
  3.  
  4.  
  5.     while (x <= b) {
  6.         y = y + ((f(x, y)+ f(x+h, y+h))*h)/2.0;
  7.         fprintf(file, "%10.5lf %10.5lf\n", x, y);
  8.         x += h;
  9.     }
  10.  
  11.     fprintf(file, "\n");
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement