# include <conio.h>
# include <stdio.h>
unsigned int factorial(int);
void main()
{
unsigned int f;
int a,i,g=0,c=1,j=-1;
clrscr();
scanf("%d",&a);
printf("sine series up to %d terms",a);
for(i=1;i<a;i++)
{
f=factorial(c);
j=j*(-1);
printf(" [(%d(x^%d))/(%d)] ",j,g,f);
if(i!=a)
printf("+");
c=c+2;
g=g+2;
}
getch();
}
unsigned int factorial(int x)
{
int fact=1,i;
for(i=1;i<=x;i++)
fact=fact*i;
return fact;
}
#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{
int sum=1,i,k,x,n;
cout<<"enter the values for x,n";
cin>>n>>x;
for(i=2;i<=n;i+=2)
{
double fact=1;
for(k=1;k<=i;k++)
{
fact*=k;
}
int l=i/2;
if(l%2==0)
{
sum=sum+(pow(x,i)/fact);
}
else
sum=sum-(pow(x,i)/fact);
}
cout<<sum;
}
#include<stdio.h>
/*main start*/
main()
{
int inum=5,i,j;
for(i=inum;i>=1;i--)
{
for(j=1;j<=i;j++)
{
printf("%d",inum);
}
printf("\n");
inum--;
}
}
/*main end*/
//COSINE SERIES
#include<stdio.h>
#include<conio.h>
#include<math.h>
main()
{
int i,n,x;
float t,s;
clrscr();
printf("enter the value of x,n \n");
scanf("%d%d",&x,&n);
t=1;
s=1;
for(i=1;i<n;i++)
{
t=(-1)*((pow(x,2)*t*i))/((2*i)*((2*i-1)*i));
s=s+t;
printf("s=%6.2f & t=%6.2f\n",s,t);
}
printf("\n sum of the cos series=%5.2f\n",s);
}
The C and C++ implementation of sin(x) and cos(x) using Taylor's Series is straightforward, but care has to be taken in some of the details...
Start with Taylor's Series.
sin(x) is x1/1! - x3/3! + x5/5! - ... repeating for all (+/-) pairs of odd factors.
cos(x) is x0/0! - x2/2! + x4/4! - ... repeating for all (+/-) pairs of even factors.
A naive implementation could just iterate this series until a desired resolution is obtained. Several issues arise...
The series converges more rapidly near x=0 then it does elsewhere. It is very, very helpful to take advantage of the fact that sin(x) and cos(x) repeat every 2pi. The first step should be to add or subtract 2*pi from x until x is in the interval -pi to +pi. To narrow that further, you can take advantage of the fact that the functions are fully defined in the interval -pi/2 to +pi/2. If the final x is outside of the interval -pi/2 to +pi/2, you can add or subtract pi to get it in that interval, and then remember to flip the sign of the result.
In cases where the magnitude of x is very large, the problem of truncation rears its ugly head. In floating point form, a large number has poor resolution near zero. If it is large enough, a step of just one bit in the low order end of the mantissa can be more than 2pi. That makes the problem unsolvable in this context. This answer will not address that.
At this point, a series of 6 terms would be sufficient to get resolution within 6 digits, if you are using doubles with 18 digit resolution.
To go further, you need to consider that factorials get very large very fast, and you will need an arbitrary length math library to get good results. Theoretically, you could get whatever resolution you want, but truncation and round-off will cause accumulated error unless your math library has none. That is a bigger issue than the solution using Taylor's Series to start with.
#include<stdio.h>
#include<math.h>
void main()
{
int i = 2, n, s = 1, x, pwr = 1, dr;
float nr = 1, x1, sum;
clrscr();
printf("\n\n\t ENTER THE ANGLE…: ");
scanf("%d", &x);
x1 = 3.142 * (x / 180.0);
sum = x1;
printf("\n\t ENTER THE NUMBER OF TERMS…: ");
scanf("%d", &n);
while(i <= n)
{
pwr = pwr + 2;
dr = dr * pwr * (pwr - 1);
sum = sum + (nr / dr) * s;
s = s * (-1);
nr = nr * x1 * x1;
i+= 2;
}
printf("\n\t THE SUM OF THE SINE SERIES IS..: %0.3f",sum);
getch();
}
#include<stdio.h>
#include<math.h>
void main()
{
int i = 2, n, s = 1, x, pwr = 1, dr;
float nr = 1, x1, sum;
clrscr();
printf("\n\n\t ENTER THE ANGLE...: ");
scanf("%d", &x);
x1 = 3.142 * (x / 180.0);
sum = x1;
printf("\n\t ENTER THE NUMBER OF TERMS...: ");
scanf("%d", &n);
while(i <= n)
{
pwr = pwr + 2;
dr = dr * pwr * (pwr - 1);
sum = sum + (nr / dr) * s;
s = s * (-1);
nr = nr * x1 * x1;
i+= 2;
}
printf("\n\t THE SUM OF THE SINE SERIES IS..: %0.3f",sum);
getch();
}
Sure, do write. The attached wikipedia-entry will help.
∑ i+∑ (i+2)
C-language was derived from B-language.
C Language is First Step of Programming Language, Help for C Language you are show the correct answer
in case of the c languages we are very flexible to to solve the problems in the step by step order (because of using the c-functions,other variables,other operators), debugging also so very easy because trace the exact steps which are given in the problem domains.
C is a pop language. C is a case sensetive language. C is motherof all language. C is block structure language. C is a high level language. C is advace of B language. C developed by D.richties in 1972 at AT & T Bell lab in USA. Sachin Bhardwaj 986854722 skbmca@gmail.com
it is not regular language .it is high level language
find the program in c-pgms.blogspot.com
java language moreover solve the problems witch is encounter in c and c++ that s why we use the java language...
Please do.
You will need to use the distributive law to solve discrete series by grouping. The distributive law is a(b + c) = ab + ac. You will be removing the common factors as you go.
Consider any triangle ABC, and let AD be the altitude from A on to BC. Then sin(B) = AD/AB so that AD = AB*sin(B) and sin(C) = AD/AC so that AD = AC*sin(C) Therefore AB*sin(B) = AC*sin(C) or c*sin(B) = b*sin(C) where the lower case letter represents the side opposite the angle with the upper case name. Divide both sides by bc to give sin(B)/b = sin(C)/c. Similarly, using the altitude from B you can show that sin(A)/a = sin(C)/c. Combining with the previous result, sin(A)/a = sin(B)/b = sin(C)/c.
Yes, but you would need to know a degree measure too. [Sin(A)/a] = [Sin(B)/b] = [Sin(C)/c] [a/Sin(A)] = [b/Sin(B)] = [c/Sin(C)]
Just as you would do it manually, I mean there is no predefined 'solve_equation' function in C.
You need to use the sine rule. If the three angles are A, B and C and the sides opposite them are named a, b and c then, by the sine rule, a/sin(A) = b/sin(b) = c/sin(C) Therefore b = a*sin(B)/sin(A) = a*y where y = sin(B)/sin(A) can be calculated and c = a*sin(C)/sin(A) = a*z where z = sin(C)/sin(A) can be calculated. then perimeter = p = a + b + c = a + ay + az = a*(1 + y + z) therefore a = p/(1 + y + z) or a = p/[1 + sin(B)/sin(A) + sin(C)/sin(A)]. Everything on the right hand side is known and so a can be calculated. Once that has been done, b = a*y and c = a*z.
28 The Law of Sines: a/sin A = b/sin B = c/sin C 24/sin 42˚ = c/sin (180˚ - 42˚ - 87˚) since there are 180˚ in a triangle. 24/sin 42˚ = c/sin 51˚ c = 24(sin 51˚)/sin 42˚ ≈ 28
In a triangle ABC, with side a opposite angle A, side b opposite angle B and side c opposite angle C, the sine rule is: sin(A)/a = sin(B)/b = sin(C)/c The cosine rule is: a2 = b2 + c2 - 2bc*cos(A) and, by symmetry, b2 = c2 + a2 - 2ca*cos(B) c2 = a2 + b2 - 2ab*cos(C)
To find unknown sides or angles of a triangle. For triangle ABC, if C is a right angle and you are using angle A the side a is the opposite of A, side b is the adjacent side of angle A and c is the hypotenuse. Ex: Sin A = a/c, if you know any 2 you can solve for the 3rd. Cos A = b/c, if you know any 2 you can solve for the 3rd. Tan A = a/b, and again, if you know any 2 you can solve for the 3rd.
The Law of sines: a/sin A = b/sin B = c/sin CIf the angle C in the triangle ABC is 90 degrees, then the triangle ABC is a right triangle, where c is the measure of the hypotenuse, a is the measure of the leg opposite the angle A, and b is the measure of the leg opposite the angle B.Let us observe what happens when sin C = sin 90 degrees = 1.c/sin C = a/sin A cross multiply;c sin A = a sin C divide by c both sides;(c sin A)/c = (a sin C)/c simplify c on the left hand side;sin A = (a sin C)/c = [(a)(1)]/c = a/csin A = (measure of leg opposite the angle A)/(measure of hypotenuse)From the Law of Cosine we know that cos A= (b^2 + c^2 - a^2)/(2bc). If we substitute a^2 + b^2 for c^2, we have:cos A = (b^2 + (a^2+ b^2) - a^2 )/(2ab)cos A = 2b^2 /2ab simplify;cos A = b/c = (measure of leg adjacent the angle A)/(measure of hypotenuse) Therefore tan A = sin A/cos A =(a/c)/(b/c) = (a/c)(c/b) = a/b = (measure of leg opposite the angle A)/(measure of leg adjacent to angle A). And cot A = cos A/sin A = (b/c)/(a/c) = (b/c)(c/a) = b/a = (measure of leg adjacent to angle A)/(measure of leg opposite the angle A).