5
$\begingroup$

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

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

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

Any help?

$\endgroup$
2
  • $\begingroup$ What about like a bell curve? $\endgroup$ Dec 23, 2012 at 19:28
  • $\begingroup$ I used a tent function in the end. Thanks! $\endgroup$ Dec 23, 2012 at 20:00

4 Answers 4

5
$\begingroup$

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} $$

$\endgroup$
2
  • $\begingroup$ I'd like it to be a curve ideally. Unfortunately, my graph doesn't really get that across very well... $\endgroup$ Dec 23, 2012 at 19:31
  • $\begingroup$ Can I have an example of the function for this please, I can't work it out from wikipedia $\endgroup$ Dec 23, 2012 at 19:37
4
$\begingroup$

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.

$\endgroup$
2
4
$\begingroup$

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.)

$\endgroup$
3
$\begingroup$

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

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .