User:Eml5526.s11.team6.deshpande/hwk5

Homework 5 = Problem 5.1 Solution of the PDE using weak form.=

Find
Solve the following PDE using weak form with appropriate $$F_I$$ I= Polynomial function, Fourier function, Exponential function until convergence of $$u^h(0.5)$$
 * {| style="width:100%" border="0"

$$ \frac{\partial}{\partial x}\left [ (2+3x)\frac{\partial u}{\partial x} \right ]+5x=0 \qquad \forall  x   \epsilon \left ]0,1   \right [$$ (5.1.1)
 * }
 * }

Given

 * {| style="width:100%" border="0"

$$ u(0)=4, \qquad -\frac{\partial u}{\partial x}_{(x=1)}=6 $$
 *  (5.1.2)
 * }
 * }

Introducing the arbitrary weighted function
Weak form can be found as follows, with weighted function

Now, multiply eq. 5.1.1 by $$ \displaystyle w $$ and integrate between 0 to 1.

Use integration by parts for the first term in eq. 5.1.4

Using eq. (5.1.2) and eq. (5.1.3), we get

Put eq. (5.1.6) in eq. (5.1.5), we get the weak form as follows

a.Using the polynomial basis function

For getting appropriate constraint breaking solution, we choose Also, Take $$ \displaystyle \beta=0$$ for the constraint breaking solution. Therefore, From eq. 5.1.2 and eq. 5.1.10, we can say that Therefore, eq. 5.1.10 becomes Similarly, the weighted function can be written as Eq. 5.1.3 gives, Therefore eq. 5.1.13 becomes Hence, from eq. 5.2.12 and 5.2.15 Put this in eq. 5.1.7, we get Using eq. 5.1.15 we can find $$ \displaystyle w(1) $$ and put in eq. 5.1.18, we get By integrating and verifying with| Wolfram Alpha, we get The following figure shows comparison of analytical and numerical solution for different values of n. As expected, the numerical solution approaches analytical solution as n increases.

Approximate solution converges to analytical solution at n=4. To minimize the error,higher values of n need to be considered.

= Problem 5.2 Solution of the PDE using weak form.=

Find
Solve the following PDE using weak form with appropriate $$F_I$$ I= Polynomial function, Fourier function, Exponential function until convergence of $$u^h(0.5)$$
 * {| style="width:100%" border="0"

$$ \frac{\partial}{\partial x}\left [ (2+3x)\frac{\partial u}{\partial x} \right ]+5x=0 \qquad \forall  x   \epsilon \left ]0,1   \right [$$ (5.2.1)
 * }
 * }

Given

 * {| style="width:100%" border="0"

$$ u(1)=4, \qquad -\frac{\partial u}{\partial x}_{(x=0)}=6 $$
 *  (5.2.2)
 * }
 * }

Introducing the arbitrary weighted function
Weak form can be found as follows, with weighted function

Now, multiply eq. 5.2.1 by $$ \displaystyle w $$ and integrate between 0 to 1.

Use integration by parts for the first term in eq. 5.2.4

Using eq. (5.2.2) and eq. (5.2.3), we get

Put eq. (5.2.6) in eq. (5.2.5), we get the weak form as follows

a.Using the polynomial basis function

For getting appropriate constraint breaking solution, we choose Also, Take $$ \displaystyle \beta=1$$ for the constraint breaking solution. Therefore, From eq. 5.2.2 and eq. 5.2.10, we can say that Therefore, eq. 5.2.10 becomes Similarly, the weighted function can be written as Eq. 5.2.3 gives, Therefore eq. 5.2.13 becomes Hence, from eq. 5.2.12 and 5.2.15 Put this in eq. 5.2.7, we get Using eq. 5.2.15 we can find $$ \displaystyle w(0) $$ and put in eq. 5.2.18, we get By integrating and verifying with| Wolfram Alpha, we get Following Matlab code is used to find coefficients a_j by changing values of i and j in the above equation The figure shows comparison of analytical and numerical solution for polynomial function. At n=5,numerical solution approaches analytical solution.Error decreases below $$ 10^{-6}$$ for n=10