Graphing with Mathematica

Example 1:
  This is a mathematical model for a voting situation.  If x is the proportion of the popular vote going to the Democratic presidential candidate, then the proportion of the seats in the House going to Democratic candidates is approximately given by the following function.

Note how we define a function, with the square brackets and the underscore.

"Graphing_1.gif"

"Graphing_2.gif"

Always check that what Mathematica outputs for your function definition matches what you intended your function definition to be.

Here is how you graph a function.  Note how you specify the range of x values used in the graph.

"Graphing_3.gif"

"Graphing_4.gif"

Interesting questions, while looking at this function:  What does it mean that f(0.5) = 0.5?  What does the curvature tell us?

Partial answers:  If the proportion of the vote x going to the Democratic presidential candidate is greater than 0.5, then the proportion of the seats in the House going to Democrats is even greater than x.  Similarly, if x is smaller than 0.5, then the proportion of the seats going to Republicans gets amplified.

Example 2:  Graph the following function.

"Graphing_5.gif"

"Graphing_6.gif"

"Graphing_7.gif"

"Graphing_8.gif"

Example 3:  A similar polynomial function is the following.

"Graphing_9.gif"

"Graphing_10.gif"

"Graphing_11.gif"

"Graphing_12.gif"

If you want to find the x-intercepts (the zeros of the function), you can solve to see where the function value is zero:

"Graphing_13.gif"

"Graphing_14.gif"

These numbers match with where the x-intercepts seem to be in the graph, so we are pretty sure that we have the right answers.

Example 4:  Suppose that the number of bacteria infecting a person after time t (when t = 0 is the moment of initial infection
and time is measured in hours) is given approximately by the following function.  Suppose also that the number of bacteria
is given in millions.

"Graphing_15.gif"

"Graphing_16.gif"

Graph and find the approximate maximum.

"Graphing_17.gif"

"Graphing_18.gif"

The max value is about .51, representing 510,000 bacteria, at about time t = 1.4 hours.
Elsewhere we look in detail at how to find maximum and minimum points with Mathematica.

Example 5:  Let's graph a higher-degree polynomial than above.  Also find the zeros.

"Graphing_19.gif"

"Graphing_20.gif"

"Graphing_21.gif"

"Graphing_22.gif"

We can estimate where the x-intercepts are from the graph.  However, let's use NSolve to find more accurate answers:

"Graphing_23.gif"

"Graphing_24.gif"

Note that the third and fourth numbers in the output are complex numbers.  Since these 2 are not real numbers, they cannot give x-intercepts (as x-intercepts are on the real number line).  Thus we found three x-intercepts.  They seem to fit reasonably with the three spots where the above graph intersects the x-axis.

Example 6:  Let's graph a rational function:

"Graphing_25.gif"

"Graphing_26.gif"

Note carefully how we used parentheses in order to get the desired function.  If you leave them out you get a vastly different function:

"Graphing_27.gif"

"Graphing_28.gif"

That is not the function we want, so we will ignore function w and use function t.

"Graphing_29.gif"

"Graphing_30.gif"


Created by Wolfram Mathematica 6.0  (09 January 2008) Valid XHTML 1.1!