#WeHateMath #DIYMath FreeMat

(Cross-posted at Coding4Humans)

Today in DIY Math we’re looking at  FreeMat. As the name suggests It’s modeled after MatLab. FreeMat has been in development for over a decade by a group of volunteers

System Requirements – Specific hardware requirements were not available but the pre-built packages I tested all run on 32 or 64-bit Intel-compatible CPUs. The application itself doesn’t seem to use much memory. As an example, the Mac version uses about 85 MB of real memory on my system. Since Windows XP is supported, we can assume that XP-compatible hardware constitutes the base system.

Installation – The latest version is 4.2 and is available for Windows (XP and up), Linux (various) and Mac OS X. In addition to pre-built packages for the above platforms, the source code is also available and is released under the GPL license. All versions of FreeMat are kept at the same version level and functionality.

Windows: Simply download the 52.5 MB setup file and double-click it. (NOTE: A portable version of Freemat is also available so you can run it from a thumb drive without installation.)

Linux – I installed FreeMat on Debian Linux using APT and on my system it was a 12 MB download, using an additional 22 MB of disk space.

Mac OS X – The installer is a 79.5 MB compressed disk image (DMG) file. Double-click the file to mount it, then drag the program and documentation to your Applications folder. The two files together take up about 250 MB of disk space.

Documentation – The Mac download comes with a PDF manual detailing all of the functions available in FreeMat. (For Windows or Linux, you can download the manual here.) The manual is automatically generated using Doxygen, which scans specially marked comments in the source code and outputs documentation in a variety of file formats.

This is both a good thing and a bad thing. It’s good in that it makes it easy for developers to actually maintain their documentation, assuming they remember to update the comments. It’s a bad thing because there’s no guarantee that the resulting document will be well-written. In fact, the included manual is very sparsely written, despite the 162 page (!) table of contents. It is less a manual than simply an API reference. Each function or class is briefly described and includes one or two usage examples. The target audience for this manual are those who don’t need a manual. It’s comprehensive but very terse.

A much better option to start with is the FreeMat Primer. Who’s the audience? Let the authors (Gary Schafer and Timothy Cyders) tell you:

We assume that you have Freemat properly installed and working. If you have any issues, direct them to the online Freemat group, http://groups.google.com/group/freemat.

This book was originally written for the Windows version. The book now covers more of the Linux and Mac versions, as well. In those cases where there are differences, we’ll point them out.

It’s a much friendlier introduction to the software. It’s very readable, with plenty of screenshots, little tutorials and code examples. With this and the official function reference you have a very good documentation base. In addition, there is also a Google group available for more interactive support. There is another Google community intended to host FreeMat tutorials. (At this time the content is a bit sparse.) You can also type helpwin at the command prompt from within FreeMat.

Compatibility – Based on the scripts I tested, MatLab support is somewhat hit-or-miss. I’ve been able to run scripts with no modifications, minor modifications or not at all. I would suggest that you test your Matlab scripts on a case-by-case basis and then decide whether you want to make the changes or just re-write from scratch. The scripting syntax is similar enough that most of your work will be figuring out equivalent function calls.  (A MatLab to FreeMat translation guide would be a really good project. Better yet, some kind of conversion tool.)

Command Line vs. GUI – The Windows and Mac versions of FreeMat are targeted at a graphical interface so accessing the tool from the command line is at best a non-trivial . The Linux version can be launched from the CLI. With no parameters, the graphical client starts up by default. To use the CLI version only, start the tool with the option -noX or -nogui to suppress the graphical subsystem This will give you a FreeMat command prompt in your terminal window. If you simply wish to run a Freemat command and then exit, use the option -f to run the tool in command mode. (NOTE: if you want to see the output of your command, make sure to specify that as FreeMat will not show any output.)

Integrating FreeMat with your native scripting environment is problematic (okay, just about impossible),as FreeMat scripts are meant to be run from within the FreeMat interface. You can edit them inside FreeMat or using your favorite text editor but make sure that they are saved to FreeMat’s working directory. (You can set this up by running pathtool from within FreeMat.)

 

The GUI for each version is comparable in look and feel.

FreeMat Interface

FreeMat GUI

