Advertisement
daniv1

29.8

Oct 29th, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.96 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3. double f(double u , double v)
  4. {
  5.     return pow(sin(2*u),2) + log(v);
  6. }
  7. int main()
  8. {
  9.  
  10.     double max = f(1.5,1.5);
  11.     double min = f(1.5,1.5);
  12.     for(double u = 1.5; u <= 2.0; u+=0.25)
  13.     {
  14.         for(double v = 1.5; v <= 2.0; v+=0.45)
  15.         {
  16.             double temp = f(u,v);
  17.             if(temp>max)
  18.             {
  19.                 max = temp;
  20.             }
  21.             if(temp<min)
  22.             {
  23.                 min = temp;
  24.             }
  25.             printf("u = %.2lf ,v = %.2lf ,f(u,v) = %lf\n",u,v,temp);
  26.         }
  27.       printf("\n");
  28.     }
  29.     for(double u = 1.5; u <= 2; u+=0.25)
  30.     {
  31.         double temp = f(u,2.0);
  32.         if(temp>max)
  33.         {
  34.             max = temp;
  35.         }
  36.         if(temp<min)
  37.         {
  38.             min = temp;
  39.         }
  40.  
  41.         printf("u = %.2lf ,v = %.2lf ,f(u,v) = %lf\n",u,2.0,temp);
  42.     }
  43.      printf("min = %lf\nmax = %lf\n",min,max);
  44.     return 0;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement