Advertisement
Guest User

Blah blah blah

a guest
Nov 26th, 2015
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. class MyFunction
  2. {
  3. public static float Fu(float x, float a)
  4. {
  5. float f;
  6. f = 1 / (a * x) + 1 / (x + 1) + 1 / ( x + 2);
  7. return f;
  8. }
  9. public static void Function1(int N, float a, out float xmin, out float xmax, out float ymin, out float ymax, ref float[] arx, ref float[] ary)
  10. {
  11. float[] ax, ay;
  12. ax = new float[N-2];
  13. ay = new float[N-2];
  14.  
  15.  
  16. for (int j = -(N-2)/2, i = 0; j <= (N-2)/2; j++)
  17. {
  18. if (((j / 100.0 ) == 0) || (( j / 100.0 ) == -1) || (( j / 100.0 ) == -2)) continue;
  19. ax[i] = (float)(j / 100.0 );
  20. ay[i] = (float)MyFunction.Fu(ax[i], a);
  21. i++;
  22. }
  23. xmin = ax.Min();
  24. xmax = ax.Max();
  25. ymax = ay.Max();
  26. ymin = ay.Min();
  27. arx = ax;
  28. ary = ay;
  29. }
  30. public static void Function2(int N, float a, float del, out float xminl, out float xmaxl, out float yminl, out float ymaxl, ref float[] arxl, ref float[] aryl)
  31. {
  32. float[] ax, ay;
  33. ax = new float[N - 2];
  34. ay = new float[N - 2];
  35. for (int j = -(N - 2) / 2, i = 0; j <= (N - 2) / 2; j++)
  36. {
  37. if (((j / 100.0) == 0) || ((j / 100.0) == -1) || ((j / 100.0) == -2)) continue;
  38. ax[i] = (float)(j / 100.0);
  39. ay[i] = (float)((Fu(ax[i]+del, a)-Fu(del,a))/del);
  40. i++;
  41. }
  42. xminl = ax.Min();
  43. xmaxl = ax.Max();
  44. ymaxl = ay.Max();
  45. yminl = ay.Min();
  46. arxl = ax;
  47. aryl = ay;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement