User:EGM6341.S11.team2.lee

=Problem 1.4=

Find
Plot f, g and find $$ {\left\| f \right\|_\infty } {\left\| g \right\|_\infty } {\left\| {f - g} \right\|_\infty }$$

Given
$$ f(x) = 3x + 5{x^3},x \in [0,1]; g(x) = \sinh x,x \in [0,1] $$

Solution
Because $$ {f^'}(x) = 3 + 15{x^2} > 0,\;\;x \in [0,1], {g^'}(x) = {(\sinh x)^'} = {(\frac{2})^'} = \frac{2} > 0,\;\;x \in [0,1] {\left( {f(x) - g(x)} \right)^'} = 3 + 15{x^2} - \cosh x > 0,\;\;x \in [0,1]$$

Which means that f(x) keeps increasing at [0,1], and g(x) and f(x)-g(x) as well

So $$ {\left\| f \right\|_\infty } = \max \left| {f(x)} \right| = {\left. {\left| {f(x)} \right|} \right|_{x = 1}} = 8 $$

$$ {\left\| g \right\|_\infty } = \max \left| {g(x)} \right| = {\left. {\left| {g(x)} \right|} \right|_{x = 1}} = \frac{1}{2}(e - \frac{1}{e}) \approx 1.71520 $$

$$ {\left\| {f - g} \right\|_\infty } = \max \left| {f(x) - g(x)} \right| = {\left. {\left| {f(x) - g(x)} \right|} \right|_{x = 1}} = 8 - \frac{1}{2}(e - \frac{1}{e}) \approx 6.82479  $$

Using the following Fortran code

program main real,allocatable::x,f,g integer::i,n real::e=2.71828 open (unit=10, file="input", status="old") read(10,*)n allocate(x(n+1),f(n+1),g(n+1)) do i=1,n+1 x(i)=-1.0+2.0/n*(i-1) f(i)=3.0*x(i)+5*x(i)**3 g(i)=0.5*(e**x(i)-e**(-1.0*x(i))) end do  open (unit=11, file="hw1.4.plt", status="replace") do i=1,n+1 write(11,"(3F12.4)") x(i),f(i),g(i) end do   end program main

We can easily get the image of f(x) and g(x) as following