(15C) (DM 15L) Analyzing a function f(x)
|
06-09-2020, 07:00 AM
(This post was last modified: 06-09-2020 01:23 PM by rawi.)
Post: #6
|
|||
|
|||
RE: (15C) (DM 15L) Analyzing a function f(x)
This is an improved version of the program posted at the beginning of this thread.
This program helps in analyzing a function f(x) in a given area of x. The function should be defined and differentiable in the whole area. The program does the following tasks: - Make a table of function values for sketching the curve - Search for zero points - Search for extrema - Search for inflection points - Compute the function value, the 1st and 2nd derivative at any given value for x - Compute the length of the function curve between to given x-values The improvements are: - For the computation of the first and the second derivative different increment values are used resulting in more precise results. - Computation of function length is included. - Code was shortened so that the length of the program did not increase much despite the improvements. Many of these improvements are due to suggestions by Valentin Albillo whom I want to thank here. Method: The program approximates the derivative by adding and subtracting the small value d stored in Register I to x and evaluation the function. The derivative is estimated by (f(x+d)-f(x-d)/(2d). The second derivative is approximated in a similar way by using additionally f(x) and a 10 times greater d to get numerical stable results. Making the small value too big or too small delivers poor approximations. It is recommended to set it by .001. By experience the deviation then is about 1 unit in the fifth figure. Use of registers: Registers 0-3 and I are used. How to apply: Preparation: - Put in the function under LBL E. It must take the x-value from the X-register and return f(x) in X register. - Put in a small number (recommendation: 0.001) in Register I. Application: 1. To generate a table of function values: - Starting point of x ENTER - Ending point of X ENTER - Step length x-values - Press f A Output: - f(x) at starting point R/S - f(x) at starting point + 1 * step length R/S - f(x) at starting point + 2* step length R/S …. Note: In the Y-register there is the x-value, in the X-register the value of f(x) So at every step you can check the value of x by pressing x<>y 2. To find a zero point of the function: Put in two estimates in the stack and press f SOLVE E (OK, this was easy) 3. To find an extremum: Put in two estimates in stack and press f SOLVE B. Program returns x value of extremum. To get f(x) at extremum press f E. If no extremum is found program returns “Error 8”. 4. To find an inflection point (i.e. an extremum of the first derivate) put in two estimates in stack and press f SOLVE C. Program returns x value of inflection point. To get f(x) at this point press f E. If no inflection point is found program returns “Error 8”. 5. To get the first derivative at a given x: Put in x in stack, press f B. 6. To get the second derivative of a given x: Put in x in stack, press f C. 7. To get the curve length of the function between two points: Put lower x in Y-register and upper x in X register and press integration key D. Example: Function f(x) = (e^(-x²)+x²-5)/(sin(x)+2) in the area from -4 to 4. Preparation: The program for LBL E is listed below. 0.001 STO I. 1) Generate a table from x=-4 to x=4 with step width 1: -4 ENTER 4 ENTER 1 f A: 3.9901 (This is the value of f(x) at -4. To check x press x<>y: -4) R/S 2.1519 (=f(-3)) R/S -0.9000 R/S -3.1351 R/S -2.0000 R/S -1.2783 R/S -0.3374 R/S 1.8682 R/S 8.8482, which equals f(4). 2) Search for zero point between x=-3 and x=-2. -3 ENTER -2 f SOLVE E Result: -2.2346 (x-value of zero point). Search for zero point between x=2 and x=3: 2 ENTER 3 f SOLVE E -> 2,2346 3) Search for minimum between x=-2 and x=0. -2 ENTER 0 f SOLVE B -> -1.0796. To get f(x) at minimum press f E -> -3.1503 4) Search for inflection points: -4 ENTER -3 f SOLVE C -> -3,5395. For f(x) at inflection point press f E -> 3.1531 -3 ENTER -1 f SOLVE C -> -1.9825. f E -> -0.9690 -1 ENTER 0 f SOLVE C -> -0.4898 f E -> -2.5978 0 ENTER 3 f SOLVE C -> 0.6831 f E -> -1.4846 5) Estimation the length of the function curve from -4 to 4: -4 ENTER 4 f INTEGRATION KEY D -> 21.5315 PHP Code: f LBL A 001 – 42,21,11 |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
(15C) (DM 15L) Analyzing a function f(x) - rawi - 06-05-2020, 05:04 PM
RE: (15C) (DM 15L) Analyzing a function f(x) - Valentin Albillo - 06-05-2020, 11:34 PM
RE: (15C) (DM 15L) Analyzing a function f(x) - rawi - 06-06-2020, 11:10 PM
RE: (15C) (DM 15L) Analyzing a function f(x) - Valentin Albillo - 06-07-2020, 11:40 PM
RE: (15C) (DM 15L) Analyzing a function f(x) - rawi - 06-09-2020, 06:51 AM
RE: (15C) (DM 15L) Analyzing a function f(x) - rawi - 06-09-2020 07:00 AM
|
User(s) browsing this thread: 6 Guest(s)