CHAPTER 5Functions

Even though Mathematica comes with thousands of predefined functions, it is extremely important to know how to define our own functions. While a simple function might be defined in a single line of code, more complicated functions might take dozens of lines assembled together in a Module. In this chapter we’ll see how to define our own functions. We’ll also learn the basics of elementary programming which can be used to turn any mathematical algorithm into a working Mathematica function.

5.1 Defining Functions

Sometimes we may be using the same function over and over again and it can be handy to give the function a name. For example, suppose we were computing things related to home mortgages and repeatedly found ourselves computing ...

Get Mathematica DeMYSTiFied now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.