Simplify

Often when coding in Mathematica, we will make errors or ‘typos’ in our code. A key skill to develop is efficiently identifying where mistakes are. Be sure to apply the following principles:

1. Do not spend too long on any one problem.
2. Work together - often someone else will be able to spot a mistake that you cannot.
3. If you struggle to solve a problem move on and come back to it, having fresh eyes often helps.

Question 1

1. Correct the code below. There are 3 changes to make.

integrate[Sin[2πy],{0,1}]

Use either the maths palette or the shortcut shown in the video to correct the code below to show ((sin(x) - 3)/(5+cos(x)))

Sin[x]-3/5+Cos[x]

Question 2

One technique to finding an error in a piece of code is by testing each part of the code separately. In this case, there is either a problem with the simplify command or the integrate command (or both).

Simplify[Integrate[Sin[2π*n*x],{x,0,1}],Element[n,Integer]]

a) Firstly, we can check to see if the Integrate command has been input correctly. We can do this by copying and pasting it, and then evaluating it separately. Do this below and if necessary make any changes.

b) We now want to test Simplify. To do this replace the integrate command with something ‘simple’. An example would be (n^2). We do this because it is much easier to be sure that we have typed '(n^2)’ in correctly than a longer command such as integrate. Make any necessary changes.

Simplify[Integrate[Sin[2π*n*x],{x,0,1}],Element[n,Integer]]