October 23, 2012 — Michael Trott, Chief Scientist

In my last blog post, we discussed 3D charge configurations that have sharp edges. Reader Rich Heart commented on it and asked whether Mathematica can calculate the force between two charged cubes, as done by Bengt Fornberg and Nick Hale and in the appendix of Lloyd N. Trefethen’s book chapter.

The answer to the question from the post is: Yes, we can; I mean, yes, Mathematica can.

Actually, it is quite straightforward to treat a more general problem than two just-touching cubes of equal size:

  • We can deal with two cubes of different edge lengths L1 L2
  • We can calculate the force for any separation X, where X is the distance between the two cube centers (including the case of penetrating cubes; think plasma)
  • We will use a method that can be generalized to higher-dimensional cubes without having to do more nested integrals

Instead of calculating the force between the two cubes, we will calculate the total electrostatic energy of the system of the two cubes. The force is then simply the negative gradient of the total energy with respect to X. The electrostatic energy (in appropriate units) is given by:

Calculating the total electrostatic energy of the system of the two cubes

(In the following calculations, we will skip the constant [with respect to X] prefactors Q1 L1-3 Q2 L2-3 or Q1 Q2 if not needed.)

Approaching this integral head-on doing one integral after another is possible, but a very tedious and time-consuming operation. Instead, to avoid having to carry out a nested six-dimensional integral, we remember the Laplace transform of 1 / √s.

Simplifying the equation

1 / √y

Read More »


September 27, 2012 — Michael Trott, Chief Scientist

In my last blog post, we looked at various examples of electrostatic potentials and magnetostatic fields. We ended with a rectangular current loop. Electrostatic and magnetostatic potentials for squares, cubes, and cuboids typically contain only elementary functions, but the expressions themselves are often quite large compared with simple systems with radial symmetry. In the following, we will discuss some 3D charge configurations that have sharp edges.

Let’s start with a charged 2D rectangle in 3D space. Again, the potential is an elementary function that contains a few logarithms.

WolframAlpha["electric potential charged rectangle"]

Read More »


July 20, 2012 — Michael Trott, Chief Scientist

(This is the first post in a three-part series about electrostatic and magnetostatic problems involving sharp edges.)

Mathematica can do a lot of different computations. Easy and complicated ones, numeric and symbolic ones, applied and theoretical ones, small and large ones. All by carrying out a Mathematica program.

Wolfram|Alpha too carries out a lot of computations (actually, tens of millions every day), all specified through free-form inputs, not Mathematica programs. Wolfram|Alpha is heavily based on Mathematica, and many of the mathematical calculations that Wolfram|Alpha carries out rely on the mathematical power of Mathematica. And while Wolfram|Alpha can carry out a vast amount of calculations, it cannot carry out all possible calculations, either because it does not (yet) know how to do a calculation or because the (underlying Mathematica) calculation would take a longer time than available through Wolfram|Alpha. So for a detailed investigation of a more complicated engineering, physics, or chemistry problem, having a copy of Mathematica handy is mandatory.

But there is also the reverse relation between Mathematica and Wolfram|Alpha: Wolfram|Alpha’s knowledge, especially its data knowledge, allows it to carry out investigations and calculations that can substantially increase the power of pure Mathematica. And all of this is because Wolfram|Alpha’s knowledge is accessible through the WolframAlpha[] function within Mathematica.

Read More »


March 14, 2012 — Jackie Tran, computerbasedmath.org

In the “Society’s Changing Needs for Math” session at the The Computer-Based Math (CBM) Education Summit 2011, Marcus du Sautoy, Paul Wilmott, Charles Fadel, and Tim Oates discussed their views in one of the summit’s key sessions.

There was a lot of energy for debate from our summit attendees, and we did not have the time to expand on every topic after each talk. Hopefully these bite-sized videos from our speakers will open up discussions to all. Have your say and leave your thoughts on the comment section of this post or on Computer-Based Math’s YouTube Channel.

Read More »


October 26, 2011 — Samuel Chen, Technical Communication & Strategy

What do computer animation, oil exploration, and the FBI’s database of 30 million fingerprints have in common?

Wavelet analysis.

As of Version 8, wavelet analysis is an integral part of Mathematica.

Continuous wavelet families

Wavelets themselves are short-lived wave-like oscillations. Taking the Morlet wavelet, for example, we can see that unlike sines and cosines, this wave-like oscillation is localized in the sense that it does not stretch out to infinity.

