User:Egm6341.s11.team3.russo

This is my Numerical Methods wikiversity page. Below are my contributions to team assignments.

=Homework 1 due Wed Jan 26=

Given:

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

$$f(x)=3x-2x^3\ $$ (4.1) 
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }
 * {| style="width:100%" border="0"

$$g(x)=sinh(x)=\frac{1}{2}\left(e^{x}-e^{-x}\right)$$ (4.2)
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }

Find:
A) Plot f(x) and g(x)

B) Find the following norms:


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

$$||f(x)||_{\infty}, ||g(x)||_{\infty}, ||f(x) - g(x)||_{\infty}$$
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }

Solution
A) Equations (4.1) and (4.2) are plotted over the domain of x=[0,1] as shown below:



The difference between these two functions will be called Y(x). It is defined below as:


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

$$Y(x) = f(x)-g(x)=[3x-2x^3]-[sinh(x)]=3x-2x^3-\frac{1}{2}\left(e^{x}-e^{-x}\right)$$ (4.3)
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }

The plot of equation (4.3) over the domain of x=[0,1] is shown below:



B) The infinity norms of these three equations using the restricted domain of x=[0,1] are found below:

The infinity norm of a function is simply the maximum value the function achieves over a specified domain. All three of the functions plotted above will approach infinity over the unrestricted domain of $$x=(-\infty,+\infty)$$.

However, since we are restricting the domain to x=[0,1], these norms must be calculated using techniques discussed below:

B.1) Upon observing the plot of equation (4.1), it is obvious that the maximum value of f(x) occurs at the vertex.  So, the infinity norm will be found by solving for the vertex.  This is accomplished by finding the point of the function where the derivative is zero, since f(x) is not changing at the vertex:


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

$$f(x)=3x-2x^3\ $$ (4.1) 
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }
 * {| style="width:100%" border="0"

$$ \frac{df(x)}{dx} = (1)3x^{(1-1)} - (3)2x^{(3-1)} = 3-6x^2$$ (4.4)
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }

Solving equation (4.4) for x when the derivative of f(x) is zero yields the location of the vertex: 
 * {| style="width:100%" border="0"

$$ \frac{df(x_{vertex})}{dx} = 3-6x_{vertex}^2=0$$ (4.5) 
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }
 * {| style="width:100%" border="0"

$$ x_{vertex} = \sqrt{\frac{(0 - 3)}{-6}} = \frac{\sqrt{2}}{2}$$ (4.6)
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }

Substituting this value of x back into equation (4.1) will yield the value of f(x) at the vertex, which is also the infinity norm on x=[0,1]:

<span id="(1)">
 * {| style="width:100%" border="0"

$$ ||f(x)||_{\infty} = f(x_{vertex}) = 3\left(\frac{\sqrt{2}}{2}\right)-2\left(\frac{\sqrt{2}}{2}\right)^3 = \sqrt{2}$$ (4.7)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

B.2) Upon observing the plot of equation (4.2), it is obvious that the maximum value over the prescribed domain occurs at the right boundary of the domain, or when x=1.  So, the infinity norm may be found simply by substituting this value of x directly into the function g(x):

<span id="(1)">
 * {| style="width:100%" border="0"

$$g(x)=sinh(x)=\frac{1}{2}\left(e^{x}-e^{-x}\right)$$ (4.2)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

<span id="(1)">
 * {| style="width:100%" border="0"

$$ ||g(x)||_{\infty} = g(1) = sinh(1) = \frac{1}{2}\left(e^{(1)}-e^{-(1)}\right) = 1.1752$$ (4.8)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

B.3) Upon observing the plot of Y(x), which is defined above by equation (4.3), it is once again obvious that the maximum value of Y(x) occurs at the vertex.  So, the infinity norm will again be found by solving for the vertex:

<span id="(1)">
 * {| style="width:100%" border="0"

$$Y(x)=3x-2x^3-\frac{1}{2}\left(e^{x}-e^{-x}\right)$$ (4.3)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

<span id="(1)">
 * {| style="width:100%" border="0"

$$ \frac{dY(x)}{dx} = (1)3x^{(1-1)} - (3)2x^{(3-1)} - \frac{1}{2}\left((1)e^{x}-(-1)e^{-x}\right) = 3-6x^2 - \frac{1}{2}\left(e^{x}+e^{-x}\right)$$ (4.9)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

Solving equation (4.9) for x when the derivative of Y(x) equals zero yields the location of the vertex: <span id="(1)">
 * {| style="width:100%" border="0"

$$ \frac{dY(x_{vertex})}{dx} = 3-6x_{vertex}^2 -\frac{1}{2}\left(e^{x_{vertex}}+e^{-x_{vertex}}\right)=0$$ (4.10)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

This equation cannot be solved analytically. An iterative approach was used, and the solution verified by observation of the plot above:

<span id="(1)">
 * {| style="width:100%" border="0"

$$ x_{vertex} = 0.5541\ $$ (4.11)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

Substituting this value of x back into equation (4.3) will yield the value of Y(x) at the vertex, which is also the infinity norm on x=[0,1]:

<span id="(1)">
 * {| style="width:100%" border="0"

$$ ||f(x)-g(x)||_{\infty}=||Y(x)||_{\infty} = Y(x_{vertex}) = 3(0.5541)-2(0.5541)^3-\frac{1}{2}\left(e^{(0.5541)}-e^{-(0.5541)}\right) = 0.7392$$ (4.12)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

Thus, each norm has been found and the problem is complete:

When the domain is unrestricted, $$x=(-\infty,+\infty)$$ and the norms are: <span id="(1)">
 * {| style="width:100%" border="0"

$$||f(x)||_{\infty} = ||g(x)||_{\infty} = ||f(x) - g(x)||_{\infty} = \infty $$ (4.13)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

When the domain is restricted to $$x=[0,1]\ $$, the norms become:

Solution Part 2:
All of the necessary information is given in the problem statement. Therefore, all that is left to do is perform the calculations using the proposed methods. The same MatLAB code from Solution Part 1 may be used, with the exception of the file main.m. This file will be replaced by mainB.m as shown below, where the only difference between these files is that mainB.m uses the angle of attack governed by Equation (7.2.2.B), and mainB does not calculate J or ode45.

Below are the new resulting state variable plots, followed by the new M-File that produced them: