Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Problem 1 (35 points): Hyperbolic function calculator Write a C program that cal

ID: 3791075 • Letter: P

Question

Problem 1 (35 points): Hyperbolic function calculator Write a C program that calculates the value of hyperbolic sine, hyperbolic cosine, and two other terms (without using the hyperbolic functions in the math-h library) Your program MUST contain the following user-defined functions: 1) my cosh input: real-valuedx output: real-valued y where y cosh(x) which is calculated using the following Taylor series expression: y cosh(x) 1 6! Even though the actual Taylor series has an infinite number of terms, we will terminate the series at n 38. 2) my sinh input: real-valuedx output: real-valued y where y sinh (x) using the following Taylor series expressions: sinh (x) x 5! Even though the actual Taylor series has an infinite number of terms, we will terminate series at n 39. 3) double factorial (int n){ double product 1.0; int i for (i 2, i n; i++) product product i return product; Note: The factorial function should be used in your my cosh and my sinh functions

Explanation / Answer

#include<stdio.h>
double factorial(int n);
double cosh(int x);
double sinh(int x);
double cos2h(int x);
double sin2h(int x);
main()
{
double s,t,u,v;
int y,ch;
printf("enterx valueof y :");
scanf("%d",&y);
while(1)
{
printf(" 1.cosh(x) 2.sinh(x) 3.sinh(2x) 4.cosh(2x) 5.exit");
printf(" enter u r choice1-5:");
scanf("%d",&ch);
switch(ch)
{
case 1:
s=cosh(y);
printf("%0.8f",s);
break;
case 2:
t=sinh(y);
printf("%0.8f",t);
break;
case 3:
u=sin2h(y);
printf("%0.8f",u);
break;
case 4:
v=cos2h(y);
printf("%0.8f",v);
break;
case 5:exit(1);

}
}
}
double factorial(int n)
{
double product=1.0;
int i;
for(i=2;i<=n;i++)
product=product*i;
return product;
}

double cosh(int x)
{
int p=1,a,b,h;
int i,j=2;
for(i=1;i<=19;i++)
{
p*=x*x;
h+=p/factorial(j)+1;
j=j+2;
}

return h;
}
double sinh(int x)
{
int p=1,a,b=1,h;
int i,j=3;
p=x*x*x;
for(i=1;i<=19;i++)
{
p*=x*x;
}
h+=b/factorial(j)+x;
j=j+2;


return h;
}
double sin2h(int x)
{
int a;
a=2*sinh(x)*cosh(x);
return a;
}
double cos2h(int x)
{
int a;
a=(2*(sinh(x)*sinh(x)))+1;
return a;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote