### Archive

Posts Tagged ‘calculate’

## Maclaurin Series with example sin(x)

The Maclaurin series is a way of approximating a function f(x) using a power series of x. It only works on functions you can differentiate but you can gain any level of accuracy by stopping the series at different points. It is equal to the taylor series for a function about 0. One example of a use of the Maclaurin series is to calculate a value for sin(x).

The Maclaurin series for a function f(x) is as follows:

$f(x) = f(0) + xf'(0) + \frac{x^2 f''(x)}{2!} + \frac{x^3 f'''(x)}{3!} + ...$
or
$f(x) = \sum_{i=0}^{\infty} \frac{x^i f^i (0)}{i!}$

### Example sin(x)

An expression for sin(x) can be calculated using this method. Firstly we must decide what level of accuracy to go to, for the example we will go to the 3rdterm. The next step is to differentiate sinx. Firstly let f(x) = sinx

then

$f(0) = 0$

$f'(x) = cos(x) \quad \quad \quad \Rightarrow \quad \quad \quad f'(0) = 1$

$f''(x) = -sin(x) \quad \quad \quad \Rightarrow \quad \quad \quad f''(0) = 0$

$f'''(x) = -cos(x) \quad \quad \quad \Rightarrow \quad \quad \quad f'''(0) = -1$

$f''''(x) = sin(x) \quad \quad \quad \Rightarrow \quad \quad \quad f''''(0) = 0$

$f'''''(x) = cos(x) \quad \quad \quad \Rightarrow \quad \quad \quad f'''''(0) = 1$

We can now combine these into the series to get

$f(x) = sin(x) = x - \frac{x^3}{3!} + \frac{x^5}{5!} + ...$

$f(x) = sin(x) = x - \frac{x^3}{6} + \frac{x^5}{120} + ...$

which can be used to calculate the value of sin(x)  — though only for the radian measure of angle.

eg)
$sin(\frac{\pi}{3}) = \frac{\pi}{3} - \frac{\pi ^3}{6 \cdot 3^3} + \frac{\pi ^5}{120 \cdot 3^5} + ... \simeq$  0.8663

Which is approximately the value you would get if you type sin(pi/3) into a calculator.

Categories: algebra, calculus, trigonometry

The quadratic formula is a quick(unless you can factorise) way of solving quadratic equations. You basically take the coefficient’s of x, x2 and numbers, put then in the formula, work out the two answers and have your 2 solutions of x. And if that wasn’t easy enough written a console program in c++ that will solve them for you(and gives dodgy answers for complex solution ie) imaginary answers when there are no real roots.

ax2+bx+c=0

So what do you do, well enter a, b and c from the general equation into the formula, work out the answers and they are your solutions.

Whats the plus/minus thingy. You might be wondering what the thing is after the -b, well its a plus or minus sign. Because when you work out a square root it can have to answers, eg)root 9 = +3 and -3, he formula takes this into account by saying you must use the plus and the minus answers. This therefore means you will be 2 solutions to the quadratic, which makes sense as the graph is a curve and it therefore must cut the x-axis twice.

When the root part is negative(before you find the root) there are no real roots, only complex ones. This means that the curve comes down above the x-axis and doesn’t cut it. If you work out the complex roots, using i for root(-1), your pair of answers will be a conjugate pair.