Some sample questions for test 1.

calculator

Evaluate each expression. For each, write the answer and the julia commands you used to produce the answer:

*

$$~ \frac{\sin(x) + \cos(x)}{\sin(x) - \cos(x)}, \text{ when } x = 1. ~$$

*

$$~ \sin^2 \left(\frac{x - 2\pi}{x + 2\pi}\right) \text{ when } x = \pi/4. ~$$

Order of operations

Which of these three expressions will be different from the other two?

Integers can cause some issues.

Are these expressions identical

Floating point can cause small issues.

Are these expressions identical?

Defining functions

For each function, write a function in Julia and compute $f(1/2)$. For each, your answer should have the command to define the function and the value at $1/2$.

*

$$~ f(x) = \begin{cases} x^2 & x < 1\\ x & \text{otherwise} \end{cases} ~$$

Plotting