﻿

# kauchy

Dec 1st, 2020 (edited)
635
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. #include <iostream>
2. #include <math.h>
3. #include <fstream>
4. #include <cmath>
5.
6. using namespace std;
7. const double right_ending = 1;
8. const double left_ending = 0;
9. const double eintial_cond_func = 1;\\in 0
10. const double inteial_cond_deliv = 3;\\in 0
11. const int accuracy = 10000;
12. int main (){
13.     double step = (right_ending - left_ending)/accuracy;
14.     double n = 1,2;
15.     double tetha;
16.     double q;
17.     double xi;
18.     double solution_1[accuracy]; \\deliv_array: teta
19.     double solution_2[accuracy]; \\func_array: q
20.     double variable[accuracy];
21.     xi = left_ending + 0.001 * step;
22.     solution_1[0] = intial_cond_func;
23.     solution_2[0] = intial_cond_deliv;
24.     variable[0] = xi;
25.     for (int i = 0, i = accuracy - 1, i++){
26.         solution_1[i+1] = solution_1[i] + step * solution_2[i];
27.         solution_2[i+1] = solution_2[i] + step * (-2 / xi * solution_2[i] - solution_1[i]^n);
28.         xi = xi + step;
29.         variable[i+1] = xi;
30.         }
31. \\ решение диф - solution_1(variable)
32.     return 0;
33. }
RAW Paste Data