Question Sheet 5 - Challenge Problem Example Answers

1. Search the helpfile for the TimeUsed[ ] command. Use this to determine how much longer Mathematica takes to compute  (d/dx)2x using ‘==’ compared with the command Dt[ ].

t0=TimeUsed[](*we record where we start timing from*)

We then run our first calculation

t1=TimeUsed[](*we then record how much time has passed*)

Dt[2x,x](*carry out our second calculation*)

t2=TimeUsed[](*and again record the time that has passed*)

Time for second method:

t2-t1

Time for first method:

t1-t0

We therefore see the using ‘==’ takes around 0.67 seconds, which doesn’t seem long until we see that using Dt[ ] evaluates it almost instantly. This effect is magnified as our calculations become more complex.

(Hint: use TimeUsed[ ], before and after using both commands.)

2. In the screencast we introduced the Dt[ ] command. Search the helpfile for the D[ ] command. What is the difference between the Dt[ ] and D[ ] command?

Dt[ ] takes the total derivative of a function:

Dt[x*y,x]

Whereas D[ ] records the partial derivative of a function:

D[x*y,x]

3. Calculate (∂_x)(∂_y)sin(2x)sin(y).
 [Note that the notation (∂_x), is equivalent to (∂/(∂x)).]

D[Sin[2x]Sin[y],x,y]

4. Calculate ((∂_x)^2)((∂_y)^2)sin(2x)sin(y).
 [Note that similarly to above, the notation ((∂_x)^2), is equivalent to ((∂^2)/(∂(x^2))).]

D[Sin[2x]Sin[y],{x,2},{y,2}]