Read More »


January 26, 2011 — Jon McLoone, International Business & Strategic Development

Mathematica can make you feel like a computational superman. Armed with that attitude and some schoolboy knowledge of cryptography, I turned my attention to cipher breaking this week, only to discover buried kryptonite.

The weakness of ciphers (where you swap every occurrence of a particular letter in your message with the same different letter) is that they don’t change the patterns of letters. The simplest attack that exploits this fact is frequency analysis. The most common letter in English is “e”, and so it follows that the most common character in an encoded message (assuming the message is written in English) will correspond to “e”. And so on through the alphabet.

Mary Queen of Scots famously lost her head when Queen Elizabeth’s spymaster broke Mary’s cipher using frequency analysis. I figured that if sixteenth century spies could do it by hand, I should be able to automate it in Mathematica in about 10 minutes.

Read More »


December 9, 2010 — Jon McLoone, International Business & Strategic Development

I just published a Mathematica package that provides an alternative, richer implementation of units and dimensional analysis than the built-in units package. You can get it here. Aside from being a really nice extension to Mathematica, it is also an interesting case study in adding a custom data “type” to Mathematica and extending the knowledge of the built-in functions to handle the new “type”.

First I have to explain the point by answering the question, “What’s wrong with the built-in units package?” Well, there is nothing actually wrong with it, it just doesn’t apply Mathematica‘s automation principles. It can convert between several hundred units and warn if a requested conversion is dimensionally inconsistent. But give it an input like…

3.5 Inch + 2 Meter

and it does nothing with it until you specify that you want the result in a specific unit. The core reason is that it doesn’t teach the system, as a whole, anything about units, or even that the symbol “Meter” is any different than the symbol “x”. All of the knowledge about units and Meter in particular is contained in the Convert command.

Read More »


November 30, 2010 — Ed Pegg Jr, Editor, Wolfram Demonstrations Project

Let’s flip a coin, over and over. Beforehand, the players each pick a sequence of flips. The sequence that occurs first wins. With HH vs. TH, HH will win if the first two flips are HH and will lose if any of those flips are tails. HH vs. TH has a 1/4 vs. 3/4 possibility of winning.

Phrased a different way: Suppose I offer a bet on a series of coin flips. One of these bets would be bad for you. Which one? The odds of the event occurring are given at the end. (The second bet is the bad bet to take.)

HTT appears before TTT. If it does, I give you $1. If not, you give me $4. (7/8)
HHT appears before TTT. If it does, I give you $1. If not, you give me $3. (7/10)
THH appears before HHT. If it does, I give you $1. If not, you give me $2. (3/4)
HTH appears before THH. If it does, I give you $1. If not, you give me $1. (1/2)

This is the strange world of Penney’s game. Here is a table of odds and facts for various 3-flip games. Calculating these odds can be both tedious and mathematically demanding—a natural job for Mathematica or Mathematica Home Edition.

Table of sequence details

Read More »


October 1, 2010 — Jon McLoone, International Business & Strategic Development

Buried deep in the list of new technology in the Mathematica development pipeline was the item “integration of oscillatory functions (univariate, multivariate)—new algorithm”. I expect most people will overlook it, as I did, in favor of the new functions, new directions, big infrastructure, and the eye candy. Even worse, most people who will use it won’t even know—it will be selected automatically when needed, like many of Mathematica‘s algorithms. So I think it’s my duty to share my discovery that this algorithm is actually really cool.

Why is it so cool?

The first clue I had was when I read in the notes that this was the first time anyone had fully automated the algorithm into a very wide class of problems. Second, that it was a hybrid numeric-symbolic method (putting it beyond the reach of most numerical systems). And finally, that it was developed by the talented Wolfram Research developer Andrew Moylan.

Read More »


September 27, 2010 — Jon McLoone, International Business & Strategic Development

Since I just heard that the video for Conrad Wolfram’s recent TED talk “Stop teaching calculating, start teaching math” will be coming out soon, I thought I would address the single biggest fear that I hear when I talk about using computers in math education.

The objection that using computers will “dumb down” education comes with the related ideas “students have to learn to do it by hand or how will they know they have got the right answer”, “they won’t understand what is happening unless they do it themselves”, and so on.

Well, let’s examine this by looking at a typical math question that I know I had to solve at some point in my education.

Read More »