0

I have been trying to plot a sum of 2 exponentials where one has positive and the other a negative exponent. I tried to plot this function:

$$ f(x) = 30e^{2x} + 3e^{-2x} $$

And i get nothing here while WolframAlpha wont even draw this! Could anyone try in mathematica and post a good image here. Is it possible that exponential functions destroy one another?


EDIT:

I tried plotting this in gnuplot by using a script and nothing was drawn. Weird.

set terminal epslatex color colortext size 9cm,5cm
set size 1.5,1.0
set output "tuneliranje_1.tex"

set style line 1 linetype 1 linewidth 3 linecolor rgb "#FF0055"
set style line 2 linetype 2 linewidth 1 linecolor rgb "#FF0055"
set style line 3 linetype 1 linewidth 3 linecolor rgb "#2C397D"
set style line 4 linetype 2 linewidth 1 linecolor rgb "#2C397D"
set style line 5 linetype 1 linewidth 3 linecolor rgb "#793715"
set style line 6 linetype 2 linewidth 1 linecolor rgb "#793715"
set style line 7 linetype 1 linewidth 3 linecolor rgb "#b1b1b1"
set style line 8 linetype 3 linewidth 1 linecolor rgb "#b1b1b1"

set grid

set samples 1000

set key at graph 1, 1.0
set key samplen 2
set key spacing 2

f(x)=30*exp(2*x)+3*exp(-2*x)

set xtics ("$0$" 0)
set ytics ("$0$" 0)

set xrange [-4:4]
set yrange [-0.5:3]

plot f(x) ls 1 title "$f(x)=30 e^{2x}+3e^{-2x}$"
71GA
  • 841
  • 1
    your need to set the y-range properly in the "function-graph" web site before you can see anything. – achille hui Apr 21 '13 at 18:24
  • I don't know about WolframAlpha, but if you adjust the range of the $y$ axis on the page you link, then you can easily plot your function. Note that the default range is $[-5,5]$ for both $x$ and $y$, but an exponential function grows way too fast to fit in there... – A.P. Apr 21 '13 at 18:25
  • Your yrange is way too small. Your script works as expected if you remove the line set yrange [-0.5:3]. By the way, you couldn't get a meaningful plot from the "function-graph" website for the same reason. – A.P. Apr 23 '13 at 14:36

4 Answers4

3

It is not possible that $30e^{2x}$ and $3e^{-2x}$ cancel out, since they are both positive everywhere on $\Bbb R$.

Here are a couple plots made with gnuplot for $x$ in $[-3,2]$ and $[-11,10]$ respectively

$\hskip 1 in$plot between -3 and 2

$\hskip 1 in$plot between -11 and 10

Edit: To plot, say, the second figure, and save the output to a png file, just open gnuplot in a terminal and type

 set terminal png
 set output '/path/to/output.png'
 plot [-11:10] 30*exp(2*x)+3*exp(-2*x)
A.P.
  • 9,728
  • Could you add the script that you used, because i like this a lot! – 71GA Apr 22 '13 at 04:53
  • 1
    @71GA: Thanks! I hope this helps. If you don't like terminals, there should be a GUI version, too. – A.P. Apr 22 '13 at 07:36
  • Gnuplot wont draw this for me... I dont know why. I used a script i put in an EDIT. – 71GA Apr 23 '13 at 09:10
  • Well, you should at least edit the '/path/to/output.png' string... anyway, if you just use the line plot [-11:10] 30*exp(2*x)+3*exp(-2*x) it will plot to a new window, and not to a file. – A.P. Apr 23 '13 at 09:44
2

For $|x|$ large, one or the other of the two functions will be very close to zero. Here is the syntax to get a representative plot in Wolfram Alpha: plot 30*exp(2*x)+3*exp(-2*x) from -3 to 2.

vadim123
  • 82,796
1

I am not sure exactly what is going wrong with your function, but you may be interested in the very similar and closely-related graph of the function defined by $$\cosh(x)=\frac{1}{2}(e^x+e^{-x}).$$ This is known as hyperbolic cosine (see here for more info), and you can see the graph here.

Coffee_Table
  • 2,909
0

It is parameterised form of the function $f(t)=30t+\frac{3}{t}$ for $t>0$.

J.E.M.S
  • 2,608
  • 1
  • 19
  • 32