User:Egm6321.f09.Team6/HW3

 Please place edit links for each problem so that I can leave feedback without scrolling through an entire assignment worth of code. --Egm6321.f09.TA 04:28, 15 October 2009 (UTC)  In Problem #1: You have errors in two of your partials which is why you were not able to make your ODE exact. --Egm6321.f09.TA 04:28, 15 October 2009 (UTC)

Problems 1-3:


Problem 2: Your integrating factor is correct. The evaluated integral from wolfram is ok - you could have left the solution in terms of the integral. Egm6321.f09.TA 01:31, 28 October 2009 (UTC)

Problem 3: Your expressions are not functions of the arguments you claim. Egm6321.f09.TA 02:09, 28 October 2009 (UTC)

Problem 4:
Statement: 

For the case N1-ODE $$F(x,y,y')=0=\frac{d\Phi}{dx}(x,y)$$ show that

$$f_0-\frac{df_1}{dx}=0\Leftrightarrow\Phi{xy}=\Phi{yx}$$

Specifically, find $$f_0$$ and $$f_1$$ in terms of $$\Phi$$.

Solution: 

We know the first condition for exactness is $$F=\frac{d\Phi}{dx}(x,y)=\Phi_x+\Phi_yy'$$

We also know the second condition for exactness is $$f_i=\frac{\delta F}{\delta y^{(i)}}$$   for i=1,2,...,n

 Why the use of $$\delta$$ notation for partials? --Egm6321.f09.TA 14:35, 15 October 2009 (UTC) Thus, $$f_o=\frac{\delta F}{\delta y}$$ $$=\frac{\delta}{\delta y}(\Phi_x+\Phi_yy')$$ $$=\Phi_{xy}$$

 $$f_0=\phi_{xy}+\phi_{yy}y'$$. You are missing terms.--Egm6321.f09.TA 14:35, 15 October 2009 (UTC) and $$f_1=\frac{\delta F}{\delta y'}$$ $$=\frac{\delta}{\delta y'}(\Phi_x+\Phi_yy')$$ $$=\Phi_y$$

Therefore, $$\Phi_{xy}-\frac{d}{dx}\Phi_y=0$$ $$\Phi_{xy}-\Phi_{yx}=0$$ $$\Phi_{xy}=\Phi_{yx}$$  $$\frac{d}{dx}\phi_y=\phi_{xy}+\phi_{yy}y'$$. --Egm6321.f09.TA 14:35, 15 October 2009 (UTC)

Problem 5:
Statement: 

For the case N2-ODE, show: $$\frac{d}{dx}(\Phi_y)=f_0$$

$$f_1=\frac{df_2}{dx}+\Phi_y$$

$$f_0-\frac{df_1}{dx}+\frac{d^2f_2}{dx^2}=0$$

Relate this last equation to the following: $$f_{xx}+2pf_{xy}+p^2f_{yy}=g_{xp}+pg_{yp}-g_y$$

$$f_{xp}+pf_{yp}+2f_y=g_{pp}$$

Solution: 

We know the first condition for exactness is $$F=\frac{d\Phi}{dx}(x,y,y')=\Phi_x+\Phi_yy'+\Phi_{y'}y^{''}$$

We also know the second condition for exactness is $$f_i=\frac{\delta F}{\delta y^{(i)}}$$   for i=1,2,...,n

Thus, we can show: $$f_o=\frac{\delta F}{\delta y}=\frac{\delta}{\delta y}(\Phi_x+\Phi_yy'+\Phi_{y'}y^{''})$$

$$=\Phi_{xy}$$

$$=\Phi_{yx}$$

$$=\frac{d}{dx}(\Phi_y)$$

 This is not true. $$f_0=\frac{\partial F}{\partial y}=\frac{\partial}{\partial y}(\phi_x+\phi_yp+\phi_pp')=\phi_{xy}+\phi_{yy}p+\phi_{py}p'$$.

Furthermore, we can show: $$f_0-\frac{df_1}{dx}+\frac{d^2f_2}{dx^2}=0$$

$$\frac{df_1}{dx}=f_0+\frac{d^2f_2}{dx^2}$$

$$\int{\frac{df_1}{dx}dx}=\int{f_0dx}+\int{\frac{d^2f_2}{dx^2}dx}$$

$$f_1=\int{\frac{d}{dx}\Phi_ydx}+\int{\frac{d^2f_2}{dx^2}dx}$$

$$f_1=\Phi_y+\frac{df_2}{dx}$$

By substituting the found values above into $$f_0-\frac{df_1}{dx}+\frac{d^2f_2}{dx^2}=0$$

we get: $$\frac{d}{dx}\Phi_y-\frac{d}{dx}(\Phi_y+\frac{df_2}{dx})+\frac{d^2f_2}{dx^2}=0$$

$$\frac{d}{dx}\Phi_y-\frac{d}{dx}\Phi_y-\frac{d^2f_2}{dx^2}+\frac{d^2f_2}{dx^2}=0$$

$$0=0$$  You need to perform the partial differentiations as above to calculate $$f_0,f_1,f_2$$ and using the appropriate total derivatives, explicitly show that the relations hold. --Egm6321.f09.TA 01:56, 16 October 2009 (UTC)

Problem 6:
Statement: 

For the following Legendre differential equation

$$F=(1-x^2)y^{''}-2xy'+n(n+1)y=0$$

verify exactness using two methods. Method 1: $$f_{xx}+2pf_{xy}+p^2f_{yy}=g_{xp}+pg_{yp}-g_y$$

$$f_{xp}+pf_{yp}+2f_y=g_{pp}$$

Method 2:

$$f_0-\frac{df_1}{dx}+\frac{d^2f_2}{dx^2}=0$$

If it is not exact, see whether it can be made exact using the integrating factor with $$h(x,y)=x^my^n$$

Solution: 

We know $$f=(1-x^2)$$ and $$g=-2xy'+n(n+1)y$$

Thus: $$f_x=-2x$$ → $$f_{xx}=-2$$ → $$f_{xy}=0$$ → $$f_{xy'}=0$$ $$f_y=0$$ → $$f_{yy}=0$$ → $$f_{yy'}=0$$ $$g_x=-2y'$$ → $$g_{xy'}=-2$$ $$g_y=n(n+1)$$ → $$g_{yy'}=0$$ $$g_{y'}=-2x$$ → $$g_{y'y'}=0$$

Plugging the above into method 1 equations, we get: $$f_{xx}+2pf_{xy}+p^2f_{yy}=g_{xp}+pg_{yp}-g_y$$ $$-2+2p(0)+p^2(0)=-2+p(0)-n(n+1)$$ $$-2=-2-n(n+1)$$ NOT TRUE!

$$f_{xp}+pf_{yp}+2f_y=g_{pp}$$ $$0+p(0)+2(0)=0$$ $$0=0$$ TRUE!

Method 1 has only one equation satisfied; therefore, the method as a whole is not satisfied and exactness cannot be shown.

Next, we use method 2. We know:

$$f_0=\frac{\delta F}{\delta y}=n(n+1)$$

$$f_1=\frac{\delta F}{\delta y'}=-2x$$ → $$\frac{df_1}{dx}=-2$$

$$f_2=\frac{\delta F}{\delta y''}=(1-x^2)$$ → $$\frac{df_2}{dx}=-2x$$ → $$\frac{d^2f_2}{dx^2}=-2$$

Thus: $$n(n+1)-(-2)-2=0$$ $$n(n+1)=0$$ NOT TRUE!

As the above equation is not true, method 2 cannot show exactness. We will need to use the integrating factor to show exactness. So, we must find $$x^my^n$$ such that:

$$F=x^my^n[(1-x^2)y''-2xy'+n(n+1)y]=0$$

For simplification, let's assume $$p=y'$$, and $$p'=y''$$. We know:

$$\Phi=h(x,y)+\int{f(x,y,p)dp}$$ $$=h(x,y)+\int{(1-x^2)dp}$$ $$=h(x,y)+(1-x^2)p$$ $$=h(x,y)+p-x^2p$$

and:

$$g=\Phi_x+\Phi_yp$$

Therefore:

$$2xp+n(n+1)y=(h_x-2xp)+(h_y+0)p$$ $$2xp+n(n+1)y=h_x-2xp+h_yp$$ $$4xp+n(n+1)y=h_x+h_yp$$

So: $$4xp=h_yp$$ $$4x=h_y$$ which leads to: $$h=4xy+k_x$$

Also: $$n(n+1)y=h_x$$ which leads to: $$h=n(n+1)xy+k_y$$

Therefore: $$4xy=n(n+1)xy$$ $$4=n(n+1)$$ $$4=n^2+n$$ $$n=1.56$$ or $$n=-2.56$$

That means $$h(x,y)=x^my^n$$ has two solutions for exactness: $$h(x,y)=1.56xy$$ or $$h(x,y)=-2.56xy$$

Problem 7:
Statement: 

Show that: $$\forall u,v$$ functions of $$x$$, $$L(u+v)=L(u)+L(v)$$ and $$\forall \lambda\in\mathbb{R},L(\lambda u)=\lambda L(u)\forall$$ functions of $$ x$$

are equivalent to: $$L(\alpha u+\beta v)=\alpha L(u)+\beta L(v)$$

Solution: 

We know that the linearity operator L(.) allows use of superposition. Thus: $$L(u+v)=L(u)+L(v)$$ $$L(\lambda u)=\lambda L(u)$$

Therefore, we can use the above two relations to show: $$L(\alpha u+\beta v)= L(\alpha u)+ L(\beta v)=\alpha L(u)+\beta L(v)$$

 clean and clear. good work. --Egm6321.f09.TA 04:05, 16 October 2009 (UTC)

Problem 8
Problem Statement: From, plot the shape function $$N_{j+1}^{2}(x)$$ (From TA website). Solution:



correct. Egm6321.f09.TA 03:09, 28 October 2009 (UTC)

Problem 9
Problem Statement: From (| p.16-2), show that $$y_{xxx}=e^{-3t}\left(y_{ttt}-3y_{tt}+2y_t\right)$$ $$y_{xxxx}=e^{-4t}\left(y_{tttt}-6y_{ttt}+11y_{tt}-6y_t\right)$$ (From TA website).

Solution: First, we differentiate the second partial derivative of y with respect to x, $$y_{xx}$$, by x again. This can be done by taking the derivative with respect to t and multiplying by $$e^{-t}$$. $$y_{xxx}=\frac{d}{dx}y_{xx}=\left(\frac{dt}{dx}\frac{d}{dt}\right)y_{xx}=e^{-t}\frac{d}{dt}y_{xx}$$ We use the product rule to solve for the derivative with respect to t. $$y_{xxx}=e^{-t}\left[-2e^{-2t}(y_{tt}-y_t)+e^{-2t}(y_{ttt}-y_{tt})\right]$$ By substitution, we find the equation given below. $$y_{xxx}=e^{-3t}\left(y_{ttt}-3y_{tt}+2y_t\right)$$ We can now solve for $$y_{xxxx}$$ using the same method. $$y_{xxxx}=\frac{d}{dx}y_{xxx}=\left(\frac{dt}{dx}\frac{d}{dt}\right)y_{xxx}=e^{-t}\frac{d}{dt}y_{xxx}$$ Again, we use the product rule to solve for the derivative with respect to t. $$y_{xxxx}=e^{-t}\left[-3e^{-3t}(y_{ttt}-3y_{tt}+2y_t)+e^{-3t}(y_{tttt}-3y_{ttt}+2y_{tt})\right]$$ Finally, by substitution, we find the equation given below. $$y_{xxxx}=e^{-4t}\left(y_{tttt}-6y_{ttt}+11y_{tt}-6y_t\right)$$



Box your results so it is clear that you have solved the problem. Everything runs together here. Good concise approach. Egm6321.f09.TA 03:28, 28 October 2009 (UTC)

Problem 10
Problem: From (| p.16-4) Solve equation 1 on p.16-1, $$ x^2y''-2xy'+2y=0 $$ using the method of trial solution $$ y=e^{rx}$$ directly for the boundary conditions $$\left\{ \begin{array}{rl} y(1)=&3\\ y(2)=&4\\ \end{array}\right.$$ Compare the solution with equation 10 on p.16-3. Use matlab to plot the solutions (From TA website). Solution: First, we solve for the derivatives of y.  $$y=e^{rx}$$ (10.1) $$y'=re^{rx}$$ (10.2) $$y''=r^2e^{rx}$$ (10.3) Next, we substitute these equations into the characteristic equation to get the following equation. $$x^2r^2e^{rx}-2xre^{rx}+2e^{rx}=0$$ (10.4) We can now divide by $$e^{rx}$$ to find the following equation. $$x^2r^2-2xr+2=0$$ (10.5) Letting x=1, we have $$r^2-2r+2=0\rightarrow r=1\pm i$$ (10.6) This yields the following general solution: $$y(x)=c_1e^xcos(logx)+c_2e^xsin(logx)$$ (10.7) Substituting in the boundary conditions. $$\left\{ \begin{array}{rl} y(1)=&3\\ y(2)=&4\\ \end{array}\right.$$ Now, we have: $$y(x)=3e^{-1}e^xcos(logx)+\frac{4-3e^1cos(log2)}{e^2sin(log2)}e^xsin(logx)$$ (10.8)

Comparing to Equation with Constant Coefficients: The original equation was converted to a linear second order ordinary differential equation using the transfer of variable method. The resulting equation is given as: $$y(x)=c_1x+c_2x^2$$ (10.9) Solving for $$c_1$$ and $$c_2$$ using the given boundary equations resulted in the following solution: $$y(x)=4x-x^2$$ (10.10)

Discussion:  It is already apparent that this solution is much simpler than the solution found using the original equation. It should be noted that by using the Transfer of Variables Method to convert a linear second order differential equation with variable coefficients to one with constant coefficients, the solution found using the Method of Undetermined coefficients can be made much simpler. A plot of the two functions was created using MATLAB. This plot is given below where Equation 10.8 is in blue and Equation 10.10 is in black.

MATLAB Code:  x=0.1:0.1:3; y1=zeros(1,30); for i=1:30; y1(:,i)=3*exp(-1)*exp(x(:,i))*cos(log(x(:,i)))+((4-3*exp(1)*cos(log(2)))/(exp(2)*sin(log(2))))*exp(x(:,i))*sin(log(x(:,i))); y2(:,i)=4*x(:,i)-(x(:,i))^2; end plot(x,y1) title('Two Solutions for L2.ODE') xlabel('x') ylabel('y(x)')



very good. Good job showing how you can 'force' a bad guess to approximate the true solution for a local area, but a more appropriate trial solution will yield a more elegant (and accurate) solution. Egm6321.f09.TA 03:53, 28 October 2009 (UTC)

 Acknowledgments: Francisco

Problem 11
From $$ u_1(x) z' + [a_1(x)u_1(x) + 2u_1'(x)]z = 0 $$ obtain Eq.2 (P.17.3) using the integrating factor method.

Solution:

$$u_{1}(x) Z'+\left[a_{1}u_{1}(x)+2u_{1}' (x) \right]Z=0 $$

$$h(x)\left[Z'+\left[a_{1}+\frac{2u_{1}' (x)}{u_{1}(x)} \right]Z=0 \right]$$

$$h(x)Z'+h(x)\left[a_{1}+\frac{2u_{1}' (x)}{u_{1}(x)} \right]Z=0 $$

