Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void YL14()
- {
- int algus = -90, lõpp = 90, samm = 10;
- //int algus = 270, lõpp = 450, samm = 10;
- double f1, f2, f3;
- for (int g = algus; g <= lõpp; g += samm)
- {
- double r = Math.PI * g / 180;
- f1 = Math.Cos(r);
- f2 = CosF(r, 5);
- f3 = CosF2(r, 5);
- Console.WriteLine("{0:N1} {1,9:N5} {2,9:N5} {3,9:N5}", g, f1, f2, f3);
- }
- }
- static double CosF(double x, int t) // x-nurk t-täpsus
- {
- double Summa = 0;
- int n = 0;
- double An;
- do
- {
- An = AsteF(-1, n) * AsteF(x, 2 * n) / FactF(2 * n);
- Summa += An;
- n++;
- } while (Math.Abs(An) > Math.Pow(10, -t) && n < 1000);
- return Summa;
- }
- static double CosF2(double x, int t) // x-nurk t-täpsus
- {
- int n = 0;
- double An = 1;
- double Summa = An;
- do
- {
- n++;
- double suhe = -x * x / (2 * n * (2 * n - 1));
- An = An * suhe;
- Summa += An;
- } while (Math.Abs(An) > Math.Pow(10, -t) && n < 1000);
- return Summa;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement