[scilab-Users] Problem with Floating point and determinant of a matrix
Manjusha Joshi
manjusha.joshi at gmail.com
Thu Dec 30 07:33:37 CET 2010
Hello,
>
>
>
> -->det(A)
> ans =
>
> 6.661D-16 <---------- it should be 0
>
> -->inv(A)
> ans =
>
> 10^15 *
>
> - 4.5035996 9.0071993 - 4.5035996
> 9.0071993 - 18.014399 9.0071993
> - 4.5035996 9.0071993 - 4.5035996 <---------- it should
> appear
> an error message because the matrix A is not invertible (or singular).
>
>
> -->det(inv(A))
> ans =
>
> 9.007D+15 <-------------- The determinant of invertible
> matrix A^(-1)
> does not exist.
>
> Other example:
>
> -->B = [1 1; 1 1]
> B =
>
> 1. 1.
> 1. 1.
>
> -->det(B)
> ans =
>
> 0. <-------- it is correct !!
>
> -->inv(B)
> !--error 19 <-------- it is correct !!
>
>
> The previously examples show two integer matrices A and B. The determinant
> of
> matrix A is quite zero, but not,
> and this can propagate an error in case the Scilab developer uses that
> result
> into other future calculations or algorithms.
> The determinant of matrix B is equal to 0 and the answer is correct. In
> case the
> Scilab developer uses that value,
> he or she can use the simple statement for testing like to:
> if ( det(matrix) <> 0 ) then
> <action 1> // The Scilab developer knows that the
> matrix is
> invertible (or nonsingular)
> else
> <action 2> // The Scilab developer knows that the
> matrix is
> not invertible (or singular)
> end
>
> My doubt: "How can I proceed to design any algorithm, which uses matrix, if
> the
> determinant of
>
> the matrix could not be zero and, as the same time, that matrix is not
> invertible ?".
> How can I manage this uncertainty ?
>
>
clean(det(A))
clean(inv(B))
This will return value as zero if it is near to zero.
--
Manjusha S. Joshi
P.I. of project on Use of Open source software for Teaching Maths,
http://fossme.bprim.org
Lecturer in Computational Mathematics,
BIM, Pune, India. www.bprim.org
Mobile: 09822 319328
blog:http://manjushajoshi.wordpress.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20101230/03e24157/attachment.htm>
More information about the users
mailing list