I highly recommend that you install Mathematica and use it while you study and work on examples sheets (in many courses). I personally use it on almost a daily basis.
You can download a free copy:
http://www.maths.cam.ac.uk/computing/software/mathematica/
It is very easy install and learn to use. The time you spend learning to use it (and similarly MATLAB) is a very good investment.
http://www.maths.cam.ac.uk/undergrad/catam/software/matlabinstall/matlab-personal.htm
Here is a Mathematica program for Example Sheet 1, #15.
(* POLYA URN *)
You can download a free copy:
http://www.maths.cam.ac.uk/computing/software/mathematica/
It is very easy install and learn to use. The time you spend learning to use it (and similarly MATLAB) is a very good investment.
http://www.maths.cam.ac.uk/undergrad/catam/software/matlabinstall/matlab-personal.htm
Here is a Mathematica program for Example Sheet 1, #15.
(* POLYA URN *)
{w, b} = {1, 1}
For[i = 1, i <= 50, i++, {
For[j = 1, j <= 1000, j++, {
m = RandomInteger[{1, w + b}];
If[m <= w, w = w + 1, b = b + 1];
}]
Print[w/(w + b) // N];
}]
For[i = 1, i <= 50, i++, {
For[j = 1, j <= 1000, j++, {
m = RandomInteger[{1, w + b}];
If[m <= w, w = w + 1, b = b + 1];
}]
Print[w/(w + b) // N];
}]
Max, front with iPad · 579 weeks ago
You seem to reference your Mathematica code on a fairly regular basis, I've been using the language for a few months now and was wondering if you have any suggested reading material or similar on how to become more proficient?
Many thanks!
Max
Richard Weber 35p · 579 weeks ago
I think that it is often best to start with a program that someone has written for a similar task to the one you would like to accomplish, and then adapt it to your own purposes. You can begin to understand the syntax of the computer language by context, and by using the help guides. Mathematica has fantastic online help. You can search for keywords, and learn by reading the help. The help includes lots of code snippets as examples to who you what can be done.
For example, if you wanted to learn how to represent a matrix in Mathematica and find its eigenvalues you could begin by bringing up the Documentation Centre searching for the keyword Eigenvalues. That will bring up a page from which you can learn a lot by studying the examples.
You only need to know a subset of Mathematica to get started. The first things to know are some calculating functions (like Factorial, Random, Sin, Cos, Integrate), some algebraic manipulation functions (like Simplify, Factor, Expand, Series), and then control structures (like For, If and Do). There are advanced things such as functional programming, which use Map, Apply, etc. But there is no need to learn about these at the start.
I started programming for the first time in about 1969, when I got hold of a manual for Fortran 66. In those days it was paper tape and punch card input. In 1983 I bought a BBC micro and wrote Basic and 6502 machine code. Today's personal computers and high level languages, like Matlab and Mathematica, are truly amazing in their power. They are great experimental tools for mathematicians. I have frequently used these tools to find counterexamples to conjectures. At least three times I have written a research paper in which the proof of a theorem was completed or greatly assisted using a computer program. Last year a refereed a paper in which the authors had covered two pages with algebraic workings. I wrote, "why bother?" (The same thing could be found in one line of Mathematica code.) There are some unsolved problems that I return to every few years simply in the hope that with a more powerful computer I can make new progress.
I am enthusiastic about the use of computing in mathematics. Of course that is quite natural in my field of Operations Research. When mathematics is used "in anger" to find efficient ways of organizing and optimizing real-life complex systems then that almost always means writing a computer algorithm to carry out some mathematical task.