## How Do You Graph An Absolute Value Function in Desmos and WolframAlpha?

Graphing an absolute value function can be a bit deceiving. Depending on the technology you use, the graph you get may not actually represent the function well.

Let’s graph the function

using WolframAlpha and Desmos. These two online graphing tools are both free to use and can produce excellent graphs.

To graph this function in WolframAlpha, go to the website and type this in the box on the screen.

Both the numerator and denominator need to be in parentheses. The absolute value function in WolframAlpha is “abs”. Putting this in front of (x+4) means the absolute value of the quantity x + 4.

The graph consists of a horizontal section at y = -1 and another at y = 1. These sections are connected by a vertical line at x = -4. This is problematic since this is not a function…it does not pass the vertical line test at x = -4.

Let’s try graphing this function in Desmos.

As shown in the video above, the graph of this function looks like this in Desmos.

This looks similar to the WolframAlpha version, except that the tow horizontal pieces are not connected. As noted in the video,

is undefined at x = -4. This is because x = -4 causes the denominator to be zero.

This might not seem like a big deal. But if you were determining whether the function was continuous at x = -4, the two graphs would lead to different conclusions. The WolframAlpha graph would lead you to think the function is continuous. Desmos would give the opposite conclusion.

In this case, Desmos gives a more accurate graph since it shows the discontinuity at x = -4. An even better version of this graph would be to include open circles at x = -4.

This not only shows the discontinuity, but also indicates that the function is undefined at x = -4. To put these on the graph I downloaded the image and then added the circles in an image editing program like Paint.

## How To Graph a Piecewise Function in WolframAlpha?

In an earlier post, I showed you how to find a piecewise function for Alabama state income taxes.  Often you need a quick graph of the function…maybe something that WolframAlpha can do.

## How Do I Write Down a Piecewise Function For Postage?

In of April 2015, the US Postal Service established new postal rates for first class mail. The postage charged for first class mail is a function of its weight. The US Postal Service uses this table to describe the rates.

Problem Convert this table to a piecewise defined function that represents first class postage for letters weighing up to 3 ounces, using x as the weight in ounces and P as the postage in cents.

Solution This one always causes many questions. I suggest trying a bunch of different inputs (weights) and seeing how it works…then try to come up with the formula.

So, I created a table of possible weights. I made sure to include weights that were fractions of an ounce (something other than 1, 2, or 3). This allows us to understand what that phrasing means.

Now let us try to add in some corresponding postage amounts. Suppose a letter weighed 0.5 ounces. It would fall into that first part of the function “First ounce or fraction of an ounce”. So it would cost 49 cents. The same would be true of a letter weighing 0.75 or 1 ounce…both would cost 49 cents. We can add some numbers to the table.

In fact, any letter weighing 1 ounce of less (and greater than 0) would cost 49 cents.

Now what happens when the letter weighs a little more than 1 ounce? For a letter weighing 1.5 ounces, the first ounce would cost 49 cents and since the letter falls into another “additional ounce or fraction of an ounce”, the total cost would be  49 + 22 = 71. Any letter weighing more than 1 ounce up to 2 ounces would have the same exact cost, 71 cents. Now we can update our table:

As soon as we increase the weight to the next ounce, another 22 cents is added. So a letter weighing 2.5 or 3 ounces would cost 49 + 22 + 22 = 93.

The key thing to note is that for each ounce, the postage stays constant until the next ounce. The correct piecewise function needs to take this into account.

Start your piecewise function with where the pieces are valid:

Each piece corresponds to where the postage is constant and were the rates change. For instance, at x = 1, the postage changes from 41 to 71 cents since we have gone to a new ounce. In each weight interval, the postage is constant according to the table. This give us the function

A graph of the postage function P(x) looks like the one below.

## Death and Piecewise Functions

Although this may seem a little gruesome, it is not uncommon for businesses to give discounts for volume sales. In this case, a mortician charges less per pound for bodies weighing more than a certain amount.

The local mortician charges by the pound for embalming according to the following table:

Find a piecewise linear function that models the cost as a function of weight.

## Piecewise Functions and Taxes

Most states in the US have some type of graduated income tax. This means that as your taxable income increases, the higher amounts of income are taxed at a higher and higher rate. There are several ways to express the relationship between taxable income and the corresponding amount of tax. In the state of Arizona, the instructions for Form 140 includes the table above for individuals filing single or married and filing single.