2
$\begingroup$

I have a piecewise function consisting of:

  • A linear function :

    $f(x)=x + 58$ if $x\le6$

  • An exponential base function:

$$f(x) = 2^x\text{ if }x>6$$

The values of the exponential function are obviously much greater than those of the linear function, so how do I pick the best scale that can accurately display both functions on the same graph?

I realize that it's impossible to show both perfectly but how would you calculate the best scale? I would prefer a general solution for all situations like this (graphing sections with large differences on the same graph).

Note this doesn't only apply to piecewise functions but any functions with large diff. in values. For example try graphing the points ${0,1,2,3,4}$ from $f(x) = 10^x$. (a difference of 9999 between the first and last point!)

I am not talking about breaks. In a continuous function, I cannot show a break in scale because this gives an inaccurate model of the graph.

Also note I am referring to graphing by hand not calculators which automatically calculate the scale.

$\endgroup$
4
  • $\begingroup$ Normally a semi-log plot is used in these cases. $\endgroup$ Jul 10, 2012 at 17:12
  • $\begingroup$ Instead of plotting the function $$f(x)=\left\{\begin{array}{c}x+58\qquad \text{if }x\le 6 \\ 2^{x}\qquad \quad \quad \text{if }x> 6 \end{array} \right. $$ you might plot the function $$g(x)=\left\{ \begin{array}{c} \log _{2}\left( x+58\right) \qquad \text{if }x\le 6 \\ \log _{2}2^{x}=x\qquad \quad \text{if }x> 6 \end{array} \right. $$ $\endgroup$ Jul 10, 2012 at 17:21
  • 1
    $\begingroup$ That's perfect, thanks! Could you post your comment as an answer please? $\endgroup$
    – user26649
    Jul 10, 2012 at 18:46
  • $\begingroup$ OK, I've just posted my comments as an answer. $\endgroup$ Jul 10, 2012 at 19:16

1 Answer 1

1
$\begingroup$

Two ideas indicated in my above comments:

  • Normally a semi-log plot is used in these cases.
  • Instead of plotting the function $$f(x)=\left\{ \begin{array}{c} x+58\qquad \text{if }x\le 6 \\ 2^{x}\qquad \quad \quad \text{if }x> 6\end{array} \right. $$ you might plot the function

$$g(x)=\left\{ \begin{array}{c} \log _{2}\left( x+58\right) \qquad \text{if }x\le 6 \\ \log _{2}2^{x}=x\qquad \quad \text{if }x> 6. \end{array} \right. $$

$\endgroup$
1
  • $\begingroup$ @Riddler You are welcome. $\endgroup$ Jul 10, 2012 at 21:54

You must log in to answer this question.