# Need help fixing a program that draws a reciprocal function illustrating key points.

BSS_Math shared this question 4 years ago

Hi,

I am trying to create a program that will aid my students in understanding how to graph a reciprocal function from the graph of a given function. I have created a program that takes a function input by the user and it currently

1. Plots the reciprocal function

2. Labels where f(x) intersects 1/f(x)... ie) solves f(x)=1 and f(x)=-1

3. Finds the local minima/maxiima of f(x) and uses these points to draw respective points on 1/f(x).

Parts 1 and 2 work perfectly. For 1. using g(x)=1/f(x) input works fine. For 2. I have just used intersect[f(x), 1, -1000, 1000] and intersect[f(x), -1, -1000, 1000] and all points are drawn in the interval given.

However 3. does not. I am using the command

(x(Intersect[f'(x), 0]), g(x(Intersect[f'(x), 0]))) where g is defined as 1/f(x).

however the program will only find one point and not other remaining points. I'm not sure if I need to script a for loop or somehow specify an interval for the program to look at. When I try using a -1000 to 1000 interval on the intersect command, the program flags an error. If someone can tell me how to get all of the points for part 3. that would be great! Attached is the current file I'm working with. I have left out the intersect command for the local max/min points. 2

In order to get all the solutions, you need to enclose the Intersect command in braces.

Have a look at the attached file.

List L_1 creates the intersections, list L_2 contains the related y calculated with g. 1

Thank you for the fix. I have since used this knowledge to add in asymptotes, which was something that I was wondering about as well.