You are on page 1of 4

Math
1B
–
A.

Brown


Mathematica
Lab
#4


This
assignment
will
walk
you
through
how
to
use
Mathematica
to:


I. Graph
Quadric
Surfaces


I
recommend
that
you
do
this
assignment
in
the
Computer
and
Mathematics
Lab
in

Shuhaw
1733,
where
you
can
get
help
from
the
lab
assistants
and
instructors,
if

necessary.
You
can
work
together
in
groups
of
up
to
three
people.
If
you
do
work

together,
you
only
need
to
turn
in
one
lab
for
each
group
–
just
make
sure
all
of
your

names
are
on
it.


WARNING:
The
trickiest
thing
about
using
Mathematica
is
getting
the
syntax
(all
the

parentheses,
brackets,
commas,
underscores,
etc.)
correct.
Also
note
that
commands

in
Mathematica
are
case
sensitive!
So
pay
very
close
attention
to
the
syntax
and

capitalization
I’ve
used
in
the
instructions
below.


I.

Graph
Quadric
Surfaces


In
Section
12.6,
we
learned
how
to
sketch
quadric
surfaces.
As
we
discussed
in
class,

Mathematica
can
be
an
extremely
useful
tool
when
trying
to
visualize
these
surfaces.


Begin
by
opening
a
new
Mathematica
notebook.


In
Mathematica
Lab
3,
we
learned
how
to
use
the
Plot3D
command
to
graph
planes.

This
is
also
the
command
I
used
in
class
when
illustrating
various
graphs
of
quadric

surfaces
in
Mathematica.
Recall
that
the
Plot3D
command
works
as
follows:


Plot3D[f(x,y),
{x,
xmin,
xmax},
{y,
ymin,
ymax},
AxesLabel
‐>
{x,
y,
z}]


where
f(x,y)
is
the
stuff
that
z
equals,
and
you
choose
your
xmin,
xmax,
ymin,
and

ymax
to
give
you
a
good
viewing
window.


Quite
often,
your
quadric
surface
equation
is
not
pre‐solved
for
z.
For
example,
let’s

x 2 y 2 z2
say
that
you
want
to
graph
 − − + = 1.
By
examining
the
traces
on
the
xy‐,
xz‐
9 4 36
,
and
yz‐planes
(and
planes
parallel
to
these,
as
necessary),
you
will
(hopefully)

recognize
this
as
a
hyperboloid
in
two
sheets.



If
we
want
to
graph
this
surface
in
Mathematica
using
the
Plot3D
command,
I’ll
need

2 2
x y z2
to
solve
 − − + = 1
for
z
first.
Instead
of
doing
this
by
hand,
let’s
have

9 4 36
Mathematica
do
it
for
us
using
the
Solve
command.
Solve
your
equation
for
0,
then

enter
it
in
as
follows:



Math
1B
–
A.Brown


Solve[‐x^2/9
‐
y^2/4
+
z^2/36
‐
1
==
0,
z]


Note
the
double
equal
sign
(==).
The
variable
at
the
end
is
the
variable
you
want

Mathematica
to
solve
for.


If
you’ve
entered
the
Solve
command
correctly,
Mathematica
should
return
the

following
statement:


{{z
‐>
‐6
Sqrt[1
+
x^2/9
+
y^2/4]},
{z
‐>
6
Sqrt[1
+
x^2/9
+
y^2/4]}}


Notice
that
we
have
two
solutions
for
z,
one
positive
and
one
negative
(which
makes

sense,
since
z
was
squared
in
our
original
equation).
One
of
these
is
the
top
half
of

our
surface,
and
the
other
is
the
bottom
half.
We
want
to
graph
them
together,
so

we’ll
adjust
our
Plot3D
command
in
the
following
manner:


Plot3D[{‐6
Sqrt[1
+
x^2/9
+
y^2/4],
6
Sqrt[1
+
x^2/9
+
y^2/4]},
{x,
‐10,




10},
{y,
‐10,
10},
AxesLabel
‐>
{x,
y,
z}]


Note
the
extra
pair
of
curly
braces
{
}
around
the
two
expressions
for
z,
which
are

separates
by
a
comma.
As
a
quick
tip,
just
copy
and
paste
the
statements
for
each
z
–

you
don’t
need
to
type
them
in
manually.
Make
sure
to
copy
only
the
information

following
the
arrow
after
z.


Alternatively,
you
can
use
the
ContourPlot3D
command.
With
this
command,
you

don’t
need
to
solve
for
z
first.
However,
note
the
double
equal
sign
notation:


x 2 y 2 z2
ContourPlot3D[ − − + == 1,

{x,
‐5,
5},
{y,
‐5,
5},
{z,
‐5,
5},
AxesLabel‐>{x,y,z}]

9 4 36

Now
use
Mathematica
to
help
you
with
the
following
problems.
In
addition
to
using

Mathematica
to
create
any
necessary
graphs,
be
sure
to
type
your
answers
to
my


questions
into
your
workbook
so
I
can
read
them
when
I
review
your
work.
Make

sure
to
label
your
answers
with
the
question
numbers.


1. What
kind
of
quadric
surface
is x 2 + y 2 − z 2 = 1?


a. If
we
change
the
equation
above
to
 x 2 − y 2 + z 2 = 1,
how
does
the

graph
change?



b. If
we
change
the
equation
to
 x 2 + y 2 + 2y − z 2 = 0 ,
how
does
the
graph


change?


2. What
kind
of
quadric
surface
is −x 2 − y 2 + z 2 = 1?



Math
1B
–
A.Brown


a. If
we
change
the
equation
above
to
 x 2 − y 2 − z 2 = 1,
how
does
the
graph

change?


3. What
kind
of
quadric
surface
is 4 y 2 + z 2 − x −16y − 4z + 20 = 0 ?



Math
1B
–
A.Brown



II.
Lab
Submission
Instructions


4.
Make
sure
you’ve
completed
steps
1‐3
(see
above).


5.
Remove
any
superfluous
lines
(wrong
commands,
things
that
didn’t
quite







work,
or
your
experiments).
You
can
remove
them
by
selecting
the
bar
on
the







right
and
pressing
the
Delete
key.


6.
Save
your
Mathematica
file.
Include
your
name
in
the
file
name.
(Remember,
you







only
have
to
submit
one
copy
per
group
–
just
type
all
of
your
names
in
the







document
or
file
name
so
everyone
gets
credit!)


For
example,
AnnaB_SteveG_1B_Lab4.nb


7.
Submit
your
Mathematica
file
to
me
electronically
by
going
to



https://www2.santarosa.edu/file‐depot/dropbox.php


My
e‐mail
address
is
abrown@santarosa.edu



You might also like