Feeds:
Posts
Comments

Posts Tagged ‘mathematica’

A friend gave me this problem a couple of weeks ago:

What is the longest word you can type on the QWERTY keyboard with just your left hand using the proper position?

I love problems like this.

Especially because I get to toy around with Mathematica and use features that day to day I may not interact with for biz problems.

Finding the solution required only a tiny bit of code.

alpha = “”;
ourdictionary = “”;
alphabase = {“q” | “w” | “e” | “r” | “t” | “a” | “s” | “d” | “f” | “g” | “z” | “x” | “c” | “v” | “b”};
alpha = StringExpression[alpha, alphabase];

Code

n = 0;
dictionarycount = 0;
ourdictionary = DictionaryLookup[alpha];
While[n < 20 && Length@ourdictionary > 0,
ourdictionary = DictionaryLookup[alpha];
alpha = StringExpression[alpha, alphabase];
n++;
If[Length@ourdictionary == 0, Print[{Length@ourdictionary, n – 1}];
Print[DictionaryLookup[alpha[[;; n – 1]]]]]]

The Answer(s):

{“aftereffects”, “desegregated”, “desegregates”, “reverberated”, “reverberates”,”stewardesses”}

Read Full Post »

In case you ever wanted to see some nice theory + simulation + visuals here’s a collection of nice Mathematica based explorations:

Animation for Epidemic Spread

Animation for Epidemic Spread

Jeff Bryant with Ed Pegg’s code on Influenza Epidemic modeling

Disease spread demonstration

SARs spread demonstration/animation

Oh, and I thought this was interesting… a nice PPT on pandemics.

I wonder if the swine flu spread through social networks with a similar dynamic? hmmm… Perhaps one should dig through this code for mining Twitter with Mathematica and start connecting the dots.  How could we do this?  We need to pull down a lot of tweets.  and we need some way to codify them by location or friends/groups.  What would we consider “spreading”.  Is it posting a link? replying to someone? hmmm.  Maybe this is a big fat waste of time….

Read Full Post »

An interesting approach to knowledge mentioned in Stephen Wolfram’s blog:

But what about all the actual knowledge that we as humans have accumulated?

A lot of it is now on the web—in billions of pages of text. And with search engines, we can very efficiently search for specific terms and phrases in that text.

But we can’t compute from that. And in effect, we can only answer questions that have been literally asked before. We can look things up, but we can’t figure anything new out.

Let’s see where this goes!

Read Full Post »

Getting webMathematica working on MacOS X was not entirely trivial, even with decent install instructions.

Here’s what you’ll need to avoid wasted time in getting set up:

  1. Install Mathematica first, ideally the latest version
  2. Your java should be fine provided you’re on OS X 10.4.11+, but double check your java -version looking for 1.5+
  3. Use tomcat6.  I tried glassfish, it was kinda a pain (i.e. it wasn’t drag and drop like tomcat)
  4. get the webMathematica.zip or .war file and deploy within the webapps folder in tomcat
  5. create a mathpass file and put it in the /conf folder in the webmathematica web app.  Follow this formating.   Be sure to register you webMathematica with register.wolfram.com to get your mathID and all that.
  6. Grab the J/Link jar from your current Mathematica.app/SystemFiles/Links/JLink/JLink.jar  and dump it into your tomcat/webapps/webmathematica/lib/JLink.jar — maybe this isn’t necessary, but i figured it would be best to match the JLink that came with the kernal to the one used in the local webMathematica (I couldn’t get it to work with the .jar on the webMathematica disk)
  7. start tomcat.  try the examples.
  8. COMPUTE

Sadly there are very few other places to get webMathematica troubleshooting tips.  The FAQs aren’t too deep and the forums have nothing.  Generally there aren’t a whole lot of people using webMathematica (should be more!) so community support suffers.  Also, those who are using it generally aren’t on Mac OS X 10.5.6+.

Post a comment if you changes or suggestions or your own experience.

Read Full Post »

Wolfram Mathematica Home Edition is available.  It’s a $295 fully functional version of Mathematica 7.

Everyone should consider getting a copy.  No, really, everyone.  

What mathematica can help you do is as useful as word processing.  I know, that sounds crazy.  How could scientific computing be for everyone?

