help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Wrong results for "Large" simultaneous equation calculation


From: David Parman
Subject: Re: Wrong results for "Large" simultaneous equation calculation
Date: Sun, 17 Jan 2010 09:13:12 -0800


On Sat, Jan 16, 2010 at 7:36 PM, Ben Abbott <address@hidden> wrote:
On Jan 16, 2010, at 1:09 PM, David Parman wrote:
>>
>> On Fri, Jan 15, 2010 at 4:20 PM, Ben Abbott <address@hidden> wrote:
>> On Jan 15, 2010, at 5:58 PM, David Parman wrote:
>>
>> > I am new to Octave, and ran into a problem with my first real application. I am working with a large (120x120) set of simultaneous equations. When I solve the equations using the A\b nomenclature, I get an answer - no complaints from Octave. But the answer is clearly very wrong - all of the values are about 6 or more orders of magnitude smaller than they should be. I have the same set of calculations in MathCad, which yields an appropriate solution. I can also approximate the solution using direct analytical approach, which also confirms that the Octave result is way off.
>> >
>> > I found a couple of examples online for this type of solution (small 2x2 and 3x3 examples, one of which had the wrong answer on the webpage - confirmed by Octave and MathCad). These all worked just fine, but they have "nice" values (some of my values can be very large numbers, on the order of 10^18).
>> >
>> > I have spot checked the matrices and the values appear to be exactly the same in Octave as they are in MathCad. Does anybody have an idea what I might be missing here?
>>
>> Unfortunately if you don't give us an example that doesn't work, no one will be able to help.
>>
>> Fortunately, you can easily provide your example :-)
>>
>> If the matrix is only 120x120, try  ...
>>
>>        save example.mat A b
>>
>> ... and attach example.mat to your reply.
>>
>> Ben
>
> Ben,
>
> Attached is the file. Any advice you can give will be greatly appreciated.


The error looks quite reasonable to me.

       octave:111> norm (A*(A\b)-b) / max (b)
       ans =  8.0399e-14

I don' t see how Octave's solution can be off by 6 orders of magnitude ... hmmm, I'm running the developers sources, what version of Octave are you running?

Ben

p.s. please <reply-all> and respond at the bottom so that others may follow along.





I have version 3.0.5, running on Ubuntu 9.10. I get the same answer as you for the above test.

Looking over the part of my program that builds the matrices (unfortunately, that part I cannot share), I did find that I had a sign error on the first element of b (should be -2000). When I fixed that, I still get an incorrect solution, but now I get a divide by zero error when I test the solution.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]