{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Introduction to Lab 8 Taylor Series" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "-0.9999987317275388\n" ] } ], "source": [ "from math import factorial\n", "\n", "approx = 1\n", "x = 3.14\n", "for i in range(1,20):\n", " term = ((-1)**i) * ((x**(i*2)) / (factorial(i*2)))\n", " approx = approx + term\n", "print(approx)" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "-0.9999987317275395" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import math\n", "math.cos(3.14)" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " Volume in drive C is Windows\n", " Volume Serial Number is B899-AB94\n", "\n", " Directory of C:\\Users\\student\\Desktop\n", "\n", "11/20/2019 09:58 AM