Jump to content

User:Egm6322.s14.team2/report3: Difference between revisions

From Wikiversity
Content deleted Content added
Line 205: Line 205:
{{NumBlk|::|<math>\mathbf{a}=(\ddot{r}-r\dot{{\theta}}^{2})\mathbf{e_{r}}+\frac{1}{r}\frac{d}{dt}(r^{2}\dot{{\theta}})\mathbf{e_{{\theta}}}</math> |{{EquationRef|Eq 2-10}}|}}
{{NumBlk|::|<math>\mathbf{a}=(\ddot{r}-r\dot{{\theta}}^{2})\mathbf{e_{r}}+\frac{1}{r}\frac{d}{dt}(r^{2}\dot{{\theta}})\mathbf{e_{{\theta}}}</math> |{{EquationRef|Eq 2-10}}|}}


==R3.4: Solutions to First Oder Linear ODE with Variable Coefficients using Euler Integrating Factor==
==R3.4:==


===Problem Statement===
===Problem Statement===
Line 275: Line 275:
{{NumBlk|::|<math>2+\frac{k_2}{\sqrt{x^2+1}}</math>|{{EquationRef|Eq 3-11}}|}}
{{NumBlk|::|<math>2+\frac{k_2}{\sqrt{x^2+1}}</math>|{{EquationRef|Eq 3-11}}|}}


==R3.5:==
==R3.5: Commented problems from R2==


===Problem Statement===
===Problem Statement===
Line 445: Line 445:
This code did not test a Bessel integral of the form given in problem R2.7.
This code did not test a Bessel integral of the form given in problem R2.7.


==R3.6: Testing Gauss-Laguerre Quadrature Part 2==
==R3.6:==


===Problem Statement===
===Problem Statement===
Line 567: Line 567:


In both Figure 6.1 and Figure 6.2, the quadrature converge quickly to the correct value for larger values of <math>\epsilon</math>, but fail to converge to the correct answer for smaller <math>\epsilon</math>
In both Figure 6.1 and Figure 6.2, the quadrature converge quickly to the correct value for larger values of <math>\epsilon</math>, but fail to converge to the correct answer for smaller <math>\epsilon</math>

=Contributing Team Members=

* [[User:csstewart10|Cameron Stewart]] Solved problem 6, part b of problem 4, and the part of problem 5 pertaining to R2.7. Reviewed problem 3.
* [[User:Bartlete2|Elizabeth Bartlett]]
* [[User:kev1109|Kevin Frost]]
* [[User:Egm6322.s14.team2.chris|Christopher Neal]]
<br /><br /><br />

{| class="prettytable" style="margin: 1em auto 1em auto;"
| colspan="3" | <center>'''Problem Assignments'''</center>

|-
| Problem #
| Solved by
| Reviewed by

|-
|1
| Bartlett, Elizabeth
|

|-
|2
| Bartlett, Elizabeth; Neal, Christopher
|

|-
|3
| Bartlett, Elizabeth
| Stewart, Cameron

|-
|4
| Frost, Kevin; Stewart, Cameron
|

|-
|5
| Bartlett, Elizabeth; Stewart, Cameron
|

|-
|6
| Stewart, Cameron
|


|}

=References=
{{Reflist}}

Revision as of 15:59, 21 February 2014

Report 3 PEA 2 Spring 2014 Team 2

Problems are given in lecture notes


R3.1:

Problem Statement

sec.67a, Pb-67.1 (equilibrium of line defects, Legendre diff. eq., Legendre polynomials)

Provide a detailed justification for the following relations:

 

 

 

 

(Eq 1-1)

and thus,

 

 

 

 

(Eq 1-1)


 

 

 

 

(Eq 1-2)

satisfies the differential equation,

 

 

 

 

(Eq 1-3)


 

 

 

 

(Eq 1-4)

Find

(a): (b):

Solution

On our honor, we did this assignment on our own, without looking at the solutions in previous semesters or other online solutions.

Given at equilibrium,

 

 

 

 

(Eq 1-5)

(Eq 1-5) is the definition of S(u), a summation of N terms.

 

 

 

 

(Eq 1-6)

Substituting (Eq 1-5)for the N-1 terms (excluding j=i) in (Eq 1-6) and evaluating the behavior of the function as u approaches ui results in (Eq 1-7).

 

 

 

 

(Eq 1-7)

P(u) is defined in equation (Eq 1-8) and the derivative is displayed in (Eq 1-9).

 

 

 

 

(Eq 1-8)

 

 

 

 

(Eq 1-9)

Substituting (Eq 1-8) and (Eq 1-9) into (Eq 1-6), (Eq 1-10) was established.

 

 

 

 

(Eq 1-10)

Using the chain rule the following equation can be defined using (Eq 1-10).

 

 

 

 

(Eq 1-11)

(Eq 1-12) is the derivative of S as .

 

 

 

 

(Eq 1-12)

Substituting (Eq 1-8) and (Eq 1-9) into (Eq 1-12), multiplying the last term by (u-ui)/(u-ui), and evaluating the behavior of the system as yields P(u)/P'(u) approaches 0 as .

 

 

 

 

(Eq 1-13)

Evaluating the product in (Eq 1-8), a power series with constant coefficients that are products of the ui positions can be expressed as follows:

 

 

 

 

(Eq 1-14)

And the first and second derivatives can also be expressed as a power series as follows:

 

 

 

 

(Eq 1-15)

 

 

 

 

(Eq 1-16)

Given that P(u) is proportional to ,

 

 

 

 

(Eq 1-17)

Substituting the power series expressions of the solutions into the above equation:

 

 

 

 

(Eq 1-18)

Considering just the final term in the summation:

 

 

 

 

(Eq 1-19)

The above equation simplifies to c=N(N-1). Substituting the coefficient, c, back into (Eq 1-17)

 

 

 

 

(Eq 1-20)

Now, using the transformation for P as a function of Q, and the first and second derivatives:

 

 

 

 

(Eq 1-21)

 

 

 

 

(Eq 1-22)

 

 

 

 

(Eq 1-23)

Substituting the transformation into the differential equation in (Eq 1-20)

 

 

 

 

(Eq 1-24)

R3.2: Hermite Differential Equation Form of Line Defect Differential Equation

Problem Statement

sec.67b, Pb-67.2 (equilibrium of line defects, Hermite diff. eq., Hermite polynomials)

Equation (Eq 2-1) is given:

 

 

 

 

(Eq 2-1)

Find a suitable change of variable to show that (Eq 2-1) ((6) p.68-5) can be written as the Hermite differential equation of the form:

 

 

 

 

(Eq 2-2)

For the 2 cases of particles, find the non-dimensional equilibrium positions and plot them.

Find

(a): A suitable change of variable to show that (Eq 2-1) can be written as the Hermite differential equation of the form of (Eq 2-2)

Solution

On our honor, we did this assignment on our own, without looking at the solutions in previous semesters or other online solutions.

Part (a): Find Suitable Change of Variable

For this problem we seek to determine a suitable change of variables that will give us (Eq 2-2) from (Eq 2-1). The variable of interest is changing from u to x in this problem. We need to find some sort of relation between the two variables that will gives us what we want. We can observe the differences between the two forms of the differential equations and conclude that a factor of 2 on the zeroth and first derivative terms is the only difference.

Plot Solution for 2 Cases

Here we are asked to plot the solution to the Hermite differential equation for the cases when .

Case for

Here the Hermite differential equation takes the following form.

 

 

 

 

(Eq 2-2)


Case for

Here the Hermite differential equation takes the following form.

 

 

 

 

(Eq 2-2)

R3.3:

Problem Statement

sec.70a, Pb-70.1 (Kepler’s equation, acceleration vector in planar motion using Euler formula)

Show,

 

 

 

 

(Eq 2-1)

Find

(a): (b):

Solution

On our honor, we did this assignment on our own, without looking at the solutions in previous semesters or other online solutions.

Using polar coordinates, the unit vectors that form a basis in the orbital plane and their first order time derivatives are:

 

 

 

 

(Eq 2-2)

 

 

 

 

(Eq 2-3)

 

 

 

 

(Eq 2-4)

 

 

 

 

(Eq 2-5)

The position vector, r, in this basis is:

 

 

 

 

(Eq 2-6)

The time derivative of the position vector is the velocity:

 

 

 

 

(Eq 2-7)

The second derivative with respect to time is the acceleration:

 

 

 

 

(Eq 2-8)

After combining like terms and factoring a out of the term, the equation above simplifies to:

 

 

 

 

(Eq 2-9)

Recognizing the derivative of and performing the integration, Kepler's equation takes the form:

 

 

 

 

(Eq 2-10)

R3.4: Solutions to First Oder Linear ODE with Variable Coefficients using Euler Integrating Factor

Problem Statement

A general First Order Linear Differential Equation with Varying Coefficients (L1-ODE-VC) has the following form:

 

 

 

 

(Eq 3-1)

Find

(a)

 

 

 

 

(Eq 3-2)


(b)

 

 

 

 

(Eq 3-3)

Solution

On our honor, we did this assignment on our own, without looking at the solutions in previous semesters or other online solutions.

Part a

The equation in 1 can be written as follows:

 

 

 

 

(Eq 3-1)

The general solution for the Euler Integrating Factor Method is:

 

 

 

 

(Eq 3-2)

And is:

 

 

 

 

(Eq 3-3)

( is arbitrary, it scales the integrating factor by a constant but has no effect on the final solution. Here we set it to 0 for ease of computation.)

Plugging into and integrating gives:

 

 

 

 

(Eq 3-4)

Plugging into the general solution we get:

 

 

 

 

(Eq 3-5)

Integrating this gives the solution:

 

 

 

 

(Eq 3-6)


Part b

The equation 2 can be rewritten as:

 

 

 

 

(Eq 3-7)

(Eq 3-7) is divided by in order to have the coefficient of the leading derivative be unity.

 

 

 

 

(Eq 3-8)

is then found by the following equation:

 

 

 

 

(Eq 3-9)

(Eq 3-2) then becomes:

 

 

 

 

(Eq 3-10)

Which after evaluating the integral can be simplified to:

 

 

 

 

(Eq 3-11)

R3.5: Commented problems from R2

Problem Statement

Redo commented problems from Report 2.

R2.4:Differential Element in Spherical Coordinates

Given Information

The following equation is given for ds2:

 

 

 

 

(Eq 4-1)

xi is written in spherical coordinates in (Eq 4-2) through (Eq 4-4).

 

 

 

 

(Eq 4-2)

 

 

 

 

(Eq 4-3)

 

 

 

 

(Eq 4-4)

Problem Statement

Show that the infinitesimal length ds2 in (Eq 4-1) can be written in spherical coordinates, (Eq 4-5), as given in Pb.R*7.3 on pp.39-[1,3] of sec.39 of the notes.

 

 

 

 

(Eq 4-5)

Solution

On our honor, we did this assignment on our own, without looking at the solutions in previous semesters or other online solutions.

The derivatives of xi are given in (Eq 4-6) through (Eq 4-8).

 

 

 

 

(Eq 4-6)

 

 

 

 

(Eq 4-7)

 

 

 

 

(Eq 4-8)

(Eq 4-9) was developed by substituting the squared derivatives in the summation of (Eq 4-1) and combining like terms.

 

 

 

 

(Eq 4-9)

Using the Pythagorean Trigonometric Identity, (Eq 4-9) reduces to (Eq 4-10).

 

 

 

 

(Eq 4-10)

The magnitude of the tangent vector h are then identified as follows:

 

 

 

 

(Eq 4-11)

 

 

 

 

(Eq 4-12)

 

 

 

 

(Eq 4-13)

The definition of the Laplace operator, , in cartesian coordinates:

 

 

 

 

(Eq 4-14)

The Laplace operator can be expressed in spherical coordinates from equation (2) from the class notes 39-2,

 

 

 

 

(Eq 4-15)

After substituting the values of h from (Eq 4-11) through (Eq 4-13), the Laplacian takes the form:

 

 

 

 

(Eq 4-16)

Factoring the from the first term, the partial derivative with respect to r, and the from the third term, the partial derivative with respect to , since both values are fixed in the partial derivatives, the Laplacian takes the form:

 

 

 

 

(Eq 4-17)

R2.5: Using Variation of Parameters To Find Second Solution To The Legendre Differential Equation

Given Information

The following equation is given for P2(x), the Legendre Polynomial of degree n=2:

 

 

 

 

(Eq 5-1)

Problem Statement

Using variation of parameters, show that Equation 5-2 is a second solution to the Legendre differential equation in Equation 5-3 as given in Pb.R*6.11 on pp.37-4 in sec.37 of the notes.

 

 

 

 

(Eq 5-2)

Solution

On our honor, we did this assignment on our own, without looking at the solutions in previous semesters or other online solutions.

The Legendre differential equation of degree n=2 is given in equation 5-3.

 

 

 

 

(Eq 5-3)

Using reduction of order, some function, v, times P2(x) and the first two derivatives of the product are substituted into the Legendre differential equation in equation 5-7. Furthermore, since P2(x) is a solution to the Legendre equation the coefficient of the first order term, v, reduces to zero. Since the lowest order term cancels out, the second order differential equation is reduced to a first order differential equation where w=v' and w'=v in Equation 5-8 which can be solved through separation of variables.

 

 

 

 

(Eq 5-4)

 

 

 

 

(Eq 5-5)

 

 

 

 

(Eq 5-6)

 

 

 

 

(Eq 5-7)

 

 

 

 

(Eq 5-7)

Through partial fraction decomposition, the integral is

 

 

 

 

(Eq 5-8)

Through integration

 

 

 

 

(Eq 5-9)

Using properties of the natural logarithm and then inverting it using the exponential function, equation 5-9 becomes

 

 

 

 

(Eq 5-10)

Substituting v' back into Equation 5-10 and again using partial fraction decomposition

 

 

 

 

(Eq 5-11)

Using integration by parts

 

 

 

 

(Eq 5-12)

where u and v are defined as follows:

 

 

 

 

(Eq 5-13)

 

 

 

 

(Eq 5-14)

 

 

 

 

(Eq 5-15)

Using the properties of the natural logarithm to combine the first two terms and performing the simple integration on the last term:

 

 

 

 

(Eq 5-16)

Substituting v into Equation 5-4 then identifying the new solution as Q2

 

 

 

 

(Eq 5-17)

R2.6: Testing Gauss Laguerre quadrature

The Bessel function integration test performed by Dr. Burkardt's code [1] test the following integral:


and has the following raw output:

        7                  0.162669
                1         0.19313       0.0304616
                2       0.0346675        0.128001
                4       0.0367188         0.12595
                8       0.0395037        0.123165
               16       0.0970831       0.0655858
               32        0.100708       0.0619605
               64        0.107105       0.0555637

The top row cow is the problem number, and the exact solution. The first column of numbers is the number of integration points, the second column is the approximated answer, and the third column is the absolute error.

This code did not test a Bessel integral of the form given in problem R2.7.

R3.6: Testing Gauss-Laguerre Quadrature Part 2

Problem Statement

Test the following integrals using Gauss-Laguerre quadrature.

 

 

 

 

(Eq 6-1)


 

 

 

 

(Eq 6-2)

Where

Find

Plot the convergence of the integrals in:

(a) (Eq 6-1)

