MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Language vs. Library

  • To: mathgroup at
  • Subject: [mg61285] Re: Language vs. Library
  • From: Bill Rowe <readnewsciv at>
  • Date: Fri, 14 Oct 2005 05:55:24 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

On 10/13/05 at 1:39 AM, hattons at (Steven T.
Hatton) wrote:

>Try this:

>A = Array[a (10#1 + #2) &, {3, 3}]
>v = {x, y, z}
>A.v // MatrixForm
>A = Array[a (10#1 + #2) &, {3, 3}] // MatrixForm
>v = {x, y, z} // MatrixForm

>Why are the results different?

The issue here is MatrixForm. What it does is apply a wrapper to its argument. When you did A.V//MatrixForm you asked Mathematica to do a matrix multiplication and display the result using MatrixForm. But when you do

v = {x, y, z}//MatrixForm you are asking Mathematica to display things as you want and then set v to the result. That changes the head for v to MatrixForm. So, now A.v asks Mathematica to perform a matrix multiplication on two things that are no longer matrices.

If you like to see matrices displayed in the traditional form (as do I) then you would be better served by setting your default output display to TraditionalForm rather than using MatrixForm

>Explain this:

>Clear[a, i]
>a[i] = eye;
>i = 3;
>a[3] = three;
>Print["a[i]=", a[i]]
>Print["a[i]=", a[i]]

You've defined a function named "a" and defined that function for arguments i and 3. For the first Print statement, Mathematica evaluates i to 3 then evaluates a with at 3 and prints the result three. For the second Print statement, the value of i has been cleared so Mathematica evaluates a with an argument i and prints the result eye.

In both of these examples, Mathematica is performing as documented. However, the documentation for MatrixForm could be made clearer.
To reply via email subtract one hundred and four

  • Prev by Date: Re: "Leibnitz" from for partial differentiation?
  • Next by Date: Re: Re: Re: Language vs. Library
  • Previous by thread: Re: Re: Re: Language vs. Library
  • Next by thread: Re: Re: Re: Language vs. Library