# Thread: Need Equation for Line Intersecting Two Points Involving y = x/(|x|+1)

1. ## Need Equation for Line Intersecting Two Points Involving y = x/(|x|+1)

So I'm trying to solve for an equation that produces a line that intersects two specific points and is shaped approximately like this:

This equation is expressed as y = x / (|x| + 1), has asymptotes at y = 1 and y = -1, and intersects the points (0, 0) and (1, 0.5). I'm wondering how to modify this equation to have asymptotes at y = 0 and y = 0.95 and intersects the points (0, 0.05) and (1, 0.75).

I'd really prefer a step-by-step solution in case I need to find similar equations with different parameters. Please and thank you everyone. Really need this for a project I'm working on.

Jinumon

2. ## Re: Need Equation for Line Intersecting Two Points Involving y = x/(|x|+1)

Originally Posted by Jinumon
So I'm trying to solve for an equation that produces a line that intersects two specific points and is shaped approximately like this:

This equation is expressed as y = x / (|x| + 1), has asymptotes at y = 1 and y = -1, and intersects the points (0, 0) and (1, 0.5). I'm wondering how to modify this equation to have asymptotes at y = 0 and y = 0.95 and intersects the points (0, 0.05) and (1, 0.75).
Is this the graph you want?

3. ## Re: Need Equation for Line Intersecting Two Points Involving y = x/(|x|+1)

Originally Posted by Jinumon
So I'm trying to solve for an equation that produces a line that intersects two specific points and is shaped approximately like this:

This equation is expressed as y = x / (|x| + 1), has asymptotes at y = 1 and y = -1, and intersects the points (0, 0) and (1, 0.5). I'm wondering how to modify this equation to have asymptotes at y = 0 and y = 0.95 and intersects the points (0, 0.05) and (1, 0.75).

I'd really prefer a step-by-step solution in case I need to find similar equations with different parameters. Please and thank you everyone. Really need this for a project I'm working on.

Jinumon
I will show you how to do this and you can modify it for other cases. Your function goes from -1 to 1 which is 2 units. Let's multiply it by $\frac 1 2$ so it goes from $-\frac 1 2$ to $\frac 1 2$ and move it up $\frac 1 2$. So now it looks like$$f(x) = \frac 1 2\frac {x}{|x|+1}+\frac 1 2$$This will have asymptotes $y=0$ and $y=1$ You want the upper asymptote to be $.95$ so let's multiply it by $.95$. So now$$f(x) = .95\left (\frac 1 2\frac {x}{|x|+1}+\frac 1 2 \right)$$
So far this graph has the right shape and desired asymptotes. Now this function takes the value $.05$ way to the left of $x=0$. If you set $f(x) = .05$ and solve it you get $x = -8.5$. So $f(-8.5)=.05$ but you want $f(0) = .05$. So now replace $x$ by $x - 8.5$ in your equation. Now your equation is$$f(x)= .95\left (\frac 1 2\frac {x-8.5}{|x-8.5|+1}+\frac 1 2 \right)$$
Translating it horizontally didn't change the horizontal asymptotes and now $f(0) = .05$ All that is left is to get $f(1)=.75$. Currently the value of $x$ that gives $f(x) = .75$ is $x=9.875$. So if you scale the $x$ axis by replacing $x$ by $9.875x$, that should do it. Your final formula becomes$$f(x)=.95\left (\frac 1 2\frac {9.875x-8.5}{|9.875x-8.5|+1}+\frac 1 2 \right)$$

Here's a graph of the final result (click to enlarge):

4. ## Re: Need Equation for Line Intersecting Two Points Involving y = x/(|x|+1)

Originally Posted by Walagaster
I will show you how to do this and you can modify it for other cases. Your function goes from -1 to 1 which is 2 units. Let's multiply it by $\frac 1 2$ so it goes from $-\frac 1 2$ to $\frac 1 2$ and move it up $\frac 1 2$. So now it looks like$$f(x) = \frac 1 2\frac {x}{|x|+1}+\frac 1 2$$This will have asymptotes $y=0$ and $y=1$ You want the upper asymptote to be $.95$ so let's multiply it by $.95$. So now$$f(x) = .95\left (\frac 1 2\frac {x}{|x|+1}+\frac 1 2 \right)$$
So far this graph has the right shape and desired asymptotes. Now this function takes the value $.05$ way to the left of $x=0$. If you set $f(x) = .05$ and solve it you get $x = -8.5$. So $f(-8.5)=.05$ but you want $f(0) = .05$. So now replace $x$ by $x - 8.5$ in your equation. Now your equation is$$f(x)= .95\left (\frac 1 2\frac {x-8.5}{|x-8.5|+1}+\frac 1 2 \right)$$
Translating it horizontally didn't change the horizontal asymptotes and now $f(0) = .05$ All that is left is to get $f(1)=.75$. Currently the value of $x$ that gives $f(x) = .75$ is $x=9.875$. So if you scale the $x$ axis by replacing $x$ by $9.875x$, that should do it. Your final formula becomes$$f(x)=.95\left (\frac 1 2\frac {9.875x-8.5}{|9.875x-8.5|+1}+\frac 1 2 \right)$$
Here's a graph of the final result (click to enlarge):
-Now who is giving complete solutions?

5. ## Re: Need Equation for Line Intersecting Two Points Involving y = x/(|x|+1)

Yeah, I figured I might hear about that. But it sounded like it wasn't a homework problem because he said it was part of a project where he might need to do more cases.

6. ## Re: Need Equation for Line Intersecting Two Points Involving y = x/(|x|+1)

Thank you so much Walagaster. I'm working on an RPG and wanted a to-hit rate where x = Atk Rating / Def Rating that approaches 95% and 5% and where Hit Rate is 75% when the two are equal. So yeah, not homework. Depending on how it playtests I may need to adjust values but I really wanted something with asymptotes so hitting or missing was never totally assured. Thanks again,
Jinumon

7. ## Re: Need Equation for Line Intersecting Two Points Involving y = x/(|x|+1)

Originally Posted by Jinumon
Thank you so much Walagaster. I'm working on an RPG and wanted a to-hit rate where x = Atk Rating / Def Rating that approaches 95% and 5% and where Hit Rate is 75% when the two are equal. So yeah, not homework. Depending on how it playtests I may need to adjust values but I really wanted something with asymptotes so hitting or missing was never totally assured. Thanks again,
Jinumon
You're welcome. There are other common curves that you might want to look at that have the same general shape. One is $y=\arctan x$ and another is the logistics curve $$y = \frac 1 {1+e^{-x}}$$
You could try similar modifications on those to see what suits your purposes best.