fork download
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. int main() {
  5. double a = 2.5;
  6. double b = 0.4;
  7.  
  8. double t_start = -1.0;
  9. double t_end = 1.0;
  10. int num_points = 50;
  11.  
  12. for (int i = 0; i < num_points; i++) {
  13. double t = t_start + i * (t_end - t_start) / (num_points - 1);
  14.  
  15. double denominator = a * t + b;
  16. if (fabs(denominator) < 1e-10) {
  17. printf("%.4f\t Ошибка: деление на ноль\n", t);
  18. continue;
  19. }
  20.  
  21. double root_expression = a * t * t + b * sin(t) + 1;
  22. if (root_expression < 0) {
  23. printf("%.4f\t Ошибка: отрицательное подкоренное выражение\n", t);
  24. continue;
  25. }
  26.  
  27. double numerator = pow(root_expression, 0.5);
  28. double y = numerator / denominator;
  29. printf("%.4f\t %.6f\n", t, y);
  30. }
  31.  
  32. return 0;
  33. }
Success #stdin #stdout 0.01s 5300KB
stdin
Standard input is empty
stdout
-1.0000	 -0.846952
-0.9592	 -0.862941
-0.9184	 -0.881116
-0.8776	 -0.901896
-0.8367	 -0.925805
-0.7959	 -0.953510
-0.7551	 -0.985869
-0.7143	 -1.024000
-0.6735	 -1.069386
-0.6327	 -1.124036
-0.5918	 -1.190732
-0.5510	 -1.273431
-0.5102	 -1.377952
-0.4694	 -1.513204
-0.4286	 -1.693526
-0.3878	 -1.943552
-0.3469	 -2.309439
-0.3061	 -2.888906
-0.2653	 -3.931141
-0.2245	 -6.316071
-0.1837	 -16.991605
-0.1429	 23.264067
-0.1020	 6.850444
-0.0612	 4.018889
-0.0204	 2.855276
0.0204	 2.227375
0.0612	 1.838462
0.1020	 1.576623
0.1429	 1.390228
0.1837	 1.252146
0.2245	 1.146751
0.2653	 1.064407
0.3061	 0.998852
0.3469	 0.945848
0.3878	 0.902426
0.4286	 0.866448
0.4694	 0.836342
0.5102	 0.810927
0.5510	 0.789303
0.5918	 0.770771
0.6327	 0.754785
0.6735	 0.740913
0.7143	 0.728808
0.7551	 0.718190
0.7959	 0.708833
0.8367	 0.700548
0.8776	 0.693182
0.9184	 0.686608
0.9592	 0.680717
1.0000	 0.675421