Even more critical area

Calculus Level 5

There are two functions f ( x ) f(x) and g ( x ) g(x) . The first function is linear f ( x ) = 2 x + n f(x) = 2x + n , where n n is fixed and currently unknown number. The second one is g ( x ) = cosh ( x ) g(x) = \cosh(x) .

If the area enclosed by graphs of f ( x ) f(x) and g ( x ) g(x) equals 377 , calculate n n to 3 decimal places.

Notes:

  • cosh ( x ) = e x + e x 2 \cosh(x) = \dfrac{e^x + e^{-x}}{2}
  • For this problem, I used combination of calculus and programming, therefore I would not label this problem with just calculus.

Link for questions here .


The answer is 51.602.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

Steven Chase
Mar 16, 2017

The function f ( x ) f(x) generally lies above g ( x ) g(x) , so the function we would integrate to get the area is:

f ( x ) g ( x ) = 2 x + n e x 2 e x 2 \large{f(x) - g(x) = 2x + n - \frac{e^x}{2} - \frac{e^{-x}}{2}}

Anti-differentiation yields a function which we can evaluate at the end points to get the area.

z ( x ) = x 2 + n x e x 2 + e x 2 + C \large{z(x) = x^2 + nx - \frac{e^x}{2} + \frac{e^{-x}}{2} + C}

But now we face the conundrum of finding the endpoints and making the whole thing work. This is where the computational aspect comes in. Let's define three unknowns: the left x x intersection coordinate ( x i ) (x_i) , the right x x intersection coordinate ( x f ) (x_f) , and the parameter n n .

The area condition gives us the following non-linear equation (call it f 1 f_1 ):

f 1 = x f 2 + n x f e x f 2 + e x f 2 x i 2 n x i + e x i 2 e x i 2 377 = 0 \large{f_1 = x_f^2 + n x_f - \frac{e^{x_f}}{2} + \frac{e^{-x_f}}{2} - x_i^2 - n x_i + \frac{e^{x_i}}{2} - \frac{e^{-x_i}}{2} - 377 = 0}

The intersection conditions give us two more non-linear equations:

f 2 = 2 x i + n e x i 2 e x i 2 = 0 f 3 = 2 x f + n e x f 2 e x f 2 = 0 \large{f_2 = 2 x_i + n - \frac{e^{x_i}}{2} - \frac{e^{-x_i}}{2} = 0 \\ f_3 = 2 x_f + n - \frac{e^{x_f}}{2} - \frac{e^{-x_f}}{2} = 0}

We have a non-linear system of three equations and three unknowns. My favorite method for this kind of thing is the multivariate Newton-Raphson iterative method. First we form a Jacobian matrix, which is a 3x3 matrix of partial derivatives of the three functions. For example, the top left entry is the partial derivative of f 1 f_1 with respect to x i x_i and the bottom right entry is the partial derivative of f 3 f_3 with respect to n n . The chosen order for the variables is ( x i , x f , n ) (x_i, x_f, n) .

Then, we iterate as shown in the bottom of the capture. The k k subscript denotes the present iteration being solved for, and the ( k 1 ) (k-1) subscript denotes history quantities. The right side consists of the (Jacobian matrix from the previous iteration multiplied by the old vector of unknowns) minus (a vector of the old function values). The right side consists of the old Jacobian multiplied by the newest iteration of the variables. We can pre-multiply the right side by the inverse of the old Jacobian to find the newly updated set of variables. I iterated 10,000 times to be safe, but it actually converges much, much faster than that.

The end result is ( x i , x f , n ) ( 4.447 , 4.808 , 51.602 ) (x_i, x_f, n) \approx (-4.447, 4.808, 51.602) . Python code below:

import numpy as np
import random
import math


xi = -10.0 * random.random()
xf = 10.0 * random.random()
n = 10.0 * random.random()


for j in range(0,10**4):

    f1 = xf**2.0 + n*xf - 0.5 * math.exp(xf) + 0.5 * math.exp(-xf) - xi**2.0 - n*xi + 0.5 * math.exp(xi) - 0.5 * math.exp(-xi) - 377.0
    f2 = 2.0*xi + n - 0.5 * math.exp(xi) - 0.5 * math.exp(-xi)
    f3 = 2.0*xf + n - 0.5 * math.exp(xf) - 0.5 * math.exp(-xf)


    J11 = -2.0*xi - n + 0.5 * math.exp(xi) + 0.5 * math.exp(-xi)
    J12 = 2.0*xf + n - 0.5 * math.exp(xf) - 0.5 * math.exp(-xf)
    J13 = xf - xi

    J21 = 2.0 - 0.5 * math.exp(xi) + 0.5 * math.exp(-xi)
    J22 = 0.0
    J23 = 1.0

    J31 = 0.0
    J32 = 2.0 - 0.5 * math.exp(xf) + 0.5 * math.exp(-xf)
    J33 = 1.0

    J = np.array([[J11,J12,J13],[J21,J22,J23],[J31,J32,J33]])
    fvec = np.array([f1,f2,f3])
    var = np.array([xi,xf,n])
    right = np.dot(J,var) - fvec
    Sol = np.linalg.solve(J, right)

    xi = Sol[0]
    xf = Sol[1]
    n = Sol[2]



print xi,xf,n

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...