$$\frac{d}{dx}\left[h(x)Z(x) \right]=h(x)Z'(x)+h'(x)Z$$

Let $$h'(x)= h(x)\left[a_{1}+\frac{2u_{1}' (x)}{u_{1}(x)} \right]$$

$$\frac{h'(x)}{h(x)}= \left[a_{1}+\frac{2u_{1}' (x)}{u_{1}(x)} \right]$$

Integrating this will give:

$$h(x)=B exp \left[\int_{}^{x}a_{1}(s)ds+ln\left|u_{1} \right|^{2} \right]$$

$$h(x)Z'+h(x)Z=0$$

$$\int_{}^{}h(x)*Z(x)=\int_{}^{}0$$

$$h(x)Z(x)=K$$

$$ B exp \left[\int_{}^{x}a_{1}(s)ds+ln\left|u_{1} \right|^{2} \right]Z(x)=K $$

$$Z(x)= C exp \left[-\int_{}^{x}a_{1}(s)ds-ln\left|u_{1} \right|^{2} \right]$$

$$Z(x)= \frac{C}{u_{1}^{2}} exp \left[-\int_{}^{x}a_{1}(s)ds \right]$$



very good. Egm6321.f09.TA 04:10, 28 October 2009 (UTC)

Problem 12
Develop reduction of order method 2 using different algebric ops.

a. $$ y(x)=U(x)\pm u_1 $$

b. $$ y(x) = U(x)/u_1(x) $$

c. $$ y(x) = u_1(x)/U(x) $$

Solution:

a. $$ y(x) = U(x) \pm u_1(x) $$

The first and second derivatives of y(x) are:

$$y'(x) = U' \pm u_1'$$

$$y(x) = U \pm u_1''$$

The desired form is $$ y'' + a_1y' + a_0y = 0 $$,

Substituting in the above equation,

$$ a_0y + a_1y' + y = a_0U \pm a_0u_1 + a_0U' \pm a_1u_a' + U \pm u_1'' $$

We get $$ 0 = a_0U \pm a_0u_1 + a_0U' \pm a_1u_a' + U \pm u_1 $$

In the above equation, the dependent variable U(x) is present and not missing. The Reduction of Order Method is possible only when dependent variable is missing.

b. $$ y(x) = U(x)/u_1(x) $$

The first and second derivatives of y(x) are:

$$y'(x) = U'/u_1 + U/u_1'$$

$$y(x) = U/u_1 + 2U'/u_1' + U/u_1''$$

The desired form is $$ y'' + a_1y' + a_0y = 0 $$,

Substituting in the above equation,

$$ a_0y + a_1y' + y = a_0 U/u_1 + a_1 U'/u_1 + a_1 U/u_1' + U/u_1 + 2U'/u_1' + U/u_1'' $$

We get $$ 0 = a_0 U/u_1 + a_1 U'/u_1 + a_1 U/u_1' + U/u_1 + 2U'/u_1' + U/u_1 $$

The above y(x) here is not valid because the equation above is not missing U(x). The Reduction of Order Method is possible only when dependent variable is missing.

c. $$ y(x) = u_1(x)/U(x) $$

The first and second derivatives of y(x) are:

$$y'(x) = u_1'/U + u_1/U'$$

$$y(x) = u_1/U + 2u_1'/U' + u_1/U''$$

The desired form is $$ y'' + a_1y' + a_0y = 0 $$,

Substituting in the above equation,

$$ a_0y + a_1y' + y = a_0 u_1/U + a_1 u_1'/U + a_1 u_1/U'+ u_1/U + 2u_1'/U' + u_1/U''$$

We get $$ 0 = a_0 u_1/U + a_1 u_1'/U + a_1 u_1/U'+ u_1/U + 2u_1'/U' + u_1/U $$

In the above equation, the dependent variable U(x) is present and not missing. The Reduction of Order Method is possible only when dependent variable is missing.



very good. Use some color, lines, or boxes to help separate the sections of your solution. Egm6321.f09.TA 04:18, 28 October 2009 (UTC)

Problem 13
Find $$ u_1 and u_2 $$ of $$ (1-x^2)y'' - 2xy' + 2y = 0 $$ using the 2 trial solutions:

i. $$ y = ax^b $$

ii. $$ y = e^{rx} $$

and compare the two solutions using the boundary conditions $$y(0) = 1$$ and $$y(1) = 2$$ and compare the solution using the reduction of order method 2. Plot the solutions using MATLAB.

Solution:

Part 1:

$$ (1-x^{2})y''-2xy'+2y=0 $$ (13.1)

With the trial solution,

$$ y=ax^{b} $$

$$ y'=bax^{b-1} $$

$$ y''=ab(b-1)x^{(b-2)} $$

Substituting into Equation 1

$$ (1-x^2)ab(b-1)x^{(b-2)} - 2xabx^{(b-1)} + 2ax^b = 0 $$

$$ ab(b-1)x^{(b-2)}-ab(b-1)x^b - 2abx^b + 2ax^b = 0 $$

$$ ab(b-1)x^{(b-2)}-[ab(b-1) + 2ab - 2a]x^b = 0 $$

$$ ab(b-1)x^{(b-2)}-ab(b-1)x^b - 2abx^b + 2ax^b = 0 $$

$$ ab(b-1)x^{(b-2)}-\left[ab(b-1) + 2ab - 2a \right]x^b = 0 $$   (13.2)

In Equation (2), equating co-efficients of $$ x^{(b-2)}$$,

$$ ab(b-1) = 0 $$

We know that a and b both cannot be zero, and one value of $$ b=1$$.

In Equation (2), equating co-efficients of $$ x^b$$ ,

$$ ab(b-1) + 2ab - 2a = 0 $$

$$ a(b^2+b-2) = 0 $$

Again $$ a$$ cannot be zero, so $$ b =1,-2$$.

Therefore,

$$ u_1(x) = ax $$

$$ u_2(x) = \frac{a}{x^2} $$

So, the trail solution

$$ y = c_1u_1(x) + c_2u_2(x) $$

$$ y = C_1x + C_2\frac{1}{x^2} $$

Using the boundary conditions,

$$ y(\frac{\pi}{2\sqrt{2}}) = 1 $$

$$ y(\frac{\pi}{\sqrt{2}}) = 2 $$

We arrive at,

$$\displaystyle C_1 = \frac{2\sqrt{2}}{\pi} $$

$$\displaystyle C_2 = 0 $$

The trial solution becomes,

$$\displaystyle \Rightarrow y = \frac{2\sqrt{2}}{\pi}x $$  (13.3)

Therefore,

$$\displaystyle u_1 = \frac{2\sqrt{2}}{\pi}x;\ and\ u_2 = 0 $$

Part 2:

$$ (1-x^{2})y''-2xy'+2y=0 $$ (Equation 1)

Find solution using the trial solution

$$ y=e^{rx} $$

$$ y'= re^{rx} $$

$$ y''= r^{2}e^{rx} $$

Substituting into Equation 1

$$ (1-x^{2}) r^{2}e^{rx} -2x re^{rx}  +2 e^{rx}  =0  $$

$$ r^{2}e^{rx}  - r^{2} x^{2} e^{rx}  -2rx e^{rx}  +2 e^{rx}=0 $$

Rearranging and dividing by $$ e^{rx} $$,

$$ -x^2r^2-2xr + r^2 +2 = 0 $$

$$ -x^2[r^2]-x[2r] + r^2 +2 = 0 $$

We do not have any terms on the right hand side to equate with co-efficients of $$ x^2$$ and $$ x$$, so equating the constant co-efficients,

Rearranging, $$ r^2 +2 = 0 $$

$$ r = \pm \sqrt2i $$

The trial solution becomes,

$$\displaystyle \Rightarrow y = e^{\sqrt2ix} $$

$$\displaystyle \Rightarrow y = C_1 cos(\sqrt2x) + C_2 sin(\sqrt2x) $$

Using the boundary conditions,

$$\displaystyle y(\frac{\pi}{2\sqrt{2}}) = 1 $$

$$\displaystyle y(\frac{\pi}{\sqrt{2}}) = 2 $$

We arrive at,

$$\displaystyle C_1 = -2 $$

$$\displaystyle C_2 = 1 $$

The trial solution then becomes,

$$\displaystyle \Rightarrow y = -2 cos(\sqrt2x) + sin(\sqrt2x) $$       (13.4)

and,

$$\displaystyle u_1 = -2 cos(\sqrt2x);\ and\ u_2 = sin(\sqrt2x) $$

Solution given by reduction of order method 2,

$$\displaystyle u_1=x $$

and

$$\displaystyle u_2=\frac{x}{2}log_e\left(\frac{1+x}{1-x}\right) - 1 $$

Matlab Plot: A MATLAB Plot of Equations 13.3 and 13.4 is given below where Eq. 13.3 is represented by a blue line and 13.4 is given in black.

Matlab Code: x=0:0.1:7; y1=zeros(1,71); for i=1:71; y1(:,i)=(2*sqrt(2)/pi)*x(:,i); y2(:,i)=-2*cos(sqrt(2)*x(:,i))+sin(sqrt(2)*x(:,i)); end plot(x,y1,x,y2) title('HW 3 - Problem 13') xlabel('x') ylabel('y(x)')



Why do the two solutions not agree? Egm6321.f09.TA 05:56, 28 October 2009 (UTC)

Contributing Members
Egm6321.f09.Team6.PaulMoore 23:12, 6 October 2009 (UTC) Egm6321.f09.Team06.sada 07:47, 7 October 2009 (UTC) Egm6321.f09.team6.breaux 15:39, 7 October 2009 (UTC) Egm6321.f09.Team6.dianafoster 17:59, 7 October 2009 (UTC)