Dot Physics

Wolfram Alpha Widgets

Try to say that 5 times really fast. Go ahead, try it. Well, at least it is not as difficult as Fox in Socks – man that book is a killer.

This WAW is basically a means to embed Wolfram Alpha queries into a webpage. Pretty cool idea, but I am not sure how well it does the job. In fact, I have tried to embed calculations in my posts before. So, how about I just give a quick review of some different ways to do this. For all these methods, I will put in a calculator to determine the density of something given its mass and volume.

Javascript version

Density calculator

Enter the mass: kg

Enter the volume:m3

Density =

What is good about this? First, it is all contained in this page. There are no popups or anything like that. It doesn’t depend on the user having to log into anything else. It is fully customizable by me – if I wanted, I could even add pull down menus for different units and stuff.

What is not to like? Well, I don’t like writing javascript code. Maybe if I do this often enough, it wouldn’t be so bad. Also, for simple stuff, it is pretty straight forward – but what about crazy complicated stuff? Note: I am not a javascript expert by any means.

Embedded Spreadsheet

I have used this one before. The basic idea is to put the calculation into either a google doc or in a Zoho spreadsheet. I will use both below.

Google Docs


I really thought one could embed an editable google docs spreadsheet. Why can’t you? WHY? Oh well, here is the webpage version that you can edit – but that kind of ruins the whole point.

Zoho

I wish the zoho doc could be set to edit on load instead of having to click that edit button. Also, my brother claims that this doesn’t work in Safari if you have cookies disabled or something like that. Other than that, the embeddable spreadsheet thing seems like a good idea. Too bad it doesn’t work just the way I like it.

Wolfram Alpha Widget

Here is the applet I made from Wolfram Alpha.

Yes, this is pretty simple – but it returns lots of cool info. I am not sure if this form is still the best. However, maybe this is better than the other two. I haven’t made up my mind yet. What about a more difficult test? Here is a calculation from my flying R2-D2 post. I found an expression for the mass of R2 as:

i-c49b6e6cbc2fe32f5b583e6f7ee50232-2010-08-02_r_2_mass.jpg

Can I use Wolfram Alpha to make a widget for this?

That seems to work. Also, in this version I included the units in the input box. Why not – right? Wolfram Alpha interprets that stuff anyway. No need for me to go through the trouble of making in a pop-up menu.

But, what do you think? Are there any other good alternatives for embedding calculations?

Comments

  1. #1 Ciaran
    August 3, 2010

    There’s a slight flaw in your Javascript version. It seems to be multiplying mass by volume to get density which isn’t how I learned it.

  2. #2 Rhett Allain
    August 3, 2010

    @Claran,

    I did that on purpose just to see if anyone was paying attention – obviously you are.

    Just kidding – thanks for pointing that out (I fixed it).

  3. #3 Grep Agni
    August 3, 2010

    The WA widget is not using the correct units for me. I put in 10 kg and 1 m^3 and got (hand translated to ASCII):
    ___________________BEGIN_____________________

    Input interpretation:

    10 grams
    ————————-
    1 cm^3 (centimeter cubed)

    Result:

    10 g/cm^3 (grams per cubic centimeter)

    Unit conversions:

    …..

    [third in the list] 10 000 kg/m^3 (kilograms per cubic
    ….
    _____________________END_____________________

    Changing the units to kg and mL and trying different numbers (0.002 kg and 3 mL) yields:

    ___________________BEGIN_____________________

    Input interpretation:

    0.00200 g (grams)
    ——————-
    3 L (liters

    Result:

    6.67 x 10^-4 g/L (grams per liter)

    Unit conversions:

    [kg/mL not given]
    _____________________END_____________________

  4. #4 Rhett Allain
    August 3, 2010

    @Grep Agni

    Ok – I think I fixed it – but you were right. I don’t know why wolfram alpha was doing that. You can see my simple fix was to switch from putting the units in a pull down menu to just putting them in the entry box. That is easier and more sensible anyway.

    Thanks for pointing out the error.

The site is currently under maintenance and will be back shortly. New comments have been disabled during this time, please check back soon.