fork download
  1. #This is my PYTHON program
  2. import math;
  3. S=float();
  4. Si=float();
  5. y=float();
  6. eps=float();
  7. A=float();
  8. V=float();
  9. i=int();
  10. print("Enter value for x\n");
  11. x=float(input());
  12. print ("Enter value for eps\n");
  13. eps=float(input());
  14. i=1;
  15. Si=x;
  16. S=Si;
  17. while (math.fabs(Si)>eps):
  18. i=i+2;
  19. Si=(Si*(x**2))/(i*(i-1));
  20. S=S+Si;
  21. y=math.sinh(x);
  22. A=math.fabs(y-S);
  23. V=A/math.fabs(y)*100;
  24. print(f"x={x:10.6f} eps={eps:10.6f}");
  25. print(f"y={y:10.6f} S={S:10.6f}");
  26. print(f"A={A:8.5f} V={V:8.5f}%");
Success #stdin #stdout 0.09s 14144KB
stdin
0.1
0.01
stdout
Enter value for x

Enter value for eps

x=  0.100000  eps=  0.010000
y=  0.100167  S=  0.100167
A= 0.00000   V= 0.00008%