This is from the Mac version of the tool. In addition to the main terminal window, FreeMat also tracks your command history (allowing you to invoke a previous command simply by double-clicking on it), tracks what variables are currently in memory, along with their data types and values if applicable. The Debug window is supposed to show any error or warning messages but on all three platforms I tested, the messages showed up in the main terminal window and the Debug window remained blank.

Summary

Pros: Easy installation, all supported platforms are kept current with a common codebase, decent documentation and online support.

Cons: Development progress is a bit slow. The latest release (4.2) was posted in June of 2013 and that was two years after the previous release. CLI support is limited or non-existent in the Windows and Mac versions and all scripts are restricted to running within the FreeMat environment. Third party support is a bit anemic.

Would I use this in my class? – I would feel confident recommending this to my students. The ease of installation and minimal setup are a definite plus, you don’t need the latest hardware to run it and the price fits everyone’s budget. It supports nearly everything we might do in 100- and 200-level math classes with enough overhead room for more advanced work.

#DIYMath – Math Wants to be Free

(Cross-posted at Coding 4 Humans)

As a programming and math nerd, I’ve certainly made good use of Wolfram Alpha. After all, it’s free*, it’s ubiquitous (all you need is a Web browser but there are also apps for both Android and IOS) and it’s natural language interface is very powerful and easy to use.  It’s certainly a cost-effective alternative to commercial math packages like Matlab ($50 – $2,150) or even Wolfram’s own Mathematica. ($139 – $2,495)

However, much as I love the folks at Wolfram, it’s nice to have your own math software that:

  • doesn’t require an Internet connection
  • runs on computers you control
  • still gives you a lot of power and flexibility

It’s even better if the software is:

It turns out that there are several software packages that fit the bill, each with their own strengths and weaknesses but all absolutely free and cross-platform. With that in mind, I’m going to be reviewing each of them from the perspective of a teacher and casual programmer. To keep things consistent, I’ll be looking at the following categories:

System Requirements – Because there’s no point downloading the software unless you can actually run it.

Installation – How easy is it to find and install the software? How big of a download is it and how much disk space and RAM does it need? How does installation compare between platforms? I’ll be installing the software on Windows 7, Debian Linux and Mac OS X Mavericks and comparing the experience.

Documentation – Does the developer offer good documentation and/or tutorials? (By ‘good’, I mean documentation you are actually expected to read**.) Is information available from third parties?

Compatibility – Like it or not, MatLab and Mathematica are the big dogs in the math software field. How easily could a MatLab or Mathematica user transition to this package? How easy is it to port code? The easiest way to test this is to see if scripts designed for MatLab or Mathematica will run with minimal or no modification.

Command Line vs. GUI – Some of these packages allow you to run them from the command line as well as in a graphical interface. This is very useful as it allows you to integrate the software with your native scripting language for easy automation. How do the two compare? Do both offer the same functionality? Does the software operate in the same way on different operating systems?

Summary – Pros, Cons and whether I’d recommend this to my students.

As I’ve said, I’m looking at this from the perspective of a math teacher. Are there other aspects of the software you’d like me to examine?

*for a certain definition of ‘free’

**I’ve noticed that a lot of open source software documentation seems to assume that the target audience are those who don’t need to read it. Yes, poor documentation makes me cranky.

#WeHateMath Storytelling in Math Education

Recently my math class was studying basic probability and I had one student who was really having a hard time wrapping her head around the topic. One evening I got an email from them, stating that they didn’t understand one of the practice problems:

Given that P(E) = 1/4 find the odds in favor of E.

I replied:

P(E) means the probability of E happening. 1/4 means that there are four possible outcomes and that E (the one we want) is only one of them.

We figure our odds for something by comparing the number of possible things that we want (in this case just one) versus the number of possible things we don’t (in this case the other three).

So the odds are 1 to 3 that our event E will happen because out of four total, only one of them is E.

I hope this helps.

They responded that it didn’t help and that they had read the chapter multiple times and just weren’t getting it.

I gave this some more thought and decided on a different tactic:

Let me give it one more shot:

We’re having a dog race — four beagles: Evelyn, Sam, Henry and Charlie.

All four dogs are evenly matched – same age, physical condition, everything – so each of them is equally likely to win.

However, Evelyn is your favorite and you’d like to know the probability that she’ll win the race.  There is a total of four dogs so she has one chance in four to win.  In math-speak, this is known as :

P(E) = 1/4

What about the odds? Well, It’s Evelyn against the other three dogs so we say that the odds for Evelyn winning are 1 to 3 or 1:3

Once I had expressed it in the form of a story, it clicked. They replied that they now understood what the problem was about and had a better sense of the material.

 

In my experience, the mere mention of ‘story problems’ (sometimes known as ‘word problems’) is enough to send my students into fits. (Google ‘story problems suck’. This is not an isolated issue.)

But stories are the primary way we humans communicate with each other. I use stories in my classes all the time. Sometimes they’re personal anecdotes (usually of the ‘See what I did there? Don’t do that’ variety), historical references or just something I made up like the example above.

I think that the issue with traditional story problems is that they’re not very interactive. Most seem to be little more than a written statement of the math problem we’re trying to solve.

So maybe we need better stories.

One promising project is Oppia. This is a Google project described as a “Tool for creating interactive educational content”. In other words, you can create a story that guides your student through a topic, periodically asking them to apply what they’ve learned to solve a problem within the context of the story.

You can set up your own copy of Oppia on your own computer to test it, contribute to or browse through the lessons at the official hosted server or just use their test server to see how it works. I played with one of the tutorials and it was very engaging. So head on over there and give it a try, let me know what you think.

#WeHateMath A Better Way to Teach Math?

Ever since I started teaching math, I’ve been trying to figure out why so many students (and non-students) seem to have problems with it and what I could do about that. With that in mind, I’ve been trying different techniques to see which ones are effective.

The first one was what I call the “Age of Aquarius” technique. It usually has me saying things like “Math is the secret language of the Universe” and “We’re all made of math” in an attempt to engage student imaginations. Unfortunately these work best with an audience that is already receptive and math classes are generally full of people who want to be anywhere else. As a result, saying these things makes them think that either you are high or you’re trying to make your job sound more interesting than it is.

I call the second method “Eat Your Vegetables”. This consists of explaining how learning math is good for you, usually by citing the Stanford Medical School study that showed improved brain function from the very act of learning math. In other words, even if you never use this stuff in your real life, it’s the mental equivalent of CrossFit. This also fell flat, being a bit too abstract for a group that just wanted to get through the class with a minimum of effort.

I decided to tackle this from the other end. I wanted to find the source of this distaste for math. I’ve always felt that hate is a fear-based emotion so if I can lower the general anxiety level in the room, I should get better responses.

One technique I used was to use tools to handle the mechanics of problem-solving. For example, whenever convenient I encouraged the use of calculators once the math portion of the problem had been processed. (If you understand the math well enough to explain it to a machine, this is a good thing.) For statistics, I showed how to use spreadsheets to quickly and easily observe the effects of different sample data on results as well as how to create different types of charts to visualize the numbers. For probability, I brought in decks of cards. I used a drawing program to sketch out problems and scenarios.

I also tried to minimize the use of jargon during class. While it’s useful to have a common vocabulary, I wanted students to pay more attention to the relationships and patterns than to worry about coming up with the correct terminology. We introduced terms as needed but it was okay if they had to use a few more words to explain what they were talking about or if they had to draw a picture or diagram.

This was the first term I used these techniques so it’s early days. But my last class session was today and overall I feel quite positive. Several students have remarked that this was the best math class they’ve ever had and my retention rate was pretty good. For math classes, it’s not unusual for half or more of registered students to withdraw before end of term. Out of an initial class of twenty one, I lost just seven and of those, four withdrew before the start of the term.

All in all, a good start. I’m teaching two sections of the same class next term so I’ll continue to refine my techniques and report my data here.

#WeHateMath Calculators Considered Harmful

“For this invention will produce forgetfulness in the minds of those who learn to use it, because they will not practice their memory. Their trust in writing, produced by external characters which are no part of themselves, will discourage the use of their own memory within them. You have invented an elixir not of memory, but of reminding; and you offer your pupils the appearance of wisdom, not true wisdom, for they will read many things without instruction and will therefore seem to know many things, when they are for the most part ignorant and hard to get along with, since they are not wise, but only appear wise.”(Phaedrus 274c-275b)

 

The above quote is Socrates complaining about the invention of the written word. He claimed that allowing students to write down facts instead of memorizing them would weaken their minds.

I’m reminded of this when I see some of the reactions to suggestions that we embrace the use of computer technology in the way we teach math. The most noted advocate for this is Conrad Wolfram, who described his philosophy in a 2010 TED Talk.

My first introduction to technology-assisted math was in my high school chemistry class, where we learned how to use a slide rule. (Yes, I’m thatold.) We didn’t have them in math class (or calculators for that matter) so all calculations was done by hand. I didn’t get my first calculator until I went off to college. As this technology got cheaper and more readily available, it began to filter down towards K-12, where I recall a lot of controversy over allowing their use in class. It was felt at the time that it would make students unable to do arithmetic by hand and therefore become dependent entirely on machines to do it for them.

Back in 1957, Isaac Asimov wrote a short story “The Feeling of Power”, about just that kind of future and how society had to rediscover the technique of doing arithmetic by hand. The comments at this page about this story are…..okay, I’m trying to think of how to say this….well, let’s just say there’s a certain ‘you kids get off of my lawn’ quality to them.

Please don’t misunderstand. I absolutely believe that grade school kids should learn how to do arithmetic by hand, to start. But I don’t believe that it’s as simple as we either do all of our math by hand or become completely dependent on machines.

First of all, I have no problem doing arithmetic using a machine. Arithmetic is a very mechanical activity, which is one of the reasons why teaching it involves so much memorization. It isn’t something that comes naturally to us humans. However, we should be comfortable with arithmetic so that we can visualize what our answer should look like and to make sure the problem was entered correctly.  (I prefer using a text editor to writing by hand. This doesn’t make me illiterate.)

Math, on the other hand, involves intuition, creativity, imagination and logical thinking. Machines can make the arithmetic part of it easier but you still need to understand the problem well enough to explain it to the machine. We teachers don’t have to fear the use of calculators or computers in a math class if we use them intelligently. Where these machines can be used to our advantage is to reduce student anxiety about the mechanical parts of the problem so they can focus on the part requiring human-based thinking.

In my experience, students hate math because they fear arithmetic. They are so scarred by their grade school arithmetic classes where the slightest error in a long chain of arithmetic would ripple down and cause them to get the problem wrong (and fail the test) that they don’t want to be anywhere near any class that reminds them of that.

I encourage the use of calculators (and spreadsheets and Wolfram Alpha) in my college math class. They take away fear and give us more time to actually talk about math.

#WeHateMath Math without Calculations?

I ran across a couple of articles that discuss something that I’ve been pondering (and talking about on this blog) for a while now. That is, teaching mathematics without requiring that students do the final calculations by hand.

Here’s the basic idea. Computation (formulating solutions to problems) is more important now than ever. However, since we have calculators, computers and even Web sites to crunch the numbers for us, doing the calculations by hand is out-of-date and should be de-emphasized.

This idea was recently promoted by Conrad Wolfram, the head of Wolfram Research, which produces the software package Mathematica and the math engine Wolfram Alpha. Here’s an interview with Wolfram where he describes his idea in a bit more detail.

I’m not saying this is a bad idea, but I can see that there are any number of ways for someone to take this in a negative way. It takes a while to think this through for those of us who (like me) were raised and educated in the traditional math curriculum.

I teach undergraduate math, so I’m always on the look-out for ways to improve my classroom content. That means that sometimes I use my classroom as a lab for a little empirical research.

For example, this term I’m teaching College Mathematics. This is a 100-level class aimed at non-technical students (we’re a career college) and my students are in a mix of majors like Medical Assisting, Graphic Design and Business Administration. The course description is as follows:

 

This course develops problem-solving and decision-making strategies using mathematical tools from arithmetic, algebra, geometry, and statistics. Topics include consumer mathematics, key concepts in statistics and probability, sets of numbers, and geometry. Upon successful completion of this course, students will be able to apply mathematical tools and methods to solve real-world problems.

 

So it’s essentially a course in functional numeracy. For most of these students, this is the only math class in their program.