Consider the amount of math, data mining and research one already does just to get through the day.  Do you check the stock market? do you look up information in wikipedia? do you use the tools in your online bank site? Do you watch the weather report?

Much of this data is available in Mathematica and is immediately made interactive by Mathematica.  Other examples

OK, still not convinced?  Just do the math.  Mathematica can replace Visio, your calculator (graphing calculator), excel, batch photo editor and most common programming environments.

If you a developer, even just a dabbler, you must get Mathematica.  It’s easy to pick up and the more you learn the more amazing things you find.  Beyond that though, Mathematica’s symbolic programming is a progressive approach.  In a world of multi core, multi threaded apps OOP and Procedural programming is becoming increasingly complicated and bug prone.  Mathematica’s approach avoids the pitfalls of lost threads and memory leaks because the paradigm itself doesn’t allow you to make those mistakes (for the most part).  

I’ll let you in on another secret, that almost no literature covers.  Mathematica has the best web parsers out there.  It is insanely easy to bring data in from like 200 different file formats, including HTML.  For anyone who has ever built a web service, a scraper, spider or crawler, you know how painful it is to build these in most languages, not to mention maintaining a scraper or crawler.  Why no one promotes this feature is beyond me considering the mashup nature of the Web now.  It’s super fun to mash the various APIs out there with some cool mathematica visualizations.  (Oh, and for the search engine nutz out there, the linguistic engine in mathematica is insanely easy to use vs. raw wordnet and various spelling engines.  you can creating a really neat search suggestion tool within in an hour.)

(e.g. I made a visual search engine of shoes and women’s tops that crushes like.com.  it took me 1.5 hours.  I used the image manipulation tools in Mathematica to analyze shapes and colors of products via the built in similarity algorithms.  Post a comment if you want that code)

So, yes, web industry people/media workers, you can get way ahead with this software.

BI people.  Give up that lame copy of SAS and SPSS.  Seriously, those products are so expensive for somewhat limited use.  I’ll still install R, because it’s FREE and extensible, but those other two gotta go if you are a stats and BI person.  Get a home copy of mathematica, learn it, and then get a pro copy at work.  Don’t trust me on this, just try it.  Let me know if you really can’t kick your SPSS habit.

I really could go on forever.  The scope of use for this software is pretty insane.  Hell, the documentation alone is a great teaching aid.  Sometimes I just browse the documentation to learn new math or programming or to explore the data.  What few people know is that the documentation itself is interactive and computable.  You don’t just get a book of examples, you can actually “run the program” within the documentation and see it live.  For the home user, this means you can use the documentation to get going very quickly and start to modify the examples to suit your task.

Call me a FanBoy.  That’s fine.  You will be too if you invest $295 and 2 hours of your time.  Methinks you’ll feel what I feel about this – how can I possibly be given this much power without paying 10x this much?  There must be a catch!  There isn’t.  This is the best deal in software. (just think of how much you paid for MS Office and Photoshop… and those only do a handful of functions)

Read Full Post »

Here’s a nice intro to functional programming on Dr. Dobbs.

In any functional programming language, you are likely to encounter these features:

* First-class functions, or higher-order functions: Functions can serve as arguments and results of functions.
* Recursion as the primary tool for iteration.
* Heavy use of pattern matching, although technically it is not a defining feature of FP.
* Lazy evaluation, which makes possible the creation of infinite sequences and other data structures.

At the end of the article on page 2 you get a nice discussion of Mathematica as a functional programming language.

It’s been noted a lot lately in technical publications that functional programming will continue to grow in importance due in large part to the need for parallel computing.  Functional programming is well suited for massive parrallel computation for a variety of reasons and the article does a good job highlighting some of those.  Of course, it comes at a price to developers – the learning curve.

It’s not a trivial exercise to switch from OO and imperative styles into functional.  And the lack of huge repositories of free code makes doing a quick commercial application fairly challenging.

Read Full Post »

Here’s a secret.

You don’t need VC money to build a kickass image/video/sound recognition search engine like Like.com or that silly iphone app in the commercials.

A copy of mathematica and this blog post on Mathematica 7s image manipulation features should get you well on your way.

Really folks. Mathematica has this out of the box.

Now, you probably should keep this a secret and go raise millions anyway.  I mean, you still need to throw a killer launch party and pay for some blogger swag.

Read Full Post »

Older Posts »