<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Homework 5
Chinmai Raman
3/18/2016
B.1 Interpolating a discrete function
Part 1
Step1:  Part 2
Step2:  Error in approximation at q = 2
Step3:  q = 4
Step4:  Error in approximation at q = 4
Step5:  q = 8
Step6:  Error in approximation at q = 8
Step7:  q= 16
Step8:  Error in approximation at q = 16
Step9:  B.2 Studying a function for different parameter values
$f(x) = sin\dfrac{1}{x+eps}$ in [0,1]
Step10:  How large n needs to be in order for the difference between the max of the function $f(x) = sin\dfrac{1}{x+eps}$ in [0,1] using n nodes and n+10 nodes to be less than 0.1
Step11:  n = 200 * eps (for an epsilon of 0.2). Increasing n further does not change the plot so that it is visible on the screen.
Step12:  B.6 Using the trapezoid method to approximate integrals
Step13:  The plot is symmetric over the y-axis. Therefore the integral of the function from -$\infty$ to $\infty$ will be the same as twice the integral of the function from 0 to $\infty$
Step14:  $$\int_{-L}^{L} {e}^{-x^2} dx = 2\int_{0}^{L} {e}^{-x^2} dx$$
Step15:  The error decreases as n increases and as L increases
B.8 Plotting functions and their derivatives
$$f'(x)={\dfrac{1}{x+\dfrac{1}{100}}}$$
Step16:  $$g'(x)-10{e}^{10x}sin({e}^{10x})$$
Step17:  $$h'(x)=(ln x)x^x+xx^{x-1}$$
<ASSISTANT_TASK:>
Python Code:
p1.f(-.45)
p1.S_k(-1, 1, -.45, 10)
Explanation: Homework 5
Chinmai Raman
3/18/2016
B.1 Interpolating a discrete function
Part 1:
End of explanation
p1.f(-.45)
p1.S_k(-1, 1, -.45, 2)
Explanation: Part 2:
Value of function f(x) = $e^(-x^2) * cos(2\pi x)$ at x = -0.45 :
q = 2
End of explanation
p1.error(-1, 1, -.45, 2)
Explanation: Error in approximation at q = 2:
End of explanation
p1.S_k(-1, 1, -.45, 4)
Explanation: q = 4
End of explanation
p1.error(-1, 1, -.45, 4)
Explanation: Error in approximation at q = 4:
End of explanation
p1.S_k(-1, 1, -.45, 8)
Explanation: q = 8
End of explanation
p1.error(-1, 1, -.45, 8)
Explanation: Error in approximation at q = 8:
End of explanation
p1.S_k(-1, 1, -.45, 16)
Explanation: q= 16
End of explanation
p1.error(-1, 1, -.45, 16)
Explanation: Error in approximation at q = 16:
End of explanation
p2.sin_graph(0.2, 10)
p2.multigraph(0.2, 10)
Explanation: B.2 Studying a function for different parameter values
$f(x) = sin\dfrac{1}{x+eps}$ in [0,1]
End of explanation
p2.choose_n(0.2)
p2.choose_n(0.1)
p2.choose_n(0.05)
Explanation: How large n needs to be in order for the difference between the max of the function $f(x) = sin\dfrac{1}{x+eps}$ in [0,1] using n nodes and n+10 nodes to be less than 0.1:
End of explanation
p2.multigraph(0.2, 40)
Explanation: n = 200 * eps (for an epsilon of 0.2). Increasing n further does not change the plot so that it is visible on the screen.
End of explanation
p3.graph()
Explanation: B.6 Using the trapezoid method to approximate integrals
End of explanation
p3.T(100, 10)
p3.trap(100, 10) * 2
Explanation: The plot is symmetric over the y-axis. Therefore the integral of the function from -$\infty$ to $\infty$ will be the same as twice the integral of the function from 0 to $\infty$
End of explanation
p3.table()
p3.error()
Explanation: $$\int_{-L}^{L} {e}^{-x^2} dx = 2\int_{0}^{L} {e}^{-x^2} dx$$
End of explanation
p4.graph(p4.diff(p4.f, 1/1000, 1, 100))
p4.multigraph(p4.diff(p4.f, 1/1000, 1, 100), p4.fprime)
Explanation: The error decreases as n increases and as L increases
B.8 Plotting functions and their derivatives
$$f'(x)={\dfrac{1}{x+\dfrac{1}{100}}}$$
End of explanation
p4.graph(p4.diff(p4.g, 1/1000, 1, 100))
p4.multigraph(p4.diff(p4.g, 1/1000, 1, 100), p4.gprime)
Explanation: $$g'(x)-10{e}^{10x}sin({e}^{10x})$$
End of explanation
p4.graph(p4.diff(p4.h, 1/1000, 1, 100))
p4.multigraph(p4.diff(p4.h, 1/1000, 1, 100), p4.hprime)
Explanation: $$h'(x)=(ln x)x^x+xx^{x-1}$$
End of explanation
<END_TASK>