I decided to test the theory that the thing most people who claim to hate math actually hate arithmetic. My personal opinion is that arithmetic is unnatural and mechanical (since the learning strategy consists of memorization) and that math places more emphasis on creativity, intuition and critical thinking. With this in mind, on my first day of class I did the following:

  1. Explain the difference between math and arithmetic.
  2. Set a policy of ‘no arithmetic by hand, unless it’s absolutely convenient’. (For example, I’m not going to grab a calculator to multiply 9 by 5.)

For each session, I start with a “Math Minute” where I present a short puzzle or thought experiment to get students thinking and discussing some math concept. For the rest of the period I discuss this week’s subject (I can’t change the text or the lesson plan). However, I keep the conversation focussed on concepts rather than calculation. When we work through problems, we spend most of the time thinking through the set-up and then use a calculator (or spreadsheet or Wolfram Alpha) to get the answer. (This is only for problems where the calculation isn’t obvious. See 2 above.)

As you can see, I haven’t made any big changes (evolutionary, not revolutionary). I still have to pay attention to different student learning styles, encourage group participation, share problem-solving tricks and all of the other classroom techniques I’ve been using for years now.

As expected, there was some resistance. I was taking an unusual approach by de-emphasizing those parts of a math class that are traditionally the focus. But overall the response has been positive.

Now I don’t think that all classroom math should be abstracted to machines. In my class, we still use decks of cards and dice to talk about probability, count floor tiles to think about surface area and lots and lots of whiteboard work complete with diagrams. The point is to get students to connect with math and I’m just shifting that connection to the problem set-up process and I’m a fan of whatever works.

 

#WeHateMath Book Review – Mathematics for Information Technology

Today I’m looking at “Mathematics For Information Technology“, a textbook that I was assigned to teach a brand new class at our school, Technical Math. The course description reads as follows:

This course covers mathematical topics related to information technology using applied techniques. Topics include sets, logic, graphs, hexadecimal and binary numbers. Upon successful completion of this course, students will be able to apply mathematical set logic to technical problems, create graphs applicable to information technology, and manipulate binary numbers.

When I first saw the book, I was intrigued by the title. It sounded like the solution to a problem, like “Physics For Poets” or “Rocks For Jocks“. The problem is that, unlike poetry-writing

or sports, information technology (or IT as we nerds prefer to call it) covers a broad range of activities, from data networking to computer programming to digital forensics. So, as an IT guy and a math guy, I was intrigued to see how the authors were going to thread this particular needle.

The short version: The book’s title writes a check that the text inside can’t cash.

To be fair, it makes a solid attempt. Here’s a list of the contents:

  • Chapter 1 – Sets
  • Chapter 2 – Logic
  • Chapter 3 – Binary and Other Number Systems
  • Chapter 4 – Straight-Line Equations and Graphs
  • Chapter 5 – Solving Systems of Linear Equations Algebraically and with Matrices
  • Chapter 6 – Sequences and Series
  • Chapter 7 – Right-Triangle Geometry and Trigonometry
  • Chapter 8 – Trigonometric Identities
  • Chapter 9 – The Complex Numbers
  • Chapter 10 – Vectors
  • Chapter 11 – Exponential and Logarithmic Equations
  • Chapter 12 – Probability
  • Chapter 13 – Statistics
  • Chapter 14 – Graph Theory

The writing style strikes a good balance between the overly pedantic style of some math books that are more about vocabulary and others that make embarrassing attempts to be ‘perky’ and ‘fun’. I appreciated the way that the authors started with a discussion of sets, which stands as a good foundation for the rest of the text. This also provides a nice segue into the following chapter on formal logic, which is another topic I wish made it’s way into more math classes. In addition, while the book covers a wide range of mathematical concepts, the chapters are written to be mostly standalone, so you can easily structure your class around the text. In addition, since it covers such a broad range of topics, it makes a good mathematical reference.

Unfortunately, the book falls short when it comes to connecting the math to actual IT topics. The chapter exercises are the usual problems you find in a math book and there isn’t even a token attempt to tie in the chapter topic to it’s role in information technology. When I taught the class, this job was left to me. In addition, the breadth of topics meant that no one area could be dealt with in any sort of depth.

All in all, this book is a mixed bag. While the authors should be commended for attempting a difficult task and they do a better than average job, the results fall short of expectations.

References

Basta, A., DeLong, S., & Basta, N. (2014). Mathematics for information technology. Clifton Park, NY: Delmar, Cengage Learning.