Switch the screen on/off Go back to last page Go forward one page Find out more details about the advertisement
John Moores University. Main CWIS Site
  

Learn by Example 

Tip 1:

Feeling lazy? Can't be bothered typing some of the examples into Derives' author line?

Then just copy the relevant one-continuous-line of code onto the clipboard, and paste directly into the author line of Derive. For example, follow this link, and either drag, or triple-click, the 'sentence' to highlight, then right-click or ctrl-c to copy to the clipboard (or whatever methods you use to copy and paste).

Tip 2:

As another example of how programming styles can change, earlier versions of Derive required full (that is, lengthy!) names to be typed in, to call the in-built functions. Version 5 now has shorter versions of the same in-built function names, or two versions of the same name; for example DIM() or DIMENSION(). The following are the same thing:

a := [1, 2, 3]

DIM(a)=3

DIMENSION(a)=3

To extend this idea, we can even change the names of Derive's in-built functions, if we wish. For example, suppose we use the Derive in-built function EIGENVALUES(a) frequently: we could make life easier by re-naming as follows:

evals(z) := EIGENVALUES(z)

Hence, (approximating, in this case. Note, also, the different argument name z to variable name a , to avoid confusion); 

evals(a)

[5.372281323, -0.3722813232]

As another example, Derive uses the in-built function PHASE(z) to measure the angle between a line, from z to the origin, and the positive x-axis. This is also known as the argument of z, or arg for short. Hence, as per the above eigenvalues example, we could say:

arg(z) := PHASE(z)

Another favourite is the use, in programming, of the identity_matrix() function. Suppose we are writing a programme which requires an nxn identity matrix, so to reduce our typing practice considerably, we could say:

i(n):=IDENTITY_MATRIX(n)

Beware, though: do not confuse the i above, with the SQRT(-1)=î.