cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

Cramer's rule

AlvaroDíaz
9-Granite

Cramer's rule

Cramer's rule in Mathcad.

Alvaro.
29 REPLIES 29

On 4/27/2009 9:24:19 AM, adiaz wrote:
>Cramer's rule in Mathcad.
>
>Alvaro.
__________________________

Past a certain size of the system, the solving is by Cholesky decomposition. But I don't know about at what size it starts. Cramer is for the first year algebra class ! The Gauss decomposition was well used at the times of TI-59 but the memory was the limit, may be close to 10 equations ?

Jean



On 4/27/2009 9:37:52 AM, jmG wrote:
>Cramer is for the first year
>algebra class !

That's true for the Cramer: "solve a system folowing the Cramer's rule". But this is not that Cramer, is "make a program to implement Cramer's rule". Isn't the same.

Also, this forum is "Educational Applications", not "Efficient Algorithms".

Regards. Alvaro.

Cramer's Rule is useful for teaching purposes but not so great for calculation as has been shown in these posts.
Gaussian elimination is pretty good for most scientific and engineering calculation. I have had to program it into dozens of languages over the years - somewhat surprisingly MCad is one of the more difficult ones.
Anyway, many students find Gaussian elimination boring and tedious to follow. Long ago i found a flowchart in textbook (reference lost) that showed how to program a set of simultaneous equations as a square matrix of coefficients plus a right hand column of constant values, to untangle it all and get a diagonal matrix of "1"s and the value of each unknown down the right hand column.
I have attached both the flowchart and a MathCad example.
However, the real use of the flowchart is for stupid languages like javascript or php, so that you can do live math on a web site.

Regards,
narlin

It shouldn't be more difficult programing Gauss elimination in Mathcad than it was in TI-59, should it ?

jmG
PhilipOakley
5-Regular Member
(To:Narlin)

On 4/28/2009 9:45:37 AM, Narlin wrote:
>Gaussian elimination is pretty
>good for most scientific and
>engineering calculation. I
>have had to program it into
>dozens of languages over the
>years - somewhat surprisingly
>MCad is one of the more
>difficult ones.

I found that too. And the various speed up versions that select the best row element to diagonalise.

I posted a thread some wher about it. If I remember I wanted an inner for loop which had an i<>j exclusion in it...

Philip Oakley

>>If I remember I wanted an inner for loop which had an i<>j exclusion in it...<<

That's a continue statement.
__________________
� � � � Tom Gutman
PhilipOakley
5-Regular Member
(To:TomGutman)

On 4/28/2009 3:56:21 PM, Tom_Gutman wrote:
>>>If I remember I wanted an inner for loop which had an i<>j exclusion in it...<<
>
>That's a continue statement.
>__________________
>� � � � Tom Gutman

Just looked up my old notes (2006) - it was the partial pivoting / Scaled partial pivoting method for LU/Gaussian elimination that I was looking at.

I'll try to remember the "continue" statement, which I rarely use 😞

Somehow it doesn't feel right to have that "skip" style command. (it's almost like a GOTO End !)

Philip Oakley

If the task is something like 'given a linear system, vary only one variable in the system at time, solve, use this variable, and iterate the process', I think that cramer is the best method. The other methods solve all the system at the same time or (matrix inversion) evaluates a lot of dets for inverting (but with one row and one column minus).

Alvaro.

Cramer is almost never a good option. To use it you need to calculate the determinant of the matrix. Getting the entire solution is only slightly more work than simply calculating the determinant. A lot less than the two determinants which is the minimum for Cramer's rule (solving for only one variable).
__________________
� � � � Tom Gutman
lvl107
20-Turquoise
(To:Narlin)

...There's an error...

On 10/12/2009 9:09:17 PM, lvl107 wrote:
> ...There's an error...
________________________

Cramer has no use in real modern maths. The other thing you may be doing no use either. Matrix operations are essentially based on Cholesky. So, just use Mathcad matrix operations from Mathcad native numerical algos. In other words: there is nothing to program with "Cramer museum".

jmG



Didn't realised the subject is an old vintage and was already commented.

>Gaussian elimination is pretty good for most scientific and engineering calculation. I have had to program it into dozens of languages over the years - somewhat surprisingly MCad is one of the more difficult ones.< [Narlin]

==> not sure how to interpret:
==> programming environments/languages ?
==> or "Pocket Calculators"
==> what would be the use of either programming environment or language not doing the minimum linear algebra.

When it is applicable, the Cholesky decomposition is roughly twice as efficient as the LU decomposition for solving systems of linear equations.[1]

jmG

I don't understand what this is doing in this thread. AFAIK echelon form bears no relation to Cramer's rule. Nor do I understand the point of the sheet. Clearly the user define Echelon function in this sheet is defective. Happens. People are careless, and make mistakes. Mathcad's built in echelon function (rref) works with this matrix.

Oh, the form A-1·C is not the preferred Mathcad way to solve the system A·X=C. It's the mathematical solution converted to Mathcad. lsolve is generally better on a number of grounds.
__________________
� � � � Tom Gutman

On 10/13/2009 1:05:06 AM, Tom_Gutman wrote:

>I don't understand what this is doing in this thread.

Mathcad isn't only an engineer tool. First, there are others that aren't engineers that uses this software (technicians, qualified workers, doctors in medicine, biologists, laboratorists, economists, astronomers, and a long etc.), and second (but in first place) students uses mathcad. And students aren't engineers. Mathcad is also a teaching tool.

>AFAIK echelon form bears no relation to Cramer's rule.

All kind of this routines are related for teaching linear algebra.

>Nor do I understand the point of the sheet.

I think that what you don't is the point of this forum ("Educational Applications").

Regards. Alvaro.

I don't understand your point. I didn't question this post in the collaboratory, nor the placement in this particular section. I questioned the placement of this post, dealing with an error in a particular implementation of a reduction to echelon for, in an established thread dealing with Cramer's rule. It is a quite different issue, and should start its own thread.

As to the point of the post, well, what is it? The post merely states that there is an error, borne out by the sheet. Is this just a complaint about the particular implementation (source unknown)? Or is it a statement that the echelon form solution doesn't work in general?

If indeed intended as commentary of some sort in the particular implemention, what is wanted? The identification of where the error occurs (a lot of users seem to have never learned to use the error trace facility)? A patch type fix for this particular routine? A general discussion of how to do gaussian elimination in a robust way?
__________________
� � � � Tom Gutman

On 10/13/2009 4:45:03 AM, Tom_Gutman wrote:
>I don't understand your point. I didn't question this post in the collaboratory, nor the placement in this particular section. I questioned the placement of this post, dealing with an error in a particular implementation of a reduction to echelon for, in an established thread dealing with Cramer's rule. It is a quite different issue, and should start its own thread.

Oh,I'm sorry, I'm bad interpret your previous post. You're right, better, a new thread.

>As to the point of the post, well, what is it? The post merely states that there is an error, borne out by the sheet. Is this just a complaint about the particular implementation (source unknown)?

I assume that this is. About the source, the 'E' procedures are called for 'Elementary row operations'. Taking this as rules, are the better way to solve by hand a linear system (this is, with the augmented matrix) by hand, even more easy -for large systems- than the Cramer rule and gives also the rank of the matrix if eventually the determinant of the system is zero at the same time that reduce the system.

>Or is it a statement that the echelon form solution doesn't work in general?

A further reading of the original post showme that this is a valid aception, isn't clear the proposal of the post, and you're right.

>If indeed intended as commentary of some sort in the particular implemention, what is wanted? The identification of where the error occurs ...

I think so.

> ... (a lot of users seem to have never learned to use the error trace facility)? ...

Please, include-me in this list. I usual forgot this tool because is some uncomfortable to use.

> ... A patch type fix for this particular routine? A general discussion of how to do gaussian elimination in a robust way?

Again, you're right, isn't clear for the collab post.

I post what I found as the answer in

http://collab.mathsoft.com/read?123456,23e#129280

but appear in not time order in this thread.

Regards. Alvaro.

On 10/12/2009 9:09:17 PM, lvl107 wrote:

> ...There's an error...

Check please if this fix all the cases.
Regards. Alvaro.

On 10/13/2009 2:31:36 AM, adiaz wrote:
>On 10/12/2009 9:09:17 PM, lvl107
>wrote:
> ...There's an error...

Check
>please if this fix all the
>cases.
Regards. Alvaro.
___________________________

Elementary Row Operations on Matrices (Mathsoft Matrix treasury).

jmG



Sorry, Alvaro: earlier, I messed your sheet.

jmG

On 10/13/2009 8:45:06 AM, jmG wrote:
>Elementary Row Operations on Matrices
>(Mathsoft Matrix treasury).

Oh, thanks, looks a nice book this one.

Regards. Alvaro.
lvl107
20-Turquoise
(To:AlvaroDíaz)

To: Alvaro.
Loi.

On 10/15/2009 4:17:54 PM, lvl107 wrote:
> To: Alvaro.

Well, looks that the original Narlin's post isn't that easy as seems. Have not enough time to check, but he post the diagram for the jscript code.

Pedagogical applications aren't best ones to make intensive testing, but this kinds of failures looks very bad. For example, the algorithms in

http://math.fullerton.edu/mathews/n2003/GaussianJordanMod.html

also fails, and for the same reason. I understand that some kind of sacrifice in the rigourosity for expositional clarity, but not writing not useful routines.

Regards. Alvaro.

>Well, looks that the original Narlin's post isn't that easy as seems. Have not enough time to check, but he post the diagram for the jscript code.<<br> ___________________________

The Neville triangular construct is � page, just a matter of modifying to accommodate the "pivoting" needed. Another example is Thiele triangle. That Mathematica coding is a joke for the day the boob tube is too boring to watch.

OK ! the Mathematica programming structure is quite primitive vs Mathcad, thus some confusion about the complexity but not more complicated than by hand.

jmG
lvl107
20-Turquoise
(To:AlvaroDíaz)

Hi, The following images is about ' little detailed ' of Example 1 & 4 in GaussJordanMod.html . Regard.

Mathcad has several built-in functions for practical use.

Material that claims to be educational should be accurate, and should reflect best practice.

BTW, Mathcad's rref does have problems, problems which have been previously discussed at length.
__________________
� � � � Tom Gutman
lvl107
20-Turquoise
(To:Narlin)

I just add a "handwork" in here.

-LL-

Loi Le wrote:

I just add a "handwork" in here.

-LL-

What was your point if everything had been said in the past on that and that of what was said can be read again back in time On the top of that I just posted the use of solving rref. What is the point reworking rref if it is sourced in Mathcad and the source is largely accepted and proved working ? Did you find a bug in the Mathcad built-in rref ?

Nice discussion and very informatiove.

Moreover, i have found a very useful step by step tutorial of cramer's rule of simplification of two and three equation system with pictorial views.

'http://www.electricaltechnology.org/2015/01/cramers-rule-2-3-equation-systems-easy-step-step.html

I hope you will like it

Top Tags