MathStudio  Blog  Share  Manual  Forums  Support 
Permalink

MathStudio reviewed in IEEE Spectrum

MathStudio has been reviewed in the latest issues of IEEE Spectrum!
http://spectrum.ieee.org/computing/software/review-mathstudio 

“MathStudio is a natural for students and for engineers who occasionally need a comprehensive math program but don’t need the full horsepower and daunting complexity of Mathematica or Maple. It’s a huge leap from the usual calculator program for tablets and smartphones.”

 

Permalink

Using LoadList and LoadMatrix on iOS

LoadList and LoadMatrix are now available on iPhone and iPad!  Follow these simple steps to load list and matrix data into MathStudio.

1) Create your list as a text file.  In this example we have created a file called numbers.txt.  This file has the text 1,2,3,4,5.

2) Upload the file to MathStudio through iTunes using File Sharing.  Open iTunes and click your device on the left in the Devices section.  Click the Apps tab at the top and scroll to the bottom of iTunes to find File Sharing.

3) Enter LoadList(“numbers.txt”) in MathStudio to load the data from the file.

Permalink

To detect or not to detect matrices

MathStudio automatically interprets a list of lists as matrix when each list is of the same size.  For example, an input of a={1,2,4,9} is interpreted as a list with four objects, where for example a(3) = 4.

A matrix can be formed by creating a list of lists, as in A = {{1,2,4,9},{1,1,2,5},{3,4,5,6}}.  MathStudio automatically converts this to a matrix type.

The reason this matters is because of operations like multiplication.  When you try to multiply two lists together, it will multiply them component wise, so a*a will return the list \{1,4,16,81\}, but A*A will return an error since A is a 3 by 4 matrix.

Also of interest is extracting sub-matrices and sub-lists.  For example, A(1) will return a list that consists of the first row of A.  To obtain a matrix type, you can use [A(1)].  Alternatively, you can use A(1,all) to get the first row as a list.

Sometimes, though, you want to just work with lists and not worry about MathStudio auto-detecting matrices.  This is especially worrisome when writing scripts, when the user may input a list of lists of the same size and yet the code is written to assume list formats.  In these cases the command to be used is

Command(MatrixDetection=0)

When this line appears at the top of a cell, it tells MathStudio NOT to auto detect matrices.  This way you can be certain that sub-lists will indeed be list types and not matrix types.  See the attached screenshot for an example.

Permalink

2011 Best App Ever Awards

MathStudio is nominated in several categories in the 2011 Best App Ever Awards!  Click the links below to vote for MathStudio.

Best Young Adults App (Android)
http://bestappever.com/v/tned/2/com.PomegranateSoftware.MathStudio

Best High School Student App (iPhone/iPad)
http://bestappever.com/v/hsed/1/439121011

Best College Student App (iPhone/iPad)
http://bestappever.com/v/cled/1/439121011

Permalink

Taylor Polynomials using MathStudio

I recently demonstrated the built-in function Taylor(function, var, n, [val], [mode]), which computes the Taylor Polynomial of degree n.

The idea is that a “nice” enough function f(x) can be represented exactly as an infinite series, which we say is centered at some point a,  and then a truncation yields a polynomial that is an approximation to f(x).  The form of this series is

\displaystyle f(x) = \sum_{k=0}^\infty \frac{f^{(k)}(a)}{k!}(x-a)^k

and the Taylor Polynomial of degree n is

\displaystyle f(x) \approx \sum_{k=0}^n\frac{f^{(k)}(a)}{k!}(x-a)^k.

It is of course desireable to know something about the error in this approximation, and luckily there is an analogous result to the Mean Value Theorem which says that

\displaystyle f(x) =\sum_{k=0}^n\frac{f^{(k)}(a)}{k!}(x-a)^k + R_n(z),

where we have regained equality by introducing a residual term, which is given by

\displaystyle R_n(z) = \frac{f^{(n+1)}(z)}{(n+1)!} (x-a)^{n+1}

where z is some number between a and x (we say between these two numbers since we could have a<x or a>x).

In MathStudio, the Taylor Polynomial of degree 7 centered at 1 for \sin(x) can be found by Taylor(sin(x),x,7,1).  The resulting polynomial will have terms like (x-1)^k with coefficients.  This is a standard way of writing the polynomial, but if you wanted the expanded form, then you can add another parameter Taylor(sin(x),x,7,1,1).

Plot(sin(x),Taylor(sin(x),x,7,1,0)

One important question that should be asked is whether a Taylor polynomial or Taylor Series will converge to the function for any choice of x.  Since not all series converge, this is an important question; the answer is that the Taylor polynomial will converge to the function for all x within the radius of convergence.  I will not delve into the topic of radius of convergence here, but as an example see the plot of the Taylor polynomial for \tan^{-1}(x) below.

Plot(atan(x),Taylor(asin(x),x,7,0,0))

It seems that no matter how large we take n, we only get convergence inside of the region -1 <x < 1.  There are indeed very good reasons for this, and I hope this post is enough to motivate you to read further!

Permalink

Matrix Decompositions

There are many ways to decompose a matrix A into matrices whose product is also A.  The following functions are supported by MathStudio,

Permalink

Bernoulli Numbers and Polynomials

I first encountered the Bernoulli numbers in a combinatorics class, and they came up later in asymptotic analysis in the Euler-Maclaurin Formula.  There are also Bernoulli polynomials as well.

To compute the n^{th} Bernoulli number, usually denoted by B_n in mathematics, in MathStudio, use Bernoulli(n).  For example, the first Bernoulli number is given in MathStudio by Bernoulli(1) = -1/2.  There is some discussion as to whether this first value should be taken to be positive or negative, and on the wikipedia page both versions are explored fully.  Personally I’ve seen the negative value used in my applications.

Bernoulli numbers have a rich set of applications, my favorite being Bernoulli’s formula, which is

\sum_{k=1}^n k^m = 1^m + 2^m + \ldots n^m = \frac{1}{m+1}\sum_{k=0}^m\binom{m+1}{k}B_k n^{m+1-k}.

This formula basically shows how to take the sum of powers of the first n integers and get an exact expression.  By looking at the dominant term, we see that

\sum_{k=1}^n k^m \sim \frac{k^{m+1}}{m+1},

which basically means that the dominant term is the first term, which agrees with our intuition that integrals are continuous versions of summations.

More generally, the Euler-Maclaurin formula governs the relationship between a sum and an integral for smooth enough functions f(x),

\sum_{i=0}^n f(i) = \int_0^n f(x) dx - B_1 (f(n)+f(0))

+ \sum_{k=1}^p \frac{B_{2k}}{(2k)!}\left(f^{(2k-1)}(n) - f^{(2k-1)}(0)\right)+R ,

where R is a remainder term that depends on the value of p, the order of the expansion.

Also of interest are Bernoulli polynomials, which are related to Bernoulli numbers.  In MathStudio, to obtain the n^{th} Bernoulli polynomial in the variable x, just add an argument from before, Bernoulli(n,x).

Exercise 1. Give an exact expression for the sums \sum_{i=1}^n i, \sum_{i=1}^n i^2, \sum_{i=1}^n i^3, \sum_{i=1}^n i^7.

Exercise 2.  Use Exercise 1 to show that \left(\sum_{i=1}^n i\right)^2 = \sum_{i=1}^n i^3.