How to factor a expressions in a matrix with mathematica 7?

Click For Summary

Discussion Overview

The discussion revolves around the challenge of factoring expressions within matrices using Mathematica 7. Participants explore methods to achieve matrix simplification and the underlying reasons for Mathematica's behavior in simplifying matrix expressions.

Discussion Character

  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant inquires about a method to factor matrix expressions, specifically seeking a function like "MatrixSimplify" to simplify the entire matrix rather than individual elements.
  • Another participant explains that Mathematica evaluates the simplicity of expressions based on LeafCount, suggesting that the original matrix is considered simpler than the factored form due to its lower LeafCount.
  • A different participant expresses curiosity about Mathematica's reasoning for its simplification choices and critiques the lack of transparency in its algorithms, noting the absence of open-source options.
  • One participant introduces the concept of using HoldForm to prevent automatic simplification during display, although they acknowledge the complexity of using such functions.
  • There is mention of alternative open-source software options like Axiom, Sage, and Maxima, but concerns are raised about the accessibility and comprehensibility of their source code for novices.

Areas of Agreement / Disagreement

Participants express differing views on the effectiveness and transparency of Mathematica's simplification process. There is no consensus on the best approach to factor matrix expressions or on the implications of using open-source alternatives.

Contextual Notes

The discussion highlights limitations in understanding Mathematica's internal decision-making processes regarding expression simplification, as well as the challenges associated with using alternative software.

andresordonez
Messages
65
Reaction score
0
Hi, is there a way to factor expressions in matrices? for example

In[1]:= MatrixSimplify[{{3/2, 5/2}, {9/2, 1/2}}] (*I just made up the name MatrixSimplify*)

Out[1]:= 1/2 * {{3, 5}, {9, 1}}

I tried with Simplify[] and with Factor[] but it didn't work, it seems they just simplify every element in the matrix but not the matrix as a whole.

Thanks.
 
Physics news on Phys.org
Mathematica's method of evaluating how simple an expression is determines that {{3/2, 5/2}, {9/2, 1/2}} is simpler than 1/2 * {{3, 5}, {9, 1}} and so it will automatically force it back to your undesired form even if you find a way to extract the denominator. Try entering your "simplified" form to confirm this.

Perhaps you can see a way to use this to accomplish what you wish

In[1]:= m = {{3/2, 5/2}, {9/2, 1/2}};c = Apply[LCM, Map[Denominator, Flatten[m]]];{1/c, c*m}

Out[1]= {1/2,{{3, 5}, {9, 1}}}
 
Thanks, that's an interesting way to solve it, I wasn't familiar with the use of Apply and Map.

I wonder why mathematica "thinks" that {{3/2, 5/2}, {9/2, 1/2}} is simpler than 1/2 * {{3, 5}, {9, 1}}. (It's a shame that mathematica is not open source, that's so unscientific)
 
There are two, sometimes contradictory, things going.

In[6]:=LeafCount[{{3/2,5/2},{9/2,1/2}}]
Out[6]=15
In[7]:=LeafCount[{{3,5},{9,1}}]
Out[7]=7
and so, if it didn't do the multiply, 1/2*m would have a LeafCcount of 11, less than 15 and thus seemingly "simpler."

The other is that operations on numeric values are automatically carried out.

In your example the second one wins.

It is possible to block some automatic operations during display using HoldForm
In[8]:=HoldForm[1/2*{{3,5},{9,1}}]
but all the various Hold functions are a tricky tarpit to enter for most folks.

There are open source alternatives, Axiom, Sage and Maxima are three. But each of those represents 100 or 1000 man years of development and most things of that size are impossible for a novice or even an amateur to really honestly actually read and understand the source and behavior at the level I think you are expecting. Open source is a fine idea, but almost nobody really does this.
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 13 ·
Replies
13
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
1K