# Taylor's series

A well-behaved function can be expanded into a power series. This means that for all non-negative integers $k$ there are real numbers $a_{k}$ such that
    $f(x)=\sum _{k=0}^{\infty }a_{k}x^{k}=a_{0}+a_{1}x+a_{2}x^{2}+a_{3}x^{3}+a_{4}x^{4}+\cdots$
Let us calculate the first four derivatives using $(x^{n})'=n\,x^{n-1}$:
    $f'(x)=a_{1}+2\,a_{2}x+3\,a_{3}x^{2}+4\,a_{4}x^{3}+5\,a_{5}x^{4}+\cdots$
    $f''(x)=2\,a_{2}+2\cdot 3\,a_{3}x+3\cdot 4\,a_{4}x^{2}+4\cdot 5\,a_{5}x^{3}+\cdots$
    $f'''(x)=2\cdot 3\,a_{3}+2\cdot 3\cdot 4\,a_{4}x+3\cdot 4\cdot 5\,a_{5}x^{2}+\cdots$
    $f''''(x)=2\cdot 3\cdot 4\,a_{4}+2\cdot 3\cdot 4\cdot 5\,a_{5}x+\cdots$
Setting $x$ equal to zero, we obtain
    $f(0)=a_{0},\quad f'(0)=a_{1},\quad f''(0)=2\,a_{2},\quad f'''(0)=2\times 3\,a_{3},\quad f''''(0)=2\times 3\times 4\,a_{4}.$
Let us write $f^{(n)}(x)$ for the $n$-th derivative of $f(x).$ We also write $f^{(0)}(x)=f(x)$ — think of $f(x)$ as the "zeroth derivative" of $f(x).$ We thus arrive at the general result $f^{(k)}(0)=k!\,a_{k},$ where the factorial $k!$ is defined as equal to 1 for $k=0$ and $k=1$ and as the product of all natural numbers $n\leq k$ for $k>1.$ Expressing the coefficients $a_{k}$ in terms of the derivatives of $f(x)$ at $x=0,$ we obtain
This is the Taylor series for $f(x).$
A remarkable result: if you know the value of a well-behaved function $f(x)$ and the values of all of its derivatives at the single point $x=0$ then you know $f(x)$ at all points $x.$ Besides, there is nothing special about $x=0,$ so $f(x)$ is also determined by its value and the values of its derivatives at any other point $x_{0}$:

## Examples
### cos(x)

$f(x)=\cos(x);\ f(0)=\cos(0)=1$
$f'(x)=-\sin(x);\ f'(0)=-\sin(0)=0$
$f''(x)=-\cos(x);\ f''(0)=-\cos(0)=-1$
$f'''(x)=\sin(x);\ f'''(0)=\sin(0)=0$
$f''''(x)=\cos(x);\ f''''(0)=\cos(0)=1$
$a_{0}=f(0)=1$
$a_{1}=f'(0)=0$
$a_{2}={\frac {f''(0)}{2}}={\frac {-1}{2!}}$
$a_{3}={\frac {f'''(0)}{2*3}}={\frac {0}{3!}}=0$
$a_{4}={\frac {f''''(0)}{2*3*4}}={\frac {1}{4!}}$
$\cos(x)=a_{0}+a_{1}x+a_{2}x^{2}+a_{3}x^{3}+a_{4}x^{4}+\cdots$ $=1+(0)x+{\frac {-1}{2}}x^{2}+0x+{\frac {1}{4!}}x^{4}+\cdots$ $=1-{\frac {x^{2}}{2!}}+{\frac {x^{4}}{4!}}-{\frac {x^{6}}{6!}}+{\frac {x^{8}}{8!}}-\cdots$
* Some basic checking:
* $\cos(0)=1-{\frac {0^{2}}{2!}}+{\frac {0^{4}}{4!}}-{\frac {0^{6}}{6!}}+{\frac {0^{8}}{8!}}-\cdots =1$
* $\cos(-x)=1-{\frac {(-x)^{2}}{2!}}+{\frac {(-x)^{4}}{4!}}-{\frac {(-x)^{6}}{6!}}+{\frac {(-x)^{8}}{8!}}-\cdots$
* $=1-{\frac {x^{2}}{2!}}+{\frac {x^{4}}{4!}}-{\frac {x^{6}}{6!}}+{\frac {x^{8}}{8!}}-\cdots =\cos(x)$
* ${\frac {d(\cos(x))}{dx}}=0-{\frac {2x}{2!}}+{\frac {4x^{3}}{4!}}-{\frac {6x^{5}}{6!}}+{\frac {8x^{7}}{8!}}\cdots$
* $=-x+{\frac {x^{3}}{3!}}-{\frac {x^{5}}{5!}}+{\frac {x^{7}}{7!}}\cdots$
* $=-\sin(x)$
* $\sin(x)=x-{\frac {x^{3}}{3!}}+{\frac {x^{5}}{5!}}-{\frac {x^{7}}{7!}}+\cdots$
* ${\frac {d(\sin(x))}{dx}}=1-{\frac {3x^{2}}{3!}}+{\frac {5x^{4}}{5!}}-{\frac {7x^{6}}{7!}}+\cdots$
* $=1-{\frac {x^{2}}{2!}}+{\frac {x^{4}}{4!}}-{\frac {x^{6}}{6!}}+\cdots$
* $=\cos(x)$

### arctan(x)

$y=\arctan(x)$
$x=\tan(y)$
${\frac {dx}{dy}}=\sec ^{2}(y)$
$y'={\frac {dy}{dx}}=\cos ^{2}(y)={\frac {1}{1+x^{2}}}$. See $\cos(\theta )$.

#### Second derivative y″

* $(1+x^{2})y'=1$
* $(1+x^{2})y''+y'(2x)=0$
* $y''={\frac {-y'(2x)}{1+x^{2}}}$
* $={\frac {-2x}{1+x^{2}}}.y'$
* $={\frac {-2x}{1+x^{2}}}.{\frac {1}{1+x^{2}}}$
* $={\frac {-2x}{(1+x^{2})^{2}}}$

#### Third derivative y¹¹¹

* $(1+2x^{2}+x^{4})y''=-2x$
* $(1+2x^{2}+x^{4})y'''+y''(4x+4x^{3})=-2$
* $y'''={\frac {-2-y''(4x+4x^{3})}{1+2x^{2}+x^{4}}}$
* $={\frac {-2-y''4x(1+x^{2})}{1+2x^{2}+x^{4}}}$
* $={\frac {-2-{\frac {-2x}{(1+x^{2})^{2}}}.4x(1+x^{2})}{1+2x^{2}+x^{4}}}$
* $={\frac {-2-{\frac {-2x}{1+x^{2}}}.4x}{1+2x^{2}+x^{4}}}$
* $={\frac {-2+{\frac {8x^{2}}{1+x^{2}}}}{1+2x^{2}+x^{4}}}$
* $={\frac {\frac {-2(1+x^{2})+8x^{2}}{1+x^{2}}}{1+2x^{2}+x^{4}}}$
* $={\frac {\frac {-2-2x^{2}+8x^{2}}{1+x^{2}}}{1+2x^{2}+x^{4}}}$
* $={\frac {\frac {-2+6x^{2}}{1+x^{2}}}{1+2x^{2}+x^{4}}}$
* $={\frac {-2+6x^{2}}{(1+2x^{2}+x^{4})(1+x^{2})}}$
* $={\frac {-2+6x^{2}}{(1+x^{2})^{3}}}$

#### (continued)

If you continue to calculate derivatives, you will produce the following sequence:
$f(0)=0$
$f'(0)=1$
$f''(0)=0$
$f'''(0)=-2=-(2!)$
$f''''(0)=0$
$f^{v}(0)=24=4!$
$f^{vi}(0)=0$
$f^{vii}(0)=-720=-(6!)$
$f^{viii}(0)=0$
$f^{viiii}(0)=40320=8!$
$f^{x}(0)=0$
$f^{xi}(0)=-3628800=-(10!)$
$f^{xii}(0)=0$
$f^{xiii}(0)=479001600=12!$
$\arctan(x)=a_{0}+a_{1}x+a_{2}x^{2}+a_{3}x^{3}+a_{4}x^{4}+\cdots$
$=0+(1)x+(0)x^{2}+{\frac {-(2!)}{3!}}x^{3}+(0)x^{4}+{\frac {4!}{5!}}x^{5}+(0)x^{6}+{\frac {-(6!)}{7!}}x^{7}+(0)x^{8}+{\frac {8!}{9!}}x^{9}+(0)x^{10}+{\frac {-(10!)}{11!}}x^{11}+\cdots$
$=x-{\frac {1}{3}}x^{3}+{\frac {1}{5}}x^{5}-{\frac {1}{7}}x^{7}+{\frac {1}{9}}x^{9}-{\frac {1}{11}}x^{11}+\cdots$
* Some basic checking:
* $\arctan(0)=0$
* $\arctan(-x)=-\arctan(x).$
* ${\frac {d(\arctan(x))}{dx}}$
* $=1-{\frac {3x^{2}}{3}}+{\frac {5x^{4}}{5}}-{\frac {7x^{6}}{7}}+{\frac {9x^{8}}{9}}-{\frac {11x^{10}}{11}}+\cdots$
* $=1-x^{2}+x^{4}-x^{6}+x^{8}-x^{10}+\cdots$
* Also, ${\frac {d(\arctan(x))}{dx}}={\frac {1}{1+x^{2}}}$
* Show that ${\frac {1}{1+x^{2}}}$
* $=1-x^{2}+x^{4}-x^{6}+x^{8}-x^{10}+\cdots$
* or that $1=(1+x^{2})(1-x^{2}+x^{4}-x^{6}+x^{8}-x^{10}+\cdots )$
* $(1+x^{2})(1-x^{2}+x^{4}-x^{6}+x^{8}-x^{10}+\cdots )$
* $=1(1-x^{2}+x^{4}-x^{6}+x^{8}-x^{10}+\cdots )+x^{2}(1-x^{2}+x^{4}-x^{6}+x^{8}-x^{10}+\cdots )$
* $=1-x^{2}+x^{4}-x^{6}+x^{8}-x^{10}+\cdots +x^{2}-x^{4}+x^{6}-x^{8}+x^{10}-x^{12}+\cdots$
* $=1\ \cdots \ \pm \ x^{2n}$
* If abs$(x)<1,\ \lim _{n\rightarrow \infty }x^{2n}=0.$
* Figure 1: Graph of $t(x),$ Taylor series representing $\arctan(x)$ for
* $x$ close to $0.$
* In the diagram to the right, $t(x)$ is the Taylor series representing $\arctan(x)$ for
* $x$ close to $0.$
* In the box above the proof that $t(x)$ is an accurate representation of $\arctan(x)$
* is valid for abs$(x)<1.$
* When abs$(x)>1,$ the diagram vividly illustrates that the series rapidly diverges.
* To be accurate, the line $y={\frac {\pi }{4}}$ should be $y={\frac {\pi }{4}}$ rad
* or $y={\frac {\pi }{4}}^{c}$ meaning $y={\frac {\pi }{4}}$ radians. In theoretical work
* a value such as ${\frac {\pi }{4}}$ is understood to be ${\frac {\pi }{4}}$ radians or
* $45^{\circ }$ meaning $45$ degrees.

#### In practice

* Figure 1: Graph of $t(x),$ Taylor series representing $\arctan(x)$
* for $x$ close to $0.75.$
* $x_{0}=\tan(36{\tfrac {3}{4}}^{\circ })=0.7467354177837216717375001402,$ close to $0.75.$
* $f(x_{0})=\arctan(x_{0})=0.6414085001079161195194563572$ rad.$$
* y = 0.6414085001079161195194563572
* +(0.6420076723519613087221948458)(x-(0.7467354177837216717375001402))
* +(-0.3077848130939266477182675970)(x-0.7467354177837216717375001402)^2
* +(0.05934881813852229894809158807)(x-0.7467354177837216717375001402)^3
* +(0.05612149216561873709345633871)(x-0.7467354177837216717375001402)^4
* +(-0.0659097533448882821311588572)(x-0.7467354177837216717375001402)^5
* +(0.02864269115336634046783964776)(x-0.7467354177837216717375001402)^6
* +(0.006684824489389227404750195292)(x-0.7467354177837216717375001402)^7
* +(-0.01939996954693863883077829889)(x-0.7467354177837216717375001402)^8
* +(0.01319629210955273736079467214)(x-0.7467354177837216717375001402)^9
* +(-0.001423635337528918097834676738)(x-0.7467354177837216717375001402)^10
* +(-0.005690817314508170664127596721)(x-0.7467354177837216717375001402)^11
* +(0.005763416294060825609852171147)(x-0.7467354177837216717375001402)^12
* +(-0.002009530403041012685757678258)(x-0.7467354177837216717375001402)^13
* +(-0.001382413103546475118963526286)(x-0.7467354177837216717375001402)^14
* +(0.002355235379425975362106687309)(x-0.7467354177837216717375001402)^15
* +(-0.001340525935442931206538139095)(x-0.7467354177837216717375001402)^16
* +(-0.0001244720120416846251034920203)(x-0.7467354177837216717375001402)^17
* +(0.0008777184853106580549638629701)(x-0.7467354177837216717375001402)^18
* +(-0.0007257802485492202930793702930)(x-0.7467354177837216717375001402)^19
* +(0.0001539460026510816727324277808)(x-0.7467354177837216717375001402)^20
* +(0.0002810020934892180446689969911)(x-0.7467354177837216717375001402)^21
* +(-0.0003470330774958963760466009045)(x-0.7467354177837216717375001402)^22
* +(0.0001535570475871531716152621841)(x-0.7467354177837216717375001402)^23
* +(0.00006313260945054237374661397478)(x-0.7467354177837216717375001402)^24
* +(-0.0001488094986598041280906554962)(x-0.7467354177837216717375001402)^25
* +(0.00009977993191704606200503722720)(x-0.7467354177837216717375001402)^26
* +(-0.000003667561779685224841381874106)(x-0.7467354177837216717375001402)^27
* +(-0.00005609286432922550484209657985)(x-0.7467354177837216717375001402)^28
* +(0.00005412057738460028511566507574)(x-0.7467354177837216717375001402)^29
* +(-0.00001655090242419904039018979491)(x-0.7467354177837216717375001402)^30
* +(-0.00001714674178231985986067601799)(x-0.7467354177837216717375001402)^31
* +(0.00002588855802866968641107644970)(x-0.7467354177837216717375001402)^32
* +(-0.00001372909690493026279553133838)(x-0.7467354177837216717375001402)^33
* +(-0.000002866406864208033772447118585)(x-0.7467354177837216717375001402)^34
* +(0.00001098036048658105543109288040)(x-0.7467354177837216717375001402)^35
* +(-0.000008497717911244361532280438636)(x-0.7467354177837216717375001402)^36
* +(0.000001259146436001274560243296183)(x-0.7467354177837216717375001402)^37
* +(0.000003992939704019955177003526706)(x-0.7467354177837216717375001402)^38
* +(-0.000004497268683100848779169934291)(x-0.7467354177837216717375001402)^39
* +(0.000001768945188244137235636524921)(x-0.7467354177837216717375001402)^40
* +(0.000001091706749083768850937760502)(x-0.7467354177837216717375001402)^41
* +(-0.000002103423912310375893571195410)(x-0.7467354177837216717375001402)^42
* +(0.000001301617082996039555612971998)(x-0.7467354177837216717375001402)^43
* +(6.937967909808721515382339295E-8)(x-0.7467354177837216717375001402)^44
* +(-8.635525611989332402947366709E-7)(x-0.7467354177837216717375001402)^45
* +(7.673857631132879175874596987E-7)(x-0.7467354177837216717375001402)^46
* +(-1.893140553441536683377149770E-7)(x-0.7467354177837216717375001402)^47
* +(-2.944033068289732156296704644E-7)(x-0.7467354177837216717375001402)^48
* +(3.930991061512879804635643270E-7)(x-0.7467354177837216717375001402)^49
* +(-1.879241426421737899718180888E-7)(x-0.7467354177837216717375001402)^50

### arcsin(x)

$y=\arcsin(x)$
$x=\sin(y)$
${\frac {dx}{dy}}=\cos(y)={\sqrt {1-x^{2}}}$
${\frac {dy}{dx}}={\frac {1}{\cos(y)}}={\frac {1}{\sqrt {1-x^{2}}}}$
Simple differential equations eliminate the square root and make calculations so much easier.
Let $a={\frac {dy}{dx}}$
Then $a^{2}U=1$ where $U=1-x^{2}$ and $U^{'}=-2x.$
Differentiating both sides:
$a^{2}(-2x)+U2aa^{'}=0$
$U2aa^{'}=2xa^{2}$
$a^{'}={\frac {2xaa}{2aU}}={\frac {ax}{U}}.$
Let $b=a^{'}$
Then $bU=ax$
Differentiating both sides:
$b(-2x)+Ub^{'}=a+xa^{'}=a+xb$
Let $c=b^{'}$
Then $c={\frac {a+3bx}{U}}$
When $x=0,\ U=1.$ Calculation of more derivatives yields:
$y=f(x)=\arcsin(x)$
$a=f^{'}(x)={\frac {1}{\sqrt {1-x^{2}}}}$
$b=f^{''}(x)=ax$
$c=f^{'''}(x)=a+3bx$
$d=f^{''''}(x)=4b+5cx$
$g=f^{v}(x)=9c+7dx$
$h=f^{vi}(x)=16d+9gx$
$j=f^{vii}(x)=25g+11hx$
$k=f^{viii}(x)=36h+13jx$
$l=f^{viiii}(x)=49j+15kx$
and so on.
$\cdots =k=h=d=b=0$
$a=1;\ c=1^{2}a;\ g=3^{2}c;\ j=5^{2}g;\ l=7^{2}j;\ \cdots .$
$\arcsin(x)=x+{\frac {1}{3!}}x^{3}+{\frac {3^{2}}{5!}}x^{5}+{\frac {3^{2}\cdot 5^{2}}{7!}}x^{7}+{\frac {3^{2}\cdot 5^{2}\cdot 7^{2}}{9!}}x^{9}+{\frac {3^{2}\cdot 5^{2}\cdot 7^{2}\cdot 9^{2}}{11!}}x^{11}+\cdots$
$\arcsin(x)=x+{\frac {1}{3!}}x^{3}+{\frac {3}{(2!)(2^{2})5}}x^{5}+{\frac {3\cdot 5}{(3!)(2^{3})7}}x^{7}+{\frac {3\cdot 5\cdot 7}{(4!)(2^{4})9}}x^{9}+{\frac {3\cdot 5\cdot 7\cdot 9}{(5!)(2^{5})11}}x^{11}+\cdots$

#### As programming algorithm:

$\arcsin(x)=x+{\frac {top=1}{(bottom=2)3}}(X=x^{3})$ $+{\frac {top=top(5-2)}{(bottom=bottom(5-1))5}}(X=X(x^{2}))$ $+{\frac {top=top(7-2)}{(bottom=bottom(7-1))7}}(X=X(x^{2}))$ $+\cdots$ $+{\frac {top=top(n-2)}{(bottom=bottom(n-1))n}}(X=X(x^{2}))$

#### In practice

If $|x|$ is close to $1,$ the calculation of $\arcsin(x)$ will take forever.
If you limit $x$ to $\sin 45^{\circ }>=x>=-\sin 45^{\circ },$ then $x^{2}<=0.5$ and each term is guaranteed to be less than half the preceding term.
If $x>\sin 45^{\circ },$ let $t={\frac {\pi }{2}}-y.$
Then $\sin t=\cos y={\sqrt {1-x^{2}}};\ t=\arcsin(\cos y);\ y={\frac {\pi }{2}}-t.$

### Integral of expression

    ${\frac {dy}{dx}}=a^{-x^{2}}$
According to the reference "this expression cannot be integrated..." However, if we convert the expression to a Taylor series, the integral of the series is quite easily calculated.
Let $y=f(x)=a^{-x^{2}}={\frac {1}{a^{x^{2}}}}$
When $x=0,\ y=1$ and the following sequence can be produced.
$y^{''}=-2Ay$ where $A=\ln(a).$
$y^{(4)}=-6Ay^{''}$
$y^{(6)}=-10Ay^{(4)}$
$y^{(8)}=-14Ay^{(6)}$
$y^{(10)}=-18Ay^{(8)}$
$y^{(12)}=-22Ay^{(10)}$ and so on.
Taylor series of $f(x)$ for $x$ close to $0=t(x)=1+c02\cdot x^{2}+c04\cdot x^{4}+c06\cdot x^{6}+\cdots$
where $c02={\frac {y^{''}}{2!}};\ c04={\frac {y^{(4)}}{4!}};\ c06={\frac {y^{(6)}}{6!}}\cdots$
For $a=2$ python code produces the following:
For $a$ close to $1$ or $x$ close to $0,$ the Taylor series is a quite accurate representation of the original expression. When abs$(x)\leq 1.6,$ the abs(maximum difference) between expression and Taylor series is $<1e-15.$
For greater accuracy, greater precision may be specified in python or more terms after $c42$ may be added.
The integral $=I(x)=x+C02\cdot x^{3}+C04\cdot x^{5}+C06\cdot x^{7}+\cdots$
where $C02={\frac {c02}{3}};\ C04={\frac {c04}{5}};\ C06={\frac {c06}{7}}\cdots$
* Figure 1: Curves of $f(x)$ and $t(x)$ where $t(x)$
* is Taylor series representing $f(x)$ for $x$ close to $0$.
* In figure to right, $t(x)=1.5+\cdots ,$ separating $t(x)$ from $f(x)$ to
* illustrate shapes of curves.
* The correct value of $t(x)=1+\cdots$.
* When $x=1,\ f(x)=0.5$ and $t(x)=0.4999999999999999999999997281$.
* To 24 places of decimals $t(x)=0.5000$_$0000$_$0000$_$0000$_$0000$_$0000$.
* Figure 1: Curves of $f(x)$ and $I(x)$ where $I(x)$
* is integral of $t(x)$ and represents integral of $f(x)$ for $x$ close to $0$.
* In this example, constant of integration $C=0.$
* If it were important to calculate the area under $f(x)$ from $x=0$ to $x=1,\ I(x)$
* returns $0.8100254543909558266292852604,$ accurate to about 26 places of decimals.

### sin(x) using (x - x0)

$f(x)=\sin(x)$
$f'(x)=\cos(x)$
$f''(x)=-\sin(x)$
$f'''(x)=-\cos(x)$
$f^{(4)}=\sin(x)$
Let $x_{0}={\frac {\pi }{4}}=45^{\circ }$
$f(x_{0})=f({\frac {\pi }{4}})=\sin({\frac {\pi }{4}})={\frac {\sqrt {2}}{2}}$
$f'(x_{0})=f'({\frac {\pi }{4}})=\cos({\frac {\pi }{4}})={\frac {\sqrt {2}}{2}}$
$f''(x_{0})=f''({\frac {\pi }{4}})=-\sin({\frac {\pi }{4}})=-{\frac {\sqrt {2}}{2}}$
$f'''(x_{0})=f'''({\frac {\pi }{4}})=-\cos({\frac {\pi }{4}})=-{\frac {\sqrt {2}}{2}}$
$f^{(4)}(x_{0})=f^{(4)}({\frac {\pi }{4}})=\sin({\frac {\pi }{4}})={\frac {\sqrt {2}}{2}}$
$t(x)={\frac {\sqrt {2}}{2}}\cdot (x-x_{0})^{0}$ $+{\frac {\sqrt {2}}{2}}\cdot (x-x_{0})^{1}$ $-{\frac {\sqrt {2}}{2}}\cdot {\frac {1}{2!}}\cdot (x-x_{0})^{2}$ $-{\frac {\sqrt {2}}{2}}\cdot {\frac {1}{3!}}\cdot (x-x_{0})^{3}$ $+{\frac {\sqrt {2}}{2}}\cdot {\frac {1}{4!}}\cdot (x-x_{0})^{4}+\cdots$
Let $X=(x-x_{0})=(x-{\frac {\pi }{4}})$
Then $t(x)={\frac {\sqrt {2}}{2}}($ $1+X$ $-{\frac {X^{2}}{2!}}-{\frac {X^{3}}{3!}}$ $+{\frac {X^{4}}{4!}}+{\frac {X^{5}}{5!}}$ $-{\frac {X^{6}}{6!}}-{\frac {X^{7}}{7!}}$ $\ \cdots$ $)$
where $t(x)$ is the Taylor series representing $f(x)=\sin(x)$ for values of $x$ close to $45^{\circ }$ or ${\frac {\pi }{4}}.$
If ${\frac {\pi }{2}}(90^{\circ })\geq x\geq 0$, then $t(x)$ containing powers of $X$ through $15$ is sufficient to keep the error to $<1e-15.$

#### Gallery

* Graph of $t(x)$ representing $\sin(x)$ with powers of $X$ limited to $5$.
* Graph of $t(x)$ representing $\sin(x)$ with powers of $X$ limited to $9$.
* Graph of $t(x)$ representing $\sin(x)$ with powers of $X$ limited to $19$.

#### Almost a sine curve

* Figure 1: Graph of $t(x)$ representing $\sin(x)$ for $x$
* close to ${\frac {\pi }{4}}$.
* Graph to right was produced by Grapher on a Mac.
* A python script produced the following data:
* ( (2^(0.5))/2 )(
* 1 +(x-.785398163397448)
* -((x-.785398163397448)^2)/2
* -((x-.785398163397448)^3)/(2(3))
* +((x-.785398163397448)^4)/(24)
* +((x-.785398163397448)^5)/(120)
* -((x-.785398163397448)^6)/(720)
* -((x-.785398163397448)^7)/(5040)
* +((x-.785398163397448)^8)/(40320)
* +((x-.785398163397448)^9)/(362880)
* -((x-.785398163397448)^10)/(3628800)
* -((x-.785398163397448)^11)/(39916800)
* +((x-.785398163397448)^12)/(479001600)
* +((x-.785398163397448)^13)/(6227020800)
* -((x-.785398163397448)^14)/(87178291200)
* -((x-.785398163397448)^15)/(1307674368000)
* +((x-.785398163397448)^16)/(20922789888000)
* +((x-.785398163397448)^17)/(355687428096000)
* -((x-.785398163397448)^18)/(6402373705728000)
* -((x-.785398163397448)^19)/(121645100408832000)
* +((x-.785398163397448)^20)/(2432902008176640000)
* +((x-.785398163397448)^21)/(51090942171709440000)
* -((x-.785398163397448)^22)/(1124000727777607680000)
* -((x-.785398163397448)^23)/(25852016738884976640000)
* +((x-.785398163397448)^24)/(620448401733239439360000)
* +((x-.785398163397448)^25)/(15511210043330985984000000)
* -((x-.785398163397448)^26)/(403291461126605635584000000)
* -((x-.785398163397448)^27)/(10888869450418352160768000000)
* +((x-.785398163397448)^28)/(304888344611713860501504000000)
* +((x-.785398163397448)^29)/(8841761993739701954543616000000)
* I highlighted the data, copied it with command C and pasted it into the input area of Grapher.
* Well done! Grapher.

### Integral of 1/x

The Taylor series for $f(x)={\frac {1}{x}}$ for $x$ close to $2$ is:
$t(x)={\frac {1}{2}}-{\frac {1}{2^{2}}}\cdot (x-2)+{\frac {1}{2^{3}}}\cdot (x-2)^{2}-{\frac {1}{2^{4}}}\cdot (x-2)^{3}\cdots$
The integral of this series is:
$I(x)={\frac {1}{2}}\cdot (x-2)-(({\frac {1}{2^{2}}})/2)\cdot (x-2)^{2}+(({\frac {1}{2^{3}}})/3)\cdot (x-2)^{3}-(({\frac {1}{2^{4}}})/4)\cdot (x-2)^{4}\cdots +C$
The integral of ${\frac {1}{x}}=\ln(x).$
Therefore $\ln(x)=I(x)$ but what is the value of $C?$
Without $C,$ when $x=2,I(x)=0.\ I(x)$ should be $\ln(2).$
Therefore, for $x$ close to $2:$
$\ln(x)=I(x)$ where $C=\ln(2).$
But what is the value of $\ln(2)?$
Without $C,$ when $x=1,\ I(x)=-0.693147180559945.\ I(x)$ should be $0.$
Therefore $C=0.693147180559945$ or $\ln(2).$
For $x$ close to $2:$
$\ln(x)=\ln(2)+{\frac {1}{2}}\cdot (x-2)-(({\frac {1}{2^{2}}})/2)\cdot (x-2)^{2}+(({\frac {1}{2^{3}}})/3)\cdot (x-2)^{3}-(({\frac {1}{2^{4}}})/4)\cdot (x-2)^{4}\cdots$
where $\ln(2)=0.693147180559945\dots$
* Figure 1: Graph of $I(x)$ representing $\ln(x)$ for $x$
* close to $2$.
* y = 0.693147180559945
* + ((1/(2^1))/1)(x - 2)^1
* - ((1/(2^2))/2)(x - 2)^2
* + ((1/(2^3))/3)(x - 2)^3
* - ((1/(2^4))/4)(x - 2)^4
* + ((1/(2^5))/5)(x - 2)^5
* - ((1/(2^6))/6)(x - 2)^6
* + ((1/(2^7))/7)(x - 2)^7
* - ((1/(2^42))/42)(x - 2)^42
* + ((1/(2^43))/43)(x - 2)^43
* - ((1/(2^44))/44)(x - 2)^44
* + ((1/(2^45))/45)(x - 2)^45
* - ((1/(2^46))/46)(x - 2)^46
* + ((1/(2^47))/47)(x - 2)^47
* - ((1/(2^48))/48)(x - 2)^48
* + ((1/(2^49))/49)(x - 2)^49
Generally, for $x$ close to $x_{0}:$
${\text{ln}}(x)={\text{ln}}(x_{0})+{\frac {1}{1}}\cdot {\frac {x-x_{0}}{x_{0}}}$ $-{\frac {1}{2}}\cdot {\frac {(x-x_{0})^{2}}{x_{0}^{2}}}$ $+{\frac {1}{3}}\cdot {\frac {(x-x_{0})^{3}}{x_{0}^{3}}}$ $-{\frac {1}{4}}\cdot {\frac {(x-x_{0})^{4}}{x_{0}^{4}}}$ $+{\frac {1}{5}}\cdot {\frac {(x-x_{0})^{5}}{x_{0}^{5}}}-\cdots$

#### Calculating ln(x)

This section presents a system for calculating $\ln(x)$ for $10\geq x\geq 1,$ knowing only that $\ln(1)=0.$
where L1 is a list containing values of $x_{0}$ in which each value after the first is $\leq 10$% more than the preceding value.
The performance of the above code is better than logarithmic to base $10$. This means, for example, if $x$ contains 60 significant decimal digits, the above code produces a result with fewer than 30 passes through the loop because each iteration of the lop performs two operations.
L1 is designed so that multiplier $={\frac {x\_minus\_x_{0}}{x_{0}}}$ is always $\leq {\frac {1}{10}}.$ When $x$ is very close to $x_{0},$ time to calculate $\ln(x)$ is greatly reduced.
* Figure 1: Graph of $I(x)$ representing $\ln(x)$ for $x$
* close to $7.9$.
* When value ${\frac {x-x_{0}}{x_{0}}}>1,$ the series diverges.
* In this case, when $x>15.8.$
* y = ln(7.9)
* + ((1/((7.9)^(1)))/(1))((x - 7.9)^(1))
* - ((1/((7.9)^(2)))/(2))((x - 7.9)^(2))
* + ((1/((7.9)^(3)))/(3))((x - 7.9)^(3))
* - ((1/((7.9)^(4)))/(4))((x - 7.9)^(4))
* + ((1/((7.9)^(5)))/(5))((x - 7.9)^(5))
* - ((1/((7.9)^(6)))/(6))((x - 7.9)^(6))
* + ((1/((7.9)^(7)))/(7))((x - 7.9)^(7))
* - ((1/((7.9)^(8)))/(8))((x - 7.9)^(8))
* + ((1/((7.9)^(9)))/(9))((x - 7.9)^(9))
* - ((1/((7.9)^(22)))/(22))((x - 7.9)^(22))
* + ((1/((7.9)^(23)))/(23))((x - 7.9)^(23))
* - ((1/((7.9)^(24)))/(24))((x - 7.9)^(24))
* + ((1/((7.9)^(25)))/(25))((x - 7.9)^(25))
* - ((1/((7.9)^(26)))/(26))((x - 7.9)^(26))
* + ((1/((7.9)^(27)))/(27))((x - 7.9)^(27))
* - ((1/((7.9)^(28)))/(28))((x - 7.9)^(28))
* + ((1/((7.9)^(29)))/(29))((x - 7.9)^(29))
The next piece of code progressively calculates $\ln(1.1),\ \ln(1.2),\ \ln(1.3)\ \dots$ and puts the calculated values in dictionary dict2.
* A quick check:
* ln(2.2) - (ln(1.1) + ln(2.0)) = 0E-50
* ln(2.4) - (ln(1.2) + ln(2.0)) = 0E-50
* ln(2.6) - (ln(1.3) + ln(2.0)) = 0E-50
* ln(2.8) - (ln(1.4) + ln(2.0)) = 0E-50
* ln(3.0) - (ln(1.5) + ln(2.0)) = -0E-50
* ln(3.3) - (ln(1.1) + ln(3.0)) = 0E-50
* ln(3.6) - (ln(1.2) + ln(3.0)) = 0E-50
* ln(3.6) - (ln(1.8) + ln(2.0)) = -0E-50
* ln(3.9) - (ln(1.3) + ln(3.0)) = 0E-50
* ln(4.2) - (ln(1.4) + ln(3.0)) = 0E-50
* ln(5.5) - (ln(1.1) + ln(5.0)) = 0E-50
* ln(6.0) - (ln(1.2) + ln(5.0)) = 0E-50
* ln(6.0) - (ln(2.0) + ln(3.0)) = 0E-50
* ln(6.6) - (ln(1.1) + ln(6.0)) = 0E-50
* ln(6.6) - (ln(2.2) + ln(3.0)) = 0E-50
* ln(6.6) - (ln(3.3) + ln(2.0)) = 0E-50
* ln(7.2) - (ln(1.2) + ln(6.0)) = 0E-50
* ln(7.2) - (ln(2.4) + ln(3.0)) = 0E-50
* ln(10.0) - (ln(5.0) + ln(2.0)) = 0E-50
Put the data from dict2 into 2 tuples Tx0, Tln_x0
Calculate the decision points.
Display the three tuples.
Previous code was used to produce three tuples. Operational code follows:
Values of $x_{0}:$
Tx0 = ( Decimal('1'), Decimal('1.1'), Decimal('1.2'), Decimal('1.3'), Decimal('1.4'), Decimal('1.5'), Decimal('1.6'), Decimal('1.7'), Decimal('1.8'), Decimal('1.9'), Decimal('2.0'), Decimal('2.2'), Decimal('2.4'), Decimal('2.6'), Decimal('2.8'), Decimal('3.0'), Decimal('3.3'), Decimal('3.6'), Decimal('3.9'), Decimal('4.2'), Decimal('4.6'), Decimal('5.0'), Decimal('5.5'), Decimal('6.0'), Decimal('6.6'), Decimal('7.2'), Decimal('7.9'), Decimal('8.6'), Decimal('9.3'), Decimal('10.0'), )
Values of $\ln(x_{0}):$
Tln_x0 = ( +Decimal('0'), +Decimal('0.095310179804324860043952123280765092220605365308644199'), +Decimal('0.18232155679395462621171802515451463319738933791448698'), +Decimal('0.26236426446749105203549598688095439720416645613143414'), +Decimal('0.33647223662121293050459341021699209011148337531334347'), +Decimal('0.40546510810816438197801311546434913657199042346249420'), +Decimal('0.47000362924573555365093703114834206470089904881224805'), +Decimal('0.53062825106217039623154316318876232798710152395697182'), +Decimal('0.58778666490211900818973114061886376976937976137698120'), +Decimal('0.64185388617239477599103597720348932963627777267035586'), +Decimal('0.69314718055994530941723212145817656807550013436025527'), +Decimal('0.78845736036427016946118424473894166029610549966889947'), +Decimal('0.87546873735389993562895014661269120127288947227474225'), +Decimal('0.95551144502743636145272810833913096527966659049168941'), +Decimal('1.0296194171811582399218255316751686581869835096735987'), +Decimal('1.0986122886681096913952452369225257046474905578227494'), +Decimal('1.1939224684724345514391973602032907968680959231313936'), +Decimal('1.2809338454620643176069632620770403378448798957372364'), +Decimal('1.3609765531356007434307412238034801018516570139541836'), +Decimal('1.4350845252893226218998386471395177947589739331360929'), +Decimal('1.5260563034950493162059934985840084789167789605719180'), +Decimal('1.6094379124341003746007593332261876395256013542685177'), +Decimal('1.7047480922384252346447114565069527317462067195771619'), +Decimal('1.7917594692280550008124773583807022727229906921830047'), +Decimal('1.8870696490323798608564294816614673649435960574916489'), +Decimal('1.9740810260220096270241953835352169059203800300974917'), +Decimal('2.0668627594729758101549540867970467145724397357938367'), +Decimal('2.1517622032594620488720831801196593960335348306130377'), +Decimal('2.2300144001592102533064181067805187074963279996745685'), +Decimal('2.3025850929940456840179914546843642076011014886287730'), )
Decision points:
Tdp = ( +Decimal('1.0476190476190476190476190476190476190476190476190476'), +Decimal('1.1478260869565217391304347826086956521739130434782609'), +Decimal('1.248'), +Decimal('1.3481481481481481481481481481481481481481481481481481'), +Decimal('1.4482758620689655172413793103448275862068965517241379'), +Decimal('1.5483870967741935483870967741935483870967741935483871'), +Decimal('1.6484848484848484848484848484848484848484848484848485'), +Decimal('1.7485714285714285714285714285714285714285714285714286'), +Decimal('1.8486486486486486486486486486486486486486486486486486'), +Decimal('1.9487179487179487179487179487179487179487179487179487'), +Decimal('2.0952380952380952380952380952380952380952380952380952'), +Decimal('2.2956521739130434782608695652173913043478260869565217'), +Decimal('2.496'), +Decimal('2.6962962962962962962962962962962962962962962962962963'), +Decimal('2.8965517241379310344827586206896551724137931034482759'), +Decimal('3.1428571428571428571428571428571428571428571428571429'), +Decimal('3.4434782608695652173913043478260869565217391304347826'), +Decimal('3.744'), +Decimal('4.0444444444444444444444444444444444444444444444444444'), +Decimal('4.3909090909090909090909090909090909090909090909090909'), +Decimal('4.7916666666666666666666666666666666666666666666666667'), +Decimal('5.2380952380952380952380952380952380952380952380952381'), +Decimal('5.7391304347826086956521739130434782608695652173913043'), +Decimal('6.2857142857142857142857142857142857142857142857142857'), +Decimal('6.8869565217391304347826086956521739130434782608695652'), +Decimal('7.5337748344370860927152317880794701986754966887417219'), +Decimal('8.2351515151515151515151515151515151515151515151515152'), +Decimal('8.9363128491620111731843575418994413407821229050279330'), +Decimal('9.6373056994818652849740932642487046632124352331606218'), )
At each decision point $x$ is assigned to the next low value or the next high value of $x_{0}.$ For example, if $x$ is between $1.2,\ 1.3,$ the decision point is $1.248.$ This means that the ratio ${\frac {1.248-1.2}{1.2}}={\frac {1.3-1.248}{1.3}}=0.04$ and the maximum value of abs$({\frac {x-x_{0}}{x_{0}}})=0.04.$
During creation of Tln_x0 the maximum value of ${\frac {x-x_{0}}{x_{0}}}={\frac {1}{10}}.$ During normal operations after creation of Tln_x0, maximum value of abs$({\frac {x-x_{0}}{x_{0}}})={\frac {1.047619\dots -1}{1}}$ between $1.0,\ 1.1.$
Choose a suitable value of x0 with the value of its natural log.
Ready to calculate, for example, $\ln(3.456789)$

#### Testing ln(x)

Choose random numbers $a,\ b$ so that $10\geq a\geq b\geq 1.$
Produce values $\ln(a),\ \ln(b).$
Calculate product $p=a\cdot b.$
Produce value $\ln(p).$
If $p>10,\ p=({\frac {p}{10}})\cdot 10$ and $\ln(p)=\ln({\frac {p}{10}})+\ln(10).$
Verify that $\ln(p)=\ln(a)+\ln(b).$
For example: During testing, successive invocations of the above code produced: