Calculating y = sec(x) functions given points?

134 Views Asked by At

I'm attempting to write a function for a computer program that will allow me to find points along it. To start with, I have 2 points. One is always on the y axis, and the other is always larger in both coordinates.

I started with an exponential function of the form $y = e^{kx}$ where I calculated points with $$k = \frac{ln(|y_1|)-ln(|y_0|)}{x_1-x_0}$$

This worked fine for a period but then I wanted to change how aggressive the curve was.

I realized I could calculate a linear function with these points as well, and combining the linear and exponential functions works nicely for creating a function through the same points.

$$y = a(Ce^{kx})+(1-a)(mx)$$ $$0\le a\le1$$ Now in order to make the curve less aggressive at the beginning, but still pass through both points, I think I might be able to use a $y = sec(x)$ function.

The problem is that I can't seem to figure out how to calculate a $sec(x)$ function given the points that I have.

Here is a desmos graph showing some of the thinking I've done about this problem, adjusting the ($a$) parameter can show you how the function(s) can become more or less aggressive. Right now, the $sec(x)$ function isn't calculated and is only eyeballed for graphing.

https://www.desmos.com/calculator/uls2p9wb0m

Is there a way to calculate the multiple of x in the $sec(x)$ function based off the points I have? Or is there another function other than a $sec(x)$ function that could work similarly?

Thanks for your time.

1

There are 1 best solutions below

0
On

With some help, I managed to figure this out. Given a $y$ intercept $(0, y_0)$ and another point $(x_1, y_1)$ one can calculate Linear, Exponential, and Secant functions as follows:

Linear

$$y=(\frac{y_1-y_0}{x_1})x+y_0$$

Exponential

$$k=\frac{ln(abs(y_1))-ln(abs(y_0))}{x_1}$$ $$y=y_0e^{kx}$$

Secant

$$s = \frac{arccos(\frac{1}{(y_1-y_0)+1})}{x_1}$$ $$y = sec(sx)+y_0-1$$

Try these interactively on my updated desmos: https://www.desmos.com/calculator/y2blzu1soh