Created
May 26, 2019 16:39
-
-
Save alldevic/e59181a0a4e8a24b069c53b4a4f7b267 to your computer and use it in GitHub Desktop.
Taylor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Введите Xнач: | |
-1 | |
Введите Xкон: | |
1 | |
Введите шаг dx: | |
0,01 | |
Введите точность eps: | |
0,0000001 | |
ЗНАЧЕНИЯ ARCCOS(X) | |
| x | f(x) | N | C#(f(x)) | |
| -1 | 3,09551 | 149 | 3,14159265358979 | |
| -0,99 | 2,99979 | 149 | 3,00005318026537 | |
| -0,98 | 2,94125 | 149 | 2,94125781126667 | |
| -0,97 | 2,89603 | 124 | 2,8960271360745 | |
| -0,96 | 2,8578 | 97 | 2,85779854438147 | |
| -0,95 | 2,82403 | 80 | 2,82403222429827 | |
| -0,94 | 2,79343 | 68 | 2,79342663231683 | |
| -0,93 | 2,76521 | 59 | 2,76520917127207 | |
| -0,92 | 2,73888 | 52 | 2,73887681200913 | |
| -0,91 | 2,71408 | 47 | 2,71408038864492 | |
| -0,9 | 2,69057 | 43 | 2,69056584179353 | |
| -0,89 | 2,66814 | 39 | 2,66814149631773 | |
| -0,88 | 2,64666 | 36 | 2,6466585272489 | |
| -0,87 | 2,626 | 33 | 2,6259986473437 | |
| -0,86 | 2,60607 | 31 | 2,60606599927541 | |
| -0,85 | 2,58678 | 29 | 2,58678162060972 | |
| -0,84 | 2,56808 | 27 | 2,5680795491667 | |
| -0,83 | 2,5499 | 26 | 2,54990401116325 | |
| -0,82 | 2,53221 | 24 | 2,532207345559 | |
| -0,81 | 2,51495 | 23 | 2,51494844194905 | |
| -0,8 | 2,49809 | 22 | 2,49809154479651 | |
| -0,79 | 2,48161 | 21 | 2,48160532420229 | |
| -0,78 | 2,46546 | 20 | 2,46546214402913 | |
| -0,77 | 2,44964 | 19 | 2,44963747846348 | |
| -0,76 | 2,43411 | 18 | 2,43410944181045 | |
| -0,75 | 2,41886 | 17 | 2,41885840577638 | |
| -0,74 | 2,40387 | 17 | 2,40386668513654 | |
| -0,73 | 2,38912 | 16 | 2,38911827742646 | |
| -0,72 | 2,3746 | 15 | 2,37459864572793 | |
| -0,71 | 2,36029 | 15 | 2,36029453614107 | |
| -0,7 | 2,34619 | 14 | 2,34619382340565 | |
| -0,69 | 2,33229 | 14 | 2,33228537954253 | |
| -0,68 | 2,31856 | 13 | 2,31855896145482 | |
| -0,67 | 2,30501 | 13 | 2,30500511424826 | |
| -0,66 | 2,29161 | 12 | 2,29161508766499 | |
| -0,65 | 2,27838 | 12 | 2,27838076352025 | |
| -0,64 | 2,26529 | 11 | 2,26529459242145 | |
| -0,63 | 2,25235 | 11 | 2,25234953835801 | |
| -0,62 | 2,23954 | 11 | 2,23953902999727 | |
| -0,61 | 2,22686 | 10 | 2,22685691771982 | |
| -0,6 | 2,2143 | 10 | 2,21429743558818 | |
| -0,59 | 2,20186 | 10 | 2,20185516757292 | |
| -0,58 | 2,18952 | 9 | 2,18952501746715 | |
| -0,57 | 2,1773 | 9 | 2,17730218200798 | |
| -0,56 | 2,16518 | 9 | 2,16518212679596 | |
| -0,55 | 2,15316 | 9 | 2,15316056466364 | |
| -0,54 | 2,14123 | 8 | 2,14123343619482 | |
| -0,53 | 2,1294 | 8 | 2,1293968921377 | |
| -0,52 | 2,11765 | 8 | 2,11764727749084 | |
| -0,51 | 2,10598 | 8 | 2,1059811170705 | |
| -0,5 | 2,09439 | 7 | 2,0943951023932 | |
| -0,49 | 2,08289 | 7 | 2,08288607972904 | |
| -0,48 | 2,07145 | 7 | 2,07145103919948 | |
| -0,47 | 2,06009 | 7 | 2,06008710480901 | |
| -0,46 | 2,04879 | 7 | 2,04879152531385 | |
| -0,45 | 2,03756 | 6 | 2,03756166584219 | |
| -0,44 | 2,02639 | 6 | 2,02639500019072 | |
| -0,43 | 2,01529 | 6 | 2,01528910373072 | |
| -0,42 | 2,00424 | 6 | 2,00424164686478 | |
| -0,41 | 1,99325 | 6 | 1,99325038898165 | |
| -0,4 | 1,98231 | 6 | 1,98231317286238 | |
| -0,39 | 1,97143 | 5 | 1,97142791949627 | |
| -0,38 | 1,96059 | 5 | 1,96059262326916 | |
| -0,37 | 1,94981 | 5 | 1,94980534749085 | |
| -0,36 | 1,93906 | 5 | 1,93906422023154 | |
| -0,35 | 1,92837 | 5 | 1,92836743044041 | |
| -0,34 | 1,91771 | 5 | 1,91771322432206 | |
| -0,33 | 1,9071 | 5 | 1,90709990194888 | |
| -0,32 | 1,89653 | 4 | 1,89652581408953 | |
| -0,31 | 1,88599 | 4 | 1,88598935923562 | |
| -0,3 | 1,87549 | 4 | 1,87548898081029 | |
| -0,29 | 1,86502 | 4 | 1,86502316454388 | |
| -0,28 | 1,85459 | 4 | 1,85459043600322 | |
| -0,27 | 1,84419 | 4 | 1,84418935826237 | |
| -0,26 | 1,83382 | 4 | 1,83381852970337 | |
| -0,25 | 1,82348 | 4 | 1,82347658193698 | |
| -0,24 | 1,81316 | 3 | 1,81316217783386 | |
| -0,23 | 1,80287 | 3 | 1,80287400965761 | |
| -0,22 | 1,79261 | 3 | 1,79261079729169 | |
| -0,21 | 1,78237 | 3 | 1,78237128655299 | |
| -0,2 | 1,77215 | 3 | 1,77215424758523 | |
| -0,19 | 1,76196 | 3 | 1,76195847332596 | |
| -0,18 | 1,75178 | 3 | 1,75178277804144 | |
| -0,17 | 1,74163 | 3 | 1,741625995924 | |
| -0,16 | 1,73149 | 3 | 1,73148697974681 | |
| -0,15 | 1,72136 | 2 | 1,72136459957158 | |
| -0,14 | 1,71126 | 2 | 1,71125774150475 | |
| -0,13 | 1,70117 | 2 | 1,70116530649804 | |
| -0,12 | 1,69109 | 2 | 1,69108620918968 | |
| -0,11 | 1,68102 | 2 | 1,68101937678264 | |
| -0,1 | 1,67096 | 2 | 1,67096374795646 | |
| -0,09 | 1,66092 | 2 | 1,66091827180949 | |
| -0,08 | 1,65088 | 2 | 1,65088190682856 | |
| -0,07 | 1,64085 | 2 | 1,64085361988295 | |
| -0,06 | 1,63083 | 1 | 1,63083238524017 | |
| -0,05 | 1,62082 | 1 | 1,62081718360067 | |
| -0,04 | 1,61081 | 1 | 1,61080700114889 | |
| -0,03 | 1,6008 | 1 | 1,60080082861837 | |
| -0,02 | 1,5908 | 1 | 1,59079766036829 | |
| -0,01 | 1,5808 | 1 | 1,58079649346906 | |
| 0 | 1,5708 | 1 | 1,5707963267949 | |
| 0,01 | 1,5608 | 1 | 1,56079616012073 | |
| 0,02 | 1,55079 | 1 | 1,55079499322151 | |
| 0,03 | 1,54079 | 1 | 1,54079182497142 | |
| 0,04 | 1,53079 | 1 | 1,53078565244091 | |
| 0,05 | 1,52078 | 1 | 1,52077546998913 | |
| 0,06 | 1,51076 | 1 | 1,51076026834962 | |
| 0,07 | 1,50074 | 2 | 1,50073903370685 | |
| 0,08 | 1,49071 | 2 | 1,49071074676124 | |
| 0,09 | 1,48067 | 2 | 1,4806743817803 | |
| 0,1 | 1,47063 | 2 | 1,47062890563334 | |
| 0,11 | 1,46057 | 2 | 1,46057327680715 | |
| 0,12 | 1,45051 | 2 | 1,45050644440011 | |
| 0,13 | 1,44043 | 2 | 1,44042734709175 | |
| 0,14 | 1,43033 | 2 | 1,43033491208504 | |
| 0,15 | 1,42023 | 2 | 1,42022805401821 | |
| 0,16 | 1,41011 | 3 | 1,41010567384299 | |
| 0,17 | 1,39997 | 3 | 1,39996665766579 | |
| 0,18 | 1,38981 | 3 | 1,38980987554835 | |
| 0,19 | 1,37963 | 3 | 1,37963418026384 | |
| 0,2 | 1,36944 | 3 | 1,36943840600457 | |
| 0,21 | 1,35922 | 3 | 1,3592213670368 | |
| 0,22 | 1,34898 | 3 | 1,3489818562981 | |
| 0,23 | 1,33872 | 3 | 1,33871864393218 | |
| 0,24 | 1,32843 | 3 | 1,32843047575593 | |
| 0,25 | 1,31812 | 4 | 1,31811607165282 | |
| 0,26 | 1,30777 | 4 | 1,30777412388643 | |
| 0,27 | 1,2974 | 4 | 1,29740329532742 | |
| 0,28 | 1,287 | 4 | 1,28700221758657 | |
| 0,29 | 1,27657 | 4 | 1,27656948904591 | |
| 0,3 | 1,2661 | 4 | 1,2661036727795 | |
| 0,31 | 1,2556 | 4 | 1,25560329435417 | |
| 0,32 | 1,24507 | 4 | 1,24506683950027 | |
| 0,33 | 1,23449 | 5 | 1,23449275164092 | |
| 0,34 | 1,22388 | 5 | 1,22387942926773 | |
| 0,35 | 1,21323 | 5 | 1,21322522314939 | |
| 0,36 | 1,20253 | 5 | 1,20252843335826 | |
| 0,37 | 1,19179 | 5 | 1,19178730609895 | |
| 0,38 | 1,181 | 5 | 1,18100003032064 | |
| 0,39 | 1,17016 | 5 | 1,17016473409352 | |
| 0,4 | 1,15928 | 6 | 1,15927948072741 | |
| 0,41 | 1,14834 | 6 | 1,14834226460814 | |
| 0,42 | 1,13735 | 6 | 1,13735100672501 | |
| 0,43 | 1,1263 | 6 | 1,12630354985908 | |
| 0,44 | 1,1152 | 6 | 1,11519765339907 | |
| 0,45 | 1,10403 | 6 | 1,1040309877476 | |
| 0,46 | 1,0928 | 7 | 1,09280112827594 | |
| 0,47 | 1,08151 | 7 | 1,08150554878078 | |
| 0,48 | 1,07014 | 7 | 1,07014161439031 | |
| 0,49 | 1,05871 | 7 | 1,05870657386075 | |
| 0,5 | 1,0472 | 7 | 1,0471975511966 | |
| 0,51 | 1,03561 | 8 | 1,0356115365193 | |
| 0,52 | 1,02395 | 8 | 1,02394537609895 | |
| 0,53 | 1,0122 | 8 | 1,0121957614521 | |
| 0,54 | 1,00036 | 8 | 1,00035921739497 | |
| 0,55 | 0,98843 | 9 | 0,988432088926153 | |
| 0,56 | 0,97641 | 9 | 0,976410526793834 | |
| 0,57 | 0,96429 | 9 | 0,96429047158181 | |
| 0,58 | 0,95207 | 9 | 0,952067636122646 | |
| 0,59 | 0,93974 | 10 | 0,939737486016875 | |
| 0,6 | 0,9273 | 10 | 0,927295218001612 | |
| 0,61 | 0,91474 | 10 | 0,914735735869974 | |
| 0,62 | 0,90205 | 11 | 0,902053623592525 | |
| 0,63 | 0,88924 | 11 | 0,88924311523178 | |
| 0,64 | 0,8763 | 11 | 0,876298061168341 | |
| 0,65 | 0,86321 | 12 | 0,863211890069541 | |
| 0,66 | 0,84998 | 12 | 0,849977565924807 | |
| 0,67 | 0,83659 | 13 | 0,836587539341538 | |
| 0,68 | 0,82303 | 13 | 0,823033692134976 | |
| 0,69 | 0,80931 | 14 | 0,809307274047263 | |
| 0,7 | 0,7954 | 14 | 0,795398830184144 | |
| 0,71 | 0,7813 | 15 | 0,781298117448725 | |
| 0,72 | 0,76699 | 15 | 0,766994007861867 | |
| 0,73 | 0,75247 | 16 | 0,752474376163337 | |
| 0,74 | 0,73773 | 17 | 0,737725968453249 | |
| 0,75 | 0,72273 | 17 | 0,722734247813416 | |
| 0,76 | 0,70748 | 18 | 0,707483211779343 | |
| 0,77 | 0,69196 | 19 | 0,691955175126317 | |
| 0,78 | 0,67613 | 20 | 0,676130509560661 | |
| 0,79 | 0,65999 | 21 | 0,659987329387498 | |
| 0,8 | 0,6435 | 22 | 0,643501108793284 | |
| 0,81 | 0,62664 | 23 | 0,626644211640741 | |
| 0,82 | 0,60939 | 24 | 0,609385308030795 | |
| 0,83 | 0,59169 | 26 | 0,591688642426544 | |
| 0,84 | 0,57351 | 27 | 0,573513104423097 | |
| 0,85 | 0,55481 | 29 | 0,554811032980072 | |
| 0,86 | 0,53553 | 31 | 0,535526654314388 | |
| 0,87 | 0,51559 | 33 | 0,515594006246091 | |
| 0,88 | 0,49493 | 36 | 0,494934126340896 | |
| 0,89 | 0,47345 | 39 | 0,473451157272066 | |
| 0,9 | 0,45103 | 43 | 0,451026811796262 | |
| 0,91 | 0,42751 | 47 | 0,427512264944869 | |
| 0,92 | 0,40272 | 52 | 0,402715841580661 | |
| 0,93 | 0,37638 | 59 | 0,376383482317728 | |
| 0,94 | 0,34817 | 68 | 0,348166021272961 | |
| 0,95 | 0,31756 | 80 | 0,317560429291522 | |
| 0,96 | 0,2838 | 97 | 0,283794109208328 | |
| 0,97 | 0,24557 | 124 | 0,245565517515292 | |
| 0,98 | 0,20034 | 149 | 0,20033484232312 | |
| 0,99 | 0,1418 | 149 | 0,141539473324427 | |
| 1 | 0,04608 | 149 | 0 | |
Process finished with exit code 0. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace Taylor | |
{ | |
internal class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
double xbegin, xend, dx, eps; | |
try | |
{ | |
xbegin = ReadDouble("Введите Xнач:", -1, 1); | |
xend = ReadDouble("Введите Xкон:", xbegin, 1); | |
dx = ReadDouble("Введите шаг dx:", 0.001, 1); | |
eps = ReadDouble("Введите точность eps:", 0.0000000001, 1); | |
} | |
catch (Exception e) | |
{ | |
Console.WriteLine(e.Message); | |
Console.WriteLine("Приложение будет закрыто"); | |
Console.ReadKey(); | |
return; | |
} | |
Console.WriteLine(); | |
Console.WriteLine("\t\t\tЗНАЧЕНИЯ ARCCOS(X)\t\t\t"); | |
Console.WriteLine("|\tx\t|\tf(x)\t|\tN\t|\tC#(f(x))\t"); | |
while (xbegin <= xend) | |
{ | |
double prev = Arccos(xbegin, 1); | |
double curr = Arccos(xbegin, 2); | |
int count = 2; | |
while (Math.Abs(curr - prev) > eps) | |
{ | |
prev = curr; | |
count++; | |
curr = Arccos(xbegin, count); | |
} | |
prev = Math.Round(prev, eps.ToString().Length); | |
Console.WriteLine(GetTableRow(xbegin, prev, count - 1)); | |
xbegin += dx; | |
xbegin = Math.Round(xbegin, 15); | |
} | |
} | |
private static double Arccos(double x, int n) | |
{ | |
double res = Math.PI / 2 - x; | |
for (int i = 0; i < n; i++) | |
{ | |
double a = 1, b = 1; | |
for (int j = 0; j < i + 1; j++) | |
{ | |
a *= 2 * (j + 1) - 1; | |
b *= 2 * (j + 1); | |
} | |
a *= Math.Pow(x, 2 * (i+1) + 1); | |
b *= 2 * (i+1) + 1; | |
res -= a / b; | |
} | |
return res; | |
} | |
public static double ReadDouble(string message, double min, double max) | |
{ | |
Console.WriteLine(message); | |
try | |
{ | |
double res = Convert.ToDouble(Console.ReadLine()); | |
if (res < min || res > max) | |
{ | |
throw new ArgumentOutOfRangeException(); | |
} | |
return res; | |
} | |
catch (FormatException) | |
{ | |
throw new Exception("Введены некорректные данные! Вы ввели не число с плавающей точкой"); | |
} | |
catch (IndexOutOfRangeException) | |
{ | |
string exMessage = string.Format("Введены некорректные данные! Введенное число не лежит на [{0}; {1}]", | |
min, max); | |
throw new Exception(exMessage); | |
} | |
} | |
static string GetTableRow(double x, double fx, double count) | |
{ | |
return string.Format("|\t{0}\t|\t{1}\t|\t{2}\t|\t{3}\t", x, fx, count, Math.Acos(x)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment