Advertisement
Guest User

Untitled

a guest
May 26th, 2018
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.18 KB | None | 0 0
  1. /*#########################
  2. Нелинейный случай
  3. ###########################*/
  4.  
  5. // пока omega = 0
  6. double del; // нужно для нормы
  7. double x = x_begin; // тоже нужно для нормы
  8.  
  9.  
  10. begin_value(V, length);
  11.  
  12. for (int i = 0; i < n; ++i)
  13. {
  14.  
  15. begin_value_pristrel(V_pr, length);
  16. V_pr[0] = 1;
  17. V_pr[m-1] = 0;
  18.  
  19. while (norma_for_G > 1e-12) {
  20.  
  21. // printf("%g - NORMAAAAAAAAAAAAAAAAAAAAAAAAAA GGGGGGGGGGGGG\n\n", norma_for_G);
  22.  
  23. matrix_G(&V_pr, &G_1, &V);
  24. equal_G2_G1(&G_1, &G_2);
  25. matrix_J(&U_1, &U_2, &V_pr, &G_2);
  26. new_vector_X(&U_1, &U_2, &G_2, &X);
  27. new_V_pr(&X, &V_pr);
  28. matrix_G(&V_pr, &G_1, &V); // изменение G для нового вектора пристреленного
  29.  
  30. norma_for_G = norma_G(&G_1);
  31. }
  32.  
  33. norma_for_G = 1;
  34.  
  35.  
  36. norma_DELTA_c_line = 0; norma_delta_c_line = 0; //начальное максимальное значение [c]
  37. norma_DELTA_l_line = 0; norma_delta_l_line = 0; //начальное значение [l]
  38.  
  39. for (int j = 0; j < m-1; ++j)
  40. {
  41. del = delta_nel(V_pr[j], x_by_stepx(j), (i+1)*tao); // разность между численным решением и точным решением
  42. printf("%s %f %f %f \n", "X and T and del",x_by_stepx(j), (i+1)*tao, del);
  43. norma_c(del, &norma_DELTA_c_line); //[c]
  44. norma_c(V_pr[j], &norma_delta_c_line); //[c]
  45. norma_l(del, &norma_DELTA_l_line); //[l]
  46. norma_l(V_pr[j], &norma_delta_l_line); //[l]
  47. }
  48.  
  49. print_block(V_pr, m);
  50. equal_V_Vpr(&V, &V_pr);
  51. printf("I : %d\n", i);
  52.  
  53. }
  54.  
  55.  
  56. printf("tao h DeltaC DeltaL deltaC delta l\n");
  57. printf("%g & %g & %e & %e & %e & %e \n", tao, h, norma_DELTA_c_line, h*norma_DELTA_l_line, norma_DELTA_c_line/norma_delta_c_line, norma_DELTA_l_line/norma_delta_l_line);
  58.  
  59.  
  60. // print_block_to_file(V_pr, length, fout);
  61.  
  62. return 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement