<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/169151</link>
    <title>MATLAB Central Newsreader - Cramer's Rule - linear equations</title>
    <description>Feed for thread: Cramer's Rule - linear equations</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2008 by The MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>The MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Tue, 13 May 2008 06:50:18 -0400</pubDate>
      <title>Cramer's Rule - linear equations</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/169151#431718</link>
      <author>Ashwini Deshpande</author>
      <description>I have three linear equations with 3 unknowns, say for example:&lt;br&gt;
&lt;br&gt;
3x + 4y + 6z = 1; &lt;br&gt;
x - 2y + 7z = 10;&lt;br&gt;
2x + 3y - 9z = 15;&lt;br&gt;
&lt;br&gt;
How do i solve this using matlab, is there any easiest way&lt;br&gt;
to apply Cramer's Rule to Solve these equations ???&lt;br&gt;
&lt;br&gt;
Any help would be appreciated !!&lt;br&gt;
Thanks !&lt;br&gt;
Ashwini&lt;br&gt;
&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Tue, 13 May 2008 08:06:33 -0400</pubDate>
      <title>Re: Cramer's Rule - linear equations</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/169151#431729</link>
      <author>NZTideMan</author>
      <description>On May 13, 6:50=A0pm, "Ashwini Deshpande" &amp;lt;vd.ashw...@mathworks.com&amp;gt;&lt;br&gt;
wrote:&lt;br&gt;
&amp;gt; I have three linear equations with 3 unknowns, say for example:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; 3x + 4y + 6z =3D 1;&lt;br&gt;
&amp;gt; x - 2y + 7z =3D 10;&lt;br&gt;
&amp;gt; 2x + 3y - 9z =3D 15;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; How do i solve this using matlab, is there any easiest way&lt;br&gt;
&amp;gt; to apply Cramer's Rule to Solve these equations ???&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Any help would be appreciated !!&lt;br&gt;
&amp;gt; Thanks !&lt;br&gt;
&amp;gt; Ashwini&lt;br&gt;
&lt;br&gt;
If you're using Matlab, why would you even contemplate using Cramer's&lt;br&gt;
Rule?&lt;br&gt;
You would only use that if you wanted to solve it by hand - or you&lt;br&gt;
needed to do it for homework.&lt;br&gt;
&lt;br&gt;
If you genuinely want to solve the equations in Matlab, try: help&lt;br&gt;
mldivide&lt;br&gt;
&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Tue, 13 May 2008 08:26:04 -0400</pubDate>
      <title>Re: Cramer's Rule - linear equations</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/169151#431734</link>
      <author>James Tursa</author>
      <description>"Ashwini Deshpande" &amp;lt;vd.ashwini@mathworks.com&amp;gt; wrote in&lt;br&gt;
message &amp;lt;g0bdna$rjm$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; I have three linear equations with 3 unknowns, say for&lt;br&gt;
example:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; 3x + 4y + 6z = 1; &lt;br&gt;
&amp;gt; x - 2y + 7z = 10;&lt;br&gt;
&amp;gt; 2x + 3y - 9z = 15;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; How do i solve this using matlab, is there any easiest way&lt;br&gt;
&amp;gt; to apply Cramer's Rule to Solve these equations ???&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Any help would be appreciated !!&lt;br&gt;
&amp;gt; Thanks !&lt;br&gt;
&amp;gt; Ashwini&lt;br&gt;
&amp;gt; &lt;br&gt;
&lt;br&gt;
Cramer's Rule:  It may be slow, but it's inaccurate!&lt;br&gt;
&lt;br&gt;
James Tursa&lt;br&gt;
&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Wed, 14 May 2008 00:00:33 -0400</pubDate>
      <title>Re: Cramer's Rule - linear equations</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/169151#431923</link>
      <author>Dave Bell</author>
      <description>NZTideMan wrote:&lt;br&gt;
&amp;gt; On May 13, 6:50 pm, "Ashwini Deshpande" &amp;lt;vd.ashw...@mathworks.com&amp;gt;&lt;br&gt;
&amp;gt; wrote:&lt;br&gt;
&amp;gt;&amp;gt; I have three linear equations with 3 unknowns, say for example:&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; 3x + 4y + 6z = 1;&lt;br&gt;
&amp;gt;&amp;gt; x - 2y + 7z = 10;&lt;br&gt;
&amp;gt;&amp;gt; 2x + 3y - 9z = 15;&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; How do i solve this using matlab, is there any easiest way&lt;br&gt;
&amp;gt;&amp;gt; to apply Cramer's Rule to Solve these equations ???&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; Any help would be appreciated !!&lt;br&gt;
&amp;gt;&amp;gt; Thanks !&lt;br&gt;
&amp;gt;&amp;gt; Ashwini&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; If you're using Matlab, why would you even contemplate using Cramer's&lt;br&gt;
&amp;gt; Rule?&lt;br&gt;
&amp;gt; You would only use that if you wanted to solve it by hand - or you&lt;br&gt;
&amp;gt; needed to do it for homework.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; If you genuinely want to solve the equations in Matlab, try: help&lt;br&gt;
&amp;gt; mldivide&lt;br&gt;
&lt;br&gt;
Perhaps the OP meant "Is there any easier way than to apply Cramer's Rule?"&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Wed, 14 May 2008 00:54:01 -0400</pubDate>
      <title>Re: Cramer's Rule - linear equations</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/169151#431930</link>
      <author>Roger Stafford</author>
      <description>"Ashwini Deshpande" &amp;lt;vd.ashwini@mathworks.com&amp;gt; wrote in message &lt;br&gt;
&amp;lt;g0bdna$rjm$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; I have three linear equations with 3 unknowns, say for example:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; 3x + 4y + 6z = 1; &lt;br&gt;
&amp;gt; x - 2y + 7z = 10;&lt;br&gt;
&amp;gt; 2x + 3y - 9z = 15;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; How do i solve this using matlab, is there any easiest way&lt;br&gt;
&amp;gt; to apply Cramer's Rule to Solve these equations ???&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Any help would be appreciated !!&lt;br&gt;
&amp;gt; Thanks !&lt;br&gt;
&amp;gt; Ashwini&lt;br&gt;
-------------&lt;br&gt;
&amp;nbsp;&amp;nbsp;It is true that using Cramer's Rule in matlab would in general constitute an &lt;br&gt;
inefficient method of solving linear equations, when there are so many &lt;br&gt;
superior algorithms available.  However, it must be said in defense of &lt;br&gt;
Cramer's Rule that it remains a very useful tool in mathematics, both in &lt;br&gt;
understanding the theory in linear algebra and also for doing certain symbolic &lt;br&gt;
manipulations.  I personally have to resort to its use quite often in deriving &lt;br&gt;
various formulas and the like.  It is only in the area of actual numerical &lt;br&gt;
computation that other methods become preferable.&lt;br&gt;
&lt;br&gt;
Roger Stafford&lt;br&gt;
&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Wed, 14 May 2008 07:21:45 -0400</pubDate>
      <title>Re: Cramer's Rule - linear equations</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/169151#431944</link>
      <author>NZTideMan</author>
      <description>On May 14, 12:54=A0pm, "Roger Stafford"&lt;br&gt;
&amp;lt;ellieandrogerxy...@mindspring.com.invalid&amp;gt; wrote:&lt;br&gt;
&amp;gt; "Ashwini Deshpande" &amp;lt;vd.ashw...@mathworks.com&amp;gt; wrote in message&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;lt;g0bdna$rj...@fred.mathworks.com&amp;gt;...&amp;gt; I have three linear equations with 3=&lt;br&gt;
&amp;nbsp;unknowns, say for example:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; 3x + 4y + 6z =3D 1;&lt;br&gt;
&amp;gt; &amp;gt; x - 2y + 7z =3D 10;&lt;br&gt;
&amp;gt; &amp;gt; 2x + 3y - 9z =3D 15;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; How do i solve this using matlab, is there any easiest way&lt;br&gt;
&amp;gt; &amp;gt; to apply Cramer's Rule to Solve these equations ???&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Any help would be appreciated !!&lt;br&gt;
&amp;gt; &amp;gt; Thanks !&lt;br&gt;
&amp;gt; &amp;gt; Ashwini&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; -------------&lt;br&gt;
&amp;gt; =A0 It is true that using Cramer's Rule in matlab would in general constit=&lt;br&gt;
ute an&lt;br&gt;
&amp;gt; inefficient method of solving linear equations, when there are so many&lt;br&gt;
&amp;gt; superior algorithms available. =A0However, it must be said in defense of&lt;br&gt;
&amp;gt; Cramer's Rule that it remains a very useful tool in mathematics, both in&lt;br&gt;
&amp;gt; understanding the theory in linear algebra and also for doing certain symb=&lt;br&gt;
olic&lt;br&gt;
&amp;gt; manipulations. =A0I personally have to resort to its use quite often in de=&lt;br&gt;
riving&lt;br&gt;
&amp;gt; various formulas and the like. =A0It is only in the area of actual numeric=&lt;br&gt;
al&lt;br&gt;
&amp;gt; computation that other methods become preferable.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Roger Stafford&lt;br&gt;
&lt;br&gt;
I agree entirely with you Roger, but the OP quoted a numerical&lt;br&gt;
example, not a symbolic one.&lt;br&gt;
&lt;br&gt;
How large a matrix would you use Cramer's Rule on?  Back when I learnt&lt;br&gt;
it and access to computers was difficult (i.e., Hollerith cards&lt;br&gt;
submitted as a background job) I could handle 3x3 no trouble and 4x4&lt;br&gt;
with a bit of effort, but these days 2x2 would be my limit before&lt;br&gt;
finding a better way.&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Wed, 14 May 2008 07:53:01 -0400</pubDate>
      <title>Re: Cramer's Rule - linear equations</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/169151#431949</link>
      <author>James Tursa</author>
      <description>"Ashwini Deshpande" &amp;lt;vd.ashwini@mathworks.com&amp;gt; wrote in&lt;br&gt;
message &amp;lt;g0bdna$rjm$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; I have three linear equations with 3 unknowns, say for&lt;br&gt;
example:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; 3x + 4y + 6z = 1; &lt;br&gt;
&amp;gt; x - 2y + 7z = 10;&lt;br&gt;
&amp;gt; 2x + 3y - 9z = 15;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; How do i solve this using matlab, is there any easiest way&lt;br&gt;
&amp;gt; to apply Cramer's Rule to Solve these equations ???&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Any help would be appreciated !!&lt;br&gt;
&amp;gt; Thanks !&lt;br&gt;
&amp;gt; Ashwini&lt;br&gt;
&amp;gt; &lt;br&gt;
&lt;br&gt;
If you want to learn why Cramer's Rule is not a very good&lt;br&gt;
method numerically and why it is avoided, particularly for&lt;br&gt;
large problems, consider the code below and try it for&lt;br&gt;
inputs of 100, 200, 300, 400, 500, 600. The intermediate&lt;br&gt;
numbers get huge (eventually blows up), the timings get very&lt;br&gt;
long, and it is not as accurate as the built in MATLAB \&lt;br&gt;
operator. Like I said, it's slow, but it's inaccurate.&lt;br&gt;
&lt;br&gt;
James Tursa&lt;br&gt;
&lt;br&gt;
------------------------------&lt;br&gt;
&lt;br&gt;
function callcramer(m)&lt;br&gt;
disp(' ');&lt;br&gt;
A = rand(m,m);&lt;br&gt;
b = rand(m,1);&lt;br&gt;
disp('Timing backslash:');&lt;br&gt;
tic&lt;br&gt;
x = A\b;  % Backslash operator for solving A*x = b&lt;br&gt;
toc&lt;br&gt;
xc = cramersrule(A,b);&lt;br&gt;
disp(['norm of backslash residual     = '&lt;br&gt;
num2str(norm(A*x-b),4)]);&lt;br&gt;
disp(['norm of Cramer''s Rule residual = '&lt;br&gt;
num2str(norm(A*xc-b),4)]);&lt;br&gt;
disp(' ');&lt;br&gt;
return&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
function x = cramersrule(A,b)  % Demo of Cramer's Rule for&lt;br&gt;
solving A*x = b&lt;br&gt;
disp('Timing Cramer''s Rule:');&lt;br&gt;
tic&lt;br&gt;
[m n] = size(b);&lt;br&gt;
z = zeros(m,1);&lt;br&gt;
Ai = A;&lt;br&gt;
for k=1:m&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Ai(:,k) = b;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;z(k) = det(Ai);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Ai(:,k) = A(:,k);&lt;br&gt;
end&lt;br&gt;
detA = det(A);&lt;br&gt;
x = z / detA;&lt;br&gt;
toc&lt;br&gt;
disp(['Max abs(det(Ai)) = ' num2str(max(abs(z)),4)]);&lt;br&gt;
disp(['abs(det(A))      = ' num2str(abs(detA),4)]);&lt;br&gt;
return&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Thu, 15 May 2008 05:41:02 -0400</pubDate>
      <title>Re: Cramer's Rule - linear equations</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/169151#432144</link>
      <author>Ashwini Deshpande</author>
      <description>"James Tursa" &amp;lt;aclassyguywithaknotac@hotmail.com&amp;gt; wrote in&lt;br&gt;
message &amp;lt;g0e5ot$96$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; "Ashwini Deshpande" &amp;lt;vd.ashwini@mathworks.com&amp;gt; wrote in&lt;br&gt;
&amp;gt; message &amp;lt;g0bdna$rjm$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; I have three linear equations with 3 unknowns, say for&lt;br&gt;
&amp;gt; example:&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; 3x + 4y + 6z = 1; &lt;br&gt;
&amp;gt; &amp;gt; x - 2y + 7z = 10;&lt;br&gt;
&amp;gt; &amp;gt; 2x + 3y - 9z = 15;&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; How do i solve this using matlab, is there any easiest way&lt;br&gt;
&amp;gt; &amp;gt; to apply Cramer's Rule to Solve these equations ???&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Any help would be appreciated !!&lt;br&gt;
&amp;gt; &amp;gt; Thanks !&lt;br&gt;
&amp;gt; &amp;gt; Ashwini&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; If you want to learn why Cramer's Rule is not a very good&lt;br&gt;
&amp;gt; method numerically and why it is avoided, particularly for&lt;br&gt;
&amp;gt; large problems, consider the code below and try it for&lt;br&gt;
&amp;gt; inputs of 100, 200, 300, 400, 500, 600. The intermediate&lt;br&gt;
&amp;gt; numbers get huge (eventually blows up), the timings get very&lt;br&gt;
&amp;gt; long, and it is not as accurate as the built in MATLAB \&lt;br&gt;
&amp;gt; operator. Like I said, it's slow, but it's inaccurate.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; James Tursa&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; ------------------------------&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; function callcramer(m)&lt;br&gt;
&amp;gt; disp(' ');&lt;br&gt;
&amp;gt; A = rand(m,m);&lt;br&gt;
&amp;gt; b = rand(m,1);&lt;br&gt;
&amp;gt; disp('Timing backslash:');&lt;br&gt;
&amp;gt; tic&lt;br&gt;
&amp;gt; x = A\b;  % Backslash operator for solving A*x = b&lt;br&gt;
&amp;gt; toc&lt;br&gt;
&amp;gt; xc = cramersrule(A,b);&lt;br&gt;
&amp;gt; disp(['norm of backslash residual     = '&lt;br&gt;
&amp;gt; num2str(norm(A*x-b),4)]);&lt;br&gt;
&amp;gt; disp(['norm of Cramer''s Rule residual = '&lt;br&gt;
&amp;gt; num2str(norm(A*xc-b),4)]);&lt;br&gt;
&amp;gt; disp(' ');&lt;br&gt;
&amp;gt; return&lt;br&gt;
&amp;gt; end&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; function x = cramersrule(A,b)  % Demo of Cramer's Rule for&lt;br&gt;
&amp;gt; solving A*x = b&lt;br&gt;
&amp;gt; disp('Timing Cramer''s Rule:');&lt;br&gt;
&amp;gt; tic&lt;br&gt;
&amp;gt; [m n] = size(b);&lt;br&gt;
&amp;gt; z = zeros(m,1);&lt;br&gt;
&amp;gt; Ai = A;&lt;br&gt;
&amp;gt; for k=1:m&lt;br&gt;
&amp;gt;     Ai(:,k) = b;&lt;br&gt;
&amp;gt;     z(k) = det(Ai);&lt;br&gt;
&amp;gt;     Ai(:,k) = A(:,k);&lt;br&gt;
&amp;gt; end&lt;br&gt;
&amp;gt; detA = det(A);&lt;br&gt;
&amp;gt; x = z / detA;&lt;br&gt;
&amp;gt; toc&lt;br&gt;
&amp;gt; disp(['Max abs(det(Ai)) = ' num2str(max(abs(z)),4)]);&lt;br&gt;
&amp;gt; disp(['abs(det(A))      = ' num2str(abs(detA),4)]);&lt;br&gt;
&amp;gt; return&lt;br&gt;
&amp;gt; end&lt;br&gt;
&amp;gt; &lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Thanks one and all ...&lt;br&gt;
I solved my problem ..&lt;br&gt;
All the replies were useful...&lt;br&gt;
&lt;br&gt;
Ashwini&lt;br&gt;
&lt;br&gt;
</description>
    </item>
  </channel>
</rss>
