Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. #include <vector>
  2. #include "Header.h"
  3.  
  4. using namespace std;
  5.  
  6. vector<vector<double> > solveByEiler(const double from, const double to, const double a, const int N) {
  7.     vector<vector<double> > solution;
  8.     double x = from;
  9.     double y = a;
  10.     const double h = (to - from)/(N-1);
  11.     for(int i = 0; i < N; i++) {
  12.         vector<double> temp;
  13.         temp.push_back(x);
  14.         temp.push_back(y);
  15.         solution.push_back(temp);
  16.         y += h*f(x, y);
  17.         x += h;
  18.     }
  19.     return solution;
  20.  
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement