Education

Teaching and learning about math, Maple and MapleSim

Special Relativity has been around for ~100 years, General Relativity for ~90 years.  I'm hoping that with the assistance of Maple and Mapleprimes I may be able to do some tensor calculus to better understand Einstein.  Perhaps the twin paradox is within my reach.  Perhaps even the orbit of Mercury.

Of all the ways to decompose a numerical (floating point) matrix, my favorite is the singular value decomposition (SVD).  There are a lot of applications of the SVD (see my dissertation for one related to polynomial algebra) but my favorite ones are probably two applications related to image processing.

The first one I want to talk about comes from the cover of James Demmel's book "Applied Numerical Linear Algebra": image compression.  This example gives a really cool intuitive understanding of the Rank of Matrix and is also nice excuse to play with Maple's ImageTools package.

So, the first thing you need a test image. I used the classic image compression benchmark of a Mandrill.



Read this in with:


mandrill:=ImageTools:-Read("4.2.03.tiff");


The result is a 512x512x3 array.  In order to do something with this, we need to make it into a matrix so, call


manmat:=convert(ArrayTools:-Reshape(mandrill, 512*3, 512), Matrix);


Now we can compute a singular value decomposition of the image:


(U, S, V) := LinearAlgebra:-SingularValues(manmat, output = ['U', 'S', 'Vt']);

Now we can zero-out small singular values and multiply things back together to create low-rank approximations of the matrix that are also compressed versions of the image.
Rank 32 will give us 1/8 of the data (64 dimension 512 vectors: 32 rows of U, 32 columns of V, and the 32 corresponding singular values) but still a pretty good image:


rank32approx:=MatrixMatrixMultiply(`.`(U, DiagonalMatrix(S[1..32], 3*512, 512)), V, outputoptions = [order = C_order]);


This reshape it back to an image and display:


Preview((Reshape(rank32approx, 512, 512, 3)));


Taking things down to rank 8, is leaving only 1/32 of the data, but it is amazing how what is left resembles the original image:


rank8approx:=MatrixMatrixMultiply(`.`(U, DiagonalMatrix(S[1..8], 3*512, 512)), V, outputoptions = [order = C_order]);
Preview((Reshape(rank8approx, 512, 512, 3)));


To look at more images in order of descending rank, take a look at my worksheet:
Download 5480_SVD-face-colour-improved.mw
View file details

Next time: eigenfaces

A colleague showed this to me earlier this afternoon. I can explain, and accept, most of Maple's responses. I do have one case where I believe Maple could do better.

This arose during the creation of some Maple materials to support the derivation of the Integral Test for series convergence. Consider:

restart;
I1 := Int( 1/x^p, x=1..infinity );
                                /infinity      
                               |          1    
                               |          -- dx
                               |           p   
                              /1          x    

I would like Maple to assist me with the following definite double integral:

int(int(x/(x^2+y^2+z^2)^(3/2), y = -b .. b), z = c .. a+c)

so far, I have failed.  Can anybody help?

Here is my worksheet:

View 4937_Page92.mw on MapleNet or Download 4937_Page92.mw
View file details

Why is the following function such a problem to differentiate?

A := 1/(8*cos(`θ`)*(sin(`θ`))(sin(`θ`)+cos(`θ`))^2)

Here is a worksheet:

View 4937_page84.mw on MapleNet or Download 4937_page84.mw
View file details

I've made up a worksheet of the Top Ten Maple Errors, containing some of the common mistakes I often see newcomers to Maple commit (especially in the setting of my Introduction to Mathematical Computing class). I hope you will find it useful in trying to avoid those mistakes. Of course this is only a personal list, and not exhaustive. Please feel free to argue the merits of other items that should be included in the list. Here is the link: Download 4541_topten.mw

For the past decade Doug Meade, at the University of South Carolina, has created and maintained a two-page document with essential Maple commands. The first version was created for Maple V, Release 4, in January 1998. n update has been created for each version of Maple (except Maple 10) as it was released. The document has become pretty stable - hence the omission for Maple 10. Here are links to the complete set of documents he has created

Comments, corrections, and suggestions for improvement are welcomed. Please contact the author by e-mail.

The recipe is quite simple to understand looking at an example (and it is understood best by having paper and pencil to follow it): f:= x -> x^2 the parabola with its inverse g:= y -> sqrt(y). Say you want the integral of g over 0 ... 2, which (here) is the area between the graph and its horizontal axis. That is the same as the area of the rectangle minus the area between the graph of g and the vertical axis, where the rectangle has corners 0, 2 and g(0)= f^(-1)(0) and g(2)= f^(-1)(2). Now recall the geometric interpretation of the compositional inverse of a function: it is reflection at the diagonal.
To those who are interested: New version of FourierTrigSeries package was released. This release fixes a bug in ExploreFourierSeriesCoefficients procedure. FourierTrigSeries package provides new data structure for the representation of trigonometric series and also several procedures to manipulate with trigonometric series and to compute Fourier series. Visit the homepage and see some examples. Try also the online Fourier series calculator.
This isn't specifically Maple-related; but mathematics-related; related to Linear Algebra and Modern Algebra. While reviewing Linear Algebra; I ran across the concept of "Similar Matrices"; which are defined as: if A,B are nxn matrices and there exists invertible nxn matrix P such that P^(-1)*A*P = B then A is similar to B The payoff was: if A, B are similar then they "have the same eigenvalues" (the characteristic equation is same for both A and B). (Here we are talking about the group of invertible nxn matrices, with operation matrix multiplication) --
It seems to me that I found a tip (I am a beginning user) In running these three commands in Maple 10, one gets: > sum(1/(n^4+1), n = -infinity .. infinity) sum(1/(n^4+1), n = -infinity .. infinity) > sum(1/(n^4+1), n = 0 .. infinity) 1/4*(Sum(_alpha*Psi(-_alpha), _alpha = RootOf(_Z^4+1))) > sum(1/(n^4+1), n = -infinity .. infinity) 0 The last answer is obviously wrong. In other similar experiments, Maple gives the answer -infinity to the last expression, which is also wrong. Could somebody comment on this phenomenon? Many thanks in advance.
We are pleased to announce the winners of the monthly Maple Mentors Awards for October and November. The winner for October is Douglas Meade and Georgios Kokovidis has won for November. Douglas Meade and Georgios Kokovidis will receive a prize of their choice to thank them for their involvement with the MaplePrimes community. We have received many emails nominating these individuals. One member had this comment concerning the help given by Douglas Meade:
I would like to see solutions to Exercise 7 at the end of Chapter 6 in the 2007 edition of the Maple 11 Introductory Programming Guide. It's on page 255. The exercise reads as follows: “Demonstrate that the BinarySearch procedure always terminates.” “Hint: Suppose the dictionary has n entries. How many words in the dictionary D does BinarySearch look at in the worst case?” My solution (I’m a Maple novice and I’m reading the book.) is: View 4937_Chapter6Exercise7.mw on MapleNet or Download 4937_Chapter6Exercise7.mw
View file details
I would like to see a solution to Exercise 5 at the end of Chapter 6 in the 2007 edition of the Maple 11 Introductory Programming Guide. It's on page 255. My humble attempt is: View 4937_Chapter6Exercise5.mw on MapleNet or Download 4937_Chapter6Exercise5.mw
View file details I am asking this question because in the past the answers have been way cool, magic happens!
First 52 53 54 55 56 57 58 Page 54 of 59