Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Three years of calculus in college have served me nothing, apparently, since I can't for the life of me remember even the basics. I'm working on a small software project where I have a table with say 20 cells, and I want the cells' opacity to go down as the index goes up.

Currently, I'm doing it linearly with $\textrm{opacity} = 1 - (\textrm{index}/20)$, or $y = 1-x$. The curve I'm going for is something where at the beginning I have a high value for the opacity, 1, but then it starts dropping like a roller-coaster, non-linearly. The best I can describe it is it looks like half of a 'C' draw on the positive xy axis.

The closest I got was $y = e^x$, but that plot goes up. Can anyone tell me the name of what I'm looking for?

Edit: Ok it turns out what I'm looking for is a hyperbola, $y = 1/x$. However, since this is a opacity value, the range needs to be from $0$ to $1$, while the domain is also $0$ to $1$. But I'm getting some large values for small inputs.

share|cite|improve this question
You could look at the examples of curves. Looks like you found a hyperbola. – Amzoti Dec 23 '12 at 0:59
@Amzoti ya I've gotten up to there, but I'm not sure how to restrict y values to 0-1 – maq Dec 23 '12 at 1:01
Maybe you can play with various parameters and better describe your problem. Which hyperbola best describes your needs? – Amzoti Dec 23 '12 at 1:04
As an alternative, you might try a logistic function. This gives you three parameters to play with. – David Mitra Dec 23 '12 at 3:08
Similar to $e^x$, you can also try $e^{-x}$. – Rahul Dec 23 '12 at 4:11
up vote 6 down vote accepted

Since your domain and range are both $[0,1]$, you can try the curve $$\sqrt{x} + \sqrt{y} = 1$$ i.e. $$y = (1-\sqrt{x})^2$$ enter image description here

share|cite|improve this answer
Nice Marvis!... – amWhy Dec 23 '12 at 1:16

Experimenting with largish coefficients for the $x$ term, e.g.

$y = \dfrac{1}{36x}$:

enter image description here

You might also want to experiment with graphs of the following equation: for any $a < 1$ (the lower the value of $a$, the greater the curve):

$$x^a+y^a=1 \iff y=(1-x^a)^{1/a}, \quad 0 < a < 1$$

E.g. Letting $a = \large \frac35$, below is the graph of $\displaystyle y = (1 - x^{\large \frac35})^{\large \frac53}$:

enter image description here

And letting $a = \large \frac{7}{12}$, below is the graph of $\displaystyle y = (1 - x^{\large\frac{7}{12}})^{\large\frac{12}{7}}$

enter image description here

share|cite|improve this answer
Yes those are the ones I'm looking for, but the problem is, given an x value from 0 to 1, how do I map respective y values in the range of 0 to 1 as well? – maq Dec 23 '12 at 1:07
Try $y = (1-x)^2$ or $y = (1-x)^\alpha$ with $\alpha > 1$, until it looks right. – Hans Engler Dec 23 '12 at 1:10

As an extension to Marvis' answer, any function of the form

$$x^p+y^p=1\implies y=(1-x^p)^{1/p}$$

where $0<p<1$ will work, with more curvature the lower $p$ is. Another alternative is to use a circular arc:

$$(x-1)^2+(y-1)^2=1\implies y=1+\sqrt{1-(x-1)^2}$$

If you don't need it to be vertical at $x=0$, polynomials like $y=(x-1)^{2n}, n=1,2,3...$ might work. You get a steeper drop with larger $n$. If efficiency is an issue and you don't need to match a plot exactly, this is probably less expensive, thought it might not "curve as evenly" as you'd like it to.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.