Vous êtes sur la page 1sur 4

# Lab 1 Assignment

Instructions
Welcome to your first Lab Assignment. The purpose of this assignment is to assess your knowledge of the
basics of Mathematica. Please refer to Lab 1 Introduction if you have problems with any of the questions.
Here are some things to remember as you complete this first assignment:
1. Save the notebook to your computer right away, and save your work often.
2. When you have finished all the exercises, close any unnecessary cells and save as a PDF.
3. Upload the PDF on Canvas.
4. Do not delete this notebook. Save all your work until after the semester is over and your final grade has
been issued.

## Question 1: Using Cells

a) Right below this cell create a text cell. In the text cell, type your first and last name.
Matthew Musallam
b) Right below this cell create a math input cell. In it, take the number of letters in your last name and
subtract the number of letters in your first name. Evaluate the cell and show the output.

## Question 2: Free Form Input

a) Use free form input to solve the equation cosHxL =

1
2

for x.

Cos@xD

1
2

SolveBCos@xD

1
2

, 8x<F

p
3

p
3

## + 2 p C@1D, C@1D IntegersF>>

b) Verify the result by calculating the cosine of your solution from part a, i.e. calculate Cos@answerD. If you
get multiple answers, choose one to test.

## Printed by Wolfram Mathematica Student Edition

Lab 1 Assignment.nb

1
2

c) Find the numerical value of cosH2L. Express your answer in decimal form.

-0.41614683654714238699756822950076218976600077107554

a) Using the documentation center, research the command Solve. Copy the first example presented in the
documentation center and paste it directly below this cell.
Solve@x ^ 2 + a x + 1 == 0, xD
::x

1
2

-a -

- 4 + a2

>, :x

1
2

-a +

- 4 + a2

>>

## b) Edit the example from part a to solve the polynomial 2 x 2 + x + 2 = 0.

::x

1
4

I- 1 -

15 M>, :x

1
4

I- 1 +

15 M>>

c) Use the documentation center to research the command Log. Directly below this cell, create a math
input cell that calculates the numerical value of the natural log of 3. Present your answer as a decimal.

Log@3D

N@Log@3DD
1.09861

## Printed by Wolfram Mathematica Student Edition

Lab 1 Assignment.nb

N@Log@3DD
1.09861

## Question 4: Mathematica Syntax

a) Create a text cell directly below each math input cell that describes the error in the following examples.

Sin@2D

N@Sin@2DD
0.909297

## There is no equals sign.

Plot@Sin HxL, 8x, - 2, 2<D
1.0

0.5

-2

-1

-0.5

-1.0

## There is not supposed to be paranthesis. There is only supposed to be brackets.

N@pi, 15D
pi

Question 5: Visualizations

a) Define f to be the function x 2 - 4 x - 1. Plot the function f HxL, f HxL + 2, and f HxL + 4 from x = -2 to x = 2
and show all three together using the Show[ ] command. Note, to see all the functions properly you will need
to use the PlotRange option for the Show command. Refer to the Documentation Center if you need help
with this option.

## Printed by Wolfram Mathematica Student Edition

Lab 1 Assignment.nb

b) Create a text cell directly below this cell and describe what the plot of f @xD + b would look like if b was
some positive number.

f - 1 - 4 x + x2
Plot@8x, x + 2, x + 4<, 8x, - 2, 2<D

-2

-1

-2