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

I'm trying to create a function that makes a graph like this:

|           -
|          - -
|         -   -
|        -     -
|--------       --------

I'm stuck with: $1/((x-1.5)^2)$

Any help?

share|cite|improve this question
What about like a bell curve? – mathguy Dec 23 '12 at 19:28
I used a tent function in the end. Thanks! – Todd Davies Dec 23 '12 at 20:00
up vote 5 down vote accepted

Sometimes such functions are called triangular or tent functions.

The most basic example centered at $0$ looks like : $$ f(x) = \begin{cases} 1- |x|, & \text{if }|x|<1\\ 0, & \text{ else} \end{cases} $$

share|cite|improve this answer
I'd like it to be a curve ideally. Unfortunately, my graph doesn't really get that across very well... – Todd Davies Dec 23 '12 at 19:31
Can I have an example of the function for this please, I can't work it out from wikipedia – Todd Davies Dec 23 '12 at 19:37

You can do $y=e^{-x^2}$ It isn't exactly flat on the sides, but it pretty much is. You can edit either the $e$, $2$, coefficient, or the denominator to change the shape (and translate it wherever you need).

As the comment below suggests, it's a Gaussian Curve.

share|cite|improve this answer
such functions are often known as gaussian curves, see : – MSEoris Dec 23 '12 at 19:33
Thanks, didn't know the name for it. – mathguy Dec 23 '12 at 19:34

If you want your function to be both smooth and zero everywhere outside a finite interval, what you need is a bump function. A classic example is $$f(x) = \begin{cases} e^{-1/(1-x^2)} & \text{for } -1 \le x \le 1 \\ 0 & \text{otherwise}, \end{cases}$$ which looks like this:

$\hspace{70px}$ Plot of exp(-1/(1-x^2))
(Image from Wikimedia Commons, created and released into the public domain by Oleg Alexandrov.)

share|cite|improve this answer

The function $1/(x-1.5)^2$ that you pointed couldn't have such that shape. But doing some changes can make it to have that desire shape. It is $$f(x)=\frac{1}{(x^2+1.5)^2}$$

enter image description here

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.