(b) (Eq 6-2)

as the number of integration points are increased.

Solution

On our honor, we did this assignment on our own, without looking at the solutions in previous semesters or other online solutions.

Neither integral given converges, nor has a principle value for . However, the exercise is carried out for a variety of decreasing values of ranging from to


The Gauss-Laguerre quadrature rule was given in Equation 7.7 Report2

 

 

 

 

(Eq 7-7)

Plots were generated using the following numpy script.


Source:

################################################################################
# Name: gausslagtestEi.py
# Author: Cameron Stewart
# Date: 2/18/2014
#################################################################################
import numpy as np
import matplotlib.pyplot as plt
from scipy.special import expi

# Test functions 1 and 2 are the functions tested by the G-L quad
def TestFunction1(x):
    y=1./x
    return y

def TestFunction2(x):
    y=1./(x**2)
    return y

#################################################################################
# Uses the numpy Laguerre Gauss quadrature routine:
# numpy.polynomial.laguerre.laggauss(deg)  to find roots and weight points.
# Output is tuple of 1d arrays for the weights and integration points.  
# Note: Not tested for deg>100
#################################################################################

weight=(np.polynomial.laguerre.laggauss(4))

# Array for the lower integral bound
a=np.array([1.0,0.1,0.01,0.001,0.0001,0.00001,0.000001])

#################################################################################
# Plot to show the convergence with increasing integration points
#################################################################################
# Function1
exact=-expi(-a)
for j in range(0,len(a)):
    t=np.linspace(2,100,99)
    error=[]
    for i in range(2, 101):
        weight=(np.polynomial.laguerre.laggauss(i))
        func=TestFunction1(weight[0]+a[j])
        integ=weight[1]*func
        integ=np.exp(-a[j])*np.sum(integ)
        error.append((np.abs(integ-exact[j]))/exact[j]*100.)
    plt.plot(t,error,label=r'$\epsilon$ = '+ str(a[j]))
    plt.title(r'Convergence test for Gauss-Laguerre quadrature: $f(x)=\frac{1}{x}$')
    plt.xlabel(r'Integration points: $n$')
    plt.ylabel(r'Error %')
    plt.legend(loc=1)
    plt.ylim(-5,100)
    plt.xlim(2,100)
#plt.show()
plt.clf()

# Function2
exact=expi(-a)+1./(np.exp(a)*a)
for j in range(0,len(a)):
    t=np.linspace(2,100,99)
    error=[]
    for i in range(2, 101):
        weight=(np.polynomial.laguerre.laggauss(i))
        func=TestFunction2(weight[0]+a[j])
        integ=weight[1]*func
        integ=np.exp(-a[j])*np.sum(integ)
        error.append((np.abs(integ-exact[j]))/exact[j]*100.)
    plt.plot(t,error,label=r'$\epsilon$ = '+ str(a[j]))
    plt.title(r'Convergence test for Gauss-Laguerre quadrature: $f(x)=\frac{1}{x^2}$')
    plt.xlabel(r'Integration points: $n$')
    plt.ylabel(r'Error %')
    plt.legend(loc=5)
    plt.ylim(-5,110)
    plt.xlim(2,100)
plt.show()

Part a

Figure 6.1: Percent error of ( 6-1) with increasing integration points for varying values of

Part b

Figure 6.2: Percent error of ( 6-2) with increasing integration points for varying values of

In both Figure 6.1 and Figure 6.2, the quadrature converge quickly to the correct value for larger values of , but fail to converge to the correct answer for smaller

Contributing Team Members




Problem Assignments
Problem # Solved by Reviewed by
1 Bartlett, Elizabeth
2 Bartlett, Elizabeth; Neal, Christopher
3 Bartlett, Elizabeth Stewart, Cameron
4 Frost, Kevin; Stewart, Cameron
5 Bartlett, Elizabeth; Stewart, Cameron
6 Stewart, Cameron


References