Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cfloat>
- #include <vector>
- #include <math.h>
- using namespace std;
- int main() {
- double a{-10.0}, b{10.0}, n{10.0};
- vector<double> nodeValue(n+1);
- vector<double> functionValue(n+1);
- cout << "Nodal points: " << endl;
- for(double i=0; i<=n; i++){
- double nom = (2.0 * i + 1.0) * 3.14159;
- double denom = 2.0 * n + 2.0;
- nodeValue[i] = cos(nom/denom);
- cout << nodeValue[i] << endl;
- }
- cout << endl << "Values of the functional: " << endl;
- for(double i=0; i<=n; i++){
- functionValue[i] = nodeValue[i] / 2.0 * (b - a) + a + b;
- cout << functionValue[i] << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement