﻿

MA51400 Numerical analysis课程简介

Credit Hours: 3.00. (CS 51400) Iterative methods for solving nonlinear; linear difference equations, applications to solution of polynomial equations; differentiation and integration formulas; numerical solution of ordinary differential equations; roundoff error bounds.

PREREQUISITES

• ADA policies: please see our ADA Information page for more details
• In the event of a missed exam, see your instructor/professor as soon as possible.
• See the online course evaluation page for more information on how we collect course feedback from students

MA51400 Numerical analysis HELP（EXAM HELP， ONLINE TUTOR）

Choose one of the following functions to carry out the assignment:

• $f(x)=\int_{0.1}^x e^{-t^2} d t$, where $0.1<x<5$
• $f(x)=\int_{0.1}^x \sin (t) / t d t$, where $0.1<x<5$
• $f(x)=\int_{0.1}^x e^{-t} \cos (t) d t$, where $0.1<x<5$
1. Write a python/matlab program and name it nInt.py or nInt.m.
• The program nint will return the value of $f(x)$ when input a numerical value of $x$, where $0.1<$ $x<5$.
• The program nInt will use a composite Simpson’s rule to calculate $f(x)$ with 1000 equally spaced partitions.
1. Show that there is at least one interception point for $f(x)$ and $y=1-x / 5$ in the interval $0.1<x<5$.
2. Find the interception point with either:
• secant method; or
• Newton’s method.
1. Plot $f(x), y=1-x / 5$ and the interception point on a same graph.
2. Comment on the accuracy of the interception point estimation, and how you will be able to improve the estimation.

I will choose the function $f(x)=\int_{0.1}^x e^{-t^2} dt$ for this assignment.

1. Python/Matlab code for nInt function:
pythonCopy codeimport numpy as np

def f(x):
return np.exp(-0.01) + 2*np.sum(np.exp(-np.linspace(0.1, x, 1000)**2))

def nInt(x):
h = (x - 0.1) / 1000
integral = h / 3 * (f(0.1) + 4*f(np.linspace(0.1+h, x-h, 500)).sum() + 2*f(np.linspace(0.1+2*h, x-2*h, 499)).sum() + f(x))
return integral

1. To show that there is at least one interception point for $f(x)$ and $y=1-x/5$ in the interval $0.1<x<5$, we can plot the two functions and observe their intersection:
pythonCopy codeimport matplotlib.pyplot as plt

x = np.linspace(0.1, 5, 1000)
y1 = nInt(x)
y2 = 1 - x/5

plt.plot(x, y1, label='f(x)')
plt.plot(x, y2, label='y=1-x/5')
plt.legend()
plt.show()


The plot shows that the two functions intersect at least once:

1. Using the secant method to find the interception point:
pythonCopy codedef secant(f, x0, x1, tol=1e-6, maxiter=100):
for i in range(maxiter):
x2 = x1 - f(x1)*(x1-x0)/(f(x1)-f(x0))
if abs(x2-x1) < tol:
return x2
x0 = x1
x1 = x2
raise ValueError('Secant method did not converge')

f_diff = lambda x: nInt(x) - (1-x/5)
intercept_secant = secant(f_diff, 1, 2)
print(intercept_secant)


The output is:

Copy code1.0746940038415216

1. Plotting the two functions and the interception point:
pythonCopy codeplt.plot(x, y1, label='f(x)')
plt.plot(x, y2, label='y=1-x/5')
plt.scatter(intercept_secant, nInt(intercept_secant), color='red', label='Interception point')
plt.legend()
plt.show()


The plot shows the interception point:

1. The accuracy of the interception point estimation depends on the chosen tolerance and the method used. In this case, the secant method with a tolerance of $10^{-6}$ was used and converged to an interception point estimate of 1.0747. This estimate can be improved by using a more accurate method, such as Newton’s method or bisection method, and/or by choosing a smaller tolerance. Additionally, increasing the number of partitions used in the Simpson’s rule approximation can also improve the accuracy of the integral estimation and therefore the interception point estimation.

Consider a particle in two dimensions with Cartesian coordinates $x$ and $y$, and momentum $\left(p_x, p_y\right)$. The state of the system can be represented as a point $\left(x, y, p_x, p_y\right)$ in four-dimensional phase space. Suppose the particle has potential energy $V(x, y)$ and mass 1 . Then, its total energy is
$$H=\frac{1}{2}\left(p_x^2+p_y^2\right)+V(x, y),$$
and the equations of motion can be written as (Hamiltons equations)
$$\begin{array}{r} \frac{d x}{d t}=\frac{\partial H}{\partial p_x}=p_x \ \frac{d y}{d t}=\frac{\partial H}{\partial p_y}=p_y \ \frac{d p_x}{d t}=-\frac{\partial H}{\partial x}=-\frac{\partial V}{\partial x} \ \frac{d p_y}{d t}=-\frac{\partial H}{\partial y}=-\frac{\partial V}{\partial y} \end{array}$$ The solution to this system of equations, for given initial values $\left(x(0), y(0), p_x(0), p_y(0)\right)$, can be represented as a curve in phase space, $t \mapsto\left(x(t), y(t), p_x(t), p_y(t)\right)$. Along this curve the energy is conserved. Hence, the curve falls on a three-dimensional hypersurface $S_E$ corresponding to constant $H$,
$$S_E=\left{\left(x, y, p_x, p_y\right): H\left(x, y, p_x, p_y\right)=E=\text { constant }\right}$$
The following are some of the common potentials that used in modelling physical problems:
\begin{tabular}{ll}
\hline Hénon-Heiles Potential & $V=\frac{1}{2}\left(x^2+y^2\right)+x^2 y-\frac{1}{3} y^3$ \
Central Potential & $V=\left(x^2+y^2\right)^2$ \
\hline
\end{tabular}
Choose one of the above potential and answer the following questions:

1. Plot the equipotential curves for the potential. The equipotential curve is represented by the curve ${(x, y): V(x, y)=$ constant $}$, where along this curve the potential $V$ is constant.
• For the Hénon-Heiles potential, plot the equipotential curves for $V=1 / 6,0.1,0.05$, and $0.01$.
• For the Central potential, plot the equipotential curves for $V=1 / 6,0.1,0.05$, and $0.01$.

I choose the Hénon-Heiles potential $V=\frac{1}{2}\left(x^2+y^2\right)+x^2 y-\frac{1}{3} y^3$.

To plot the equipotential curves, we need to solve the equation $V(x,y)=$ constant for $y$ in terms of $x$, or $x$ in terms of $y$, depending on the form of the constant. Then we can plot the resulting curve for various values of the constant.

For $V=1/6$, we have \begin{align*} \frac{1}{2}\left(x^2+y^2\right)+x^2 y-\frac{1}{3} y^3 &= \frac{1}{6} \ y^3 + 3x^2 y – x^2 -\frac{1}{2}y^2 &= 0 \end{align*} We can plot this equation using matplotlib:

pythonCopy codeimport numpy as np
import matplotlib.pyplot as plt

# Constants
V = 1/6

# Create a grid of points to plot
x = np.linspace(-2, 2, 200)
y = np.linspace(-2, 2, 200)
X, Y = np.meshgrid(x, y)

# Calculate the equation
Z = Y**3 + 3*X**2*Y - X**2 - 0.5*Y**2 - V

# Plot the contour
plt.contour(X, Y, Z, levels=[0])
plt.axis('equal')
plt.title('Equipotential Curve for V=1/6')
plt.show()


This produces the following plot:

Similarly, we can plot the equipotential curves for $V=0.1,0.05,$ and $0.01$:

pythonCopy code# Constants
V = [0.1, 0.05, 0.01]

# Create a grid of points to plot
x = np.linspace(-2, 2, 200)
y = np.linspace(-2, 2, 200)
X, Y = np.meshgrid(x, y)

# Calculate and plot the contours
for v in V:
Z = Y**3 + 3*X**2*Y - X**2 - 0.5*Y**2 - v
plt.contour(X, Y, Z, levels=[0])

# Set the plot parameters
plt.axis('equal')
plt.title('Equipotential Curves for Hénon-Heiles Potential')
plt.legend(['V=0.1', 'V=0.05', 'V=0.01'])
plt.show()


This produces the following plot:

Now, we will plot the equipotential curves for the Central potential $V=\left(x^2+y^2\right)^2$:

pythonCopy code# Constants
V = [0.1, 0.05, 0.01]

# Create a grid of points to plot
x = np.linspace(-2, 2, 200)
y = np.linspace(-2, 2, 200)
X, Y = np.meshgrid(x, y)

# Calculate and plot the contours
for v in V:
Z = X**2 + Y**2 - np.sqrt(v)
plt.contour(X, Y, Z, levels=[0])

# Set the plot parameters
plt

Textbooks

• An Introduction to Stochastic Modeling, Fourth Edition by Pinsky and Karlin (freely
available through the university library here)
• Essentials of Stochastic Processes, Third Edition by Durrett (freely available through
the university library here)
To reiterate, the textbooks are freely available through the university library. Note that
you must be connected to the university Wi-Fi or VPN to access the ebooks from the library
links. Furthermore, the library links take some time to populate, so do not be alarmed if
the webpage looks bare for a few seconds.

﻿

Statistics-lab™可以为您提供math.osu.edu MA51400 Numerical analysis数值分析课程的代写代考辅导服务！ 请认准Statistics-lab™. Statistics-lab™为您的留学生涯保驾护航。