## Mathematica…

One of the reasons that I started this blog was so that I could mess about with embedding some Mathematica files to help with testing out some ideas.  For this to make sense it’s easiest if I embed a few simple examples in this blog post.  Now if you want to interact with these examples, I’m afraid you’re going to have to download the Wolfram CDF player, which is completely free and works on PC’s and Mac’s alike.  Imagine it as a sort of PDF viewer but it lets you interact with the files as opposed to a PDF which is typically just a static and lifeless document.

Consider the following equation:

$Sin\left( {2x} \right)$

Most text books would draw the graph for this over whichever range they deemed to be suitable and then students would try and learn from these dull and boring diagrams.

[WolframCDF source=”https://dl.dropboxusercontent.com/u/22612196/Wordpress_Test5.cdf” width=”653″ height=”405″ altimage=”” altimagewidth=”https://dl.dropboxusercontent.com/u/22612196/Wordpress_Test5.png” altimageheight=””]

Now this is how I was taught maths and in fairness, it’s pretty dull and it’s difficult to gain any form of intuition as to how it might behave if the 2 became a 3 for example, this is where Mathematica’s CDF files come in handy because it has some nice tricks for letting you explore maths in an interactive fashion… let’s consider the following equation, from the previous graph most people wouldn’t really know how it would affect the graph.

$Sin\left( {a.{\rm{ }}x} \right)$

But if we crank this through Mathematica we can create a really nice interactive widget that can be shared with anyone for free!  As you change the slider, the graph updates in real time, and if you want to know what number you’re changing ‘a’ to be then simply click the little + sign next to the slider itself to expand the input values beneath it.  In fact if you think that messsing with sliders is far too much like hard work, then simply click the little play button in the top right and the widget will work the sliders for you… sit back and watch the pattern.

[WolframCDF source=”http://dl.dropbox.com/u/22612196/Wordpress_Test4.cdf” CDFwidth=”752″ CDFheight=”574″]

If you’re not familiar with Mathematica, you may be concerned that this sort of widget is really difficult to create, but actually I’m still on Chapter 3 on the text that I’m working through and the code is incredibly simple to create this kind of interactive learning tool and I’ve replicated it below to show how few lines of text can create this level of interaction.

Manipulate[ Plot[ Sin[a x], {x, -10, 10}], {a, 1, 5}]

Essentially this code starts with “I want a slider widget”, “Plot me a graph of Sin(a.x) over a range of values for x from -10 to 10”, then “make the slider vary a from 1 to 5”.

Now this seems ok, but the Manipulate command is actually incredibly powerful and with a little more twiddling, high quality interactive 3D plots can be created, so let’s consider the following expression.

$f{\rm{ }}Sin\left( x \right) + g{\rm{ }}Sin\left( y \right)$

This expression has four variables: f,g,x, and y.  Of course, I bet you’re dying to know what the graph looks like for this function so you can boost your maths skills…

[WolframCDF source=”http://dl.dropbox.com/u/22612196/Wordpress_Test3.cdf” CDFwidth=”752″ CDFheight=”758″]

This is where the CDF player starts to flex its muscles a little, not only can you mess around with the sliders to change the values of f and g… but you can click and rotate the 3D graph itself to get a better view of how you think it’s working.  For me this level of interaction is a real opportunity for playing with the maths to help build up a level of intuition and feeling of how the maths will behave.  And once again the code to get it to work is fairly straight forward even for a novice such as myself.

Manipulate[Plot3D[(f ) Sin[ x] + (g)  Sin [y], {x, 1, 10}, {y, 1, 10}], {f, -10, 10}, {g, -10, 10}]

Now here’s the rub, a full Mathematica licence is the best part of £1,000 for a lecturer to use, in these hard times that’s a lot of money.  But because I carry ‘dual’ status as I’m studying 2 degrees as well as working full time as a lecturer I was able to pick up a student licence for roughly £80.  Normally the cost for a student licence is a shade over £100 but it is possible to reduce the normal student price by 15% by using the discount code PD1637 at the Wolfram store checkout and I still retain the full functionality of sharing my CDF files via export.

I hope this helps someone, if you’ve any feedback on this post or would like to ask any questions, please get in touch or leave a comment below.

• May 23, 2012 - 02:54 | Permalink

I know this if off topic but I’m looking into starting my own blog and was wondering what all is needed to get setup? I’m assuming having a blog like yours would cost a pretty penny? I’m not very internet smart so I’m not 100% sure. Any suggestions or advice would be greatly appreciated.
http://www.KneeNeckBackPain.com/

• Neil
May 23, 2012 - 07:32 | Permalink

I use the WordPress software via self hosting which is free. The only costs incurred are for the webspace itself which requires a PHP and a SQL server to be enabled. The instructions over at WordPress are pretty straight forward and you can use them to help you identify what sort of Web hosting you need… Good luck!

• May 26, 2012 - 02:33 | Permalink

Sorry for my bad english. Thank you so much for your good post. Your post helped me in my college assignment, If you can provide me more details please email me.