Subject: mailing-list for TeXmacs Users
List archive
From : TeXmacs <address@hidden>- To: address@hidden
- Subject: Re: Trying to invert matrix. Is it a bug or something else?
- Date: Sat, 12 Dec 2020 16:58:03 +0100
Hi Michail,
This is in fact more of a Scheme question than a TeXmacs question.
In Scheme, one has both 'exact' and 'inexact' numbers.
When writing linear algebra algorithms, you might prefer to
work with inexact numbers (like 1.0, 2.0, 3.14, etc.).
Note that TeXmacs also supports sessions for other languages/systems,
such as Python, Maxima, etc. Some of these languages/systems provide
ready-to-use libraries for linear algebra.
Best wishes, --Joris
On Sat, Dec 12, 2020 at 08:25:13PM +0500, Михаил Бахтерев wrote:
> Greeting, TeXmacs users!
>
> I'm relearning linear algebra algorithms for my current project,
> and i've found, that TeXmacs good for «notepad» workflows, so
> i'm using it to visualise matrices and other relative data.
>
> But i'm hit strange error, and cannot understand what is causing
> it.
>
> Attachment contains the Scheme code, which implements inverse
> matrix calculation via lup decomposition (Cormen algorithm).
> When i run this code (see the Testing section at the end of
> file) with Guile Scheme from console, i always get expected
> results. For instance
>
> $ guile mmul.scm
> (4798812820 2947166038 8605901937 1668829253) ; <- this is the A matrix
> (3262456359 8838015003 1557481481 3270092634)
> (171172813 9409289762 1357419403 4800934199)
> (9432354808 1354480021 2510360485 5482916884)
>
> (9432354808 1354480021 2510360485 5482916884) ; <- this is reconstructed P
> * A matrix
> (171172813 9409289762 1357419403 4800934199)
> (4798812820 2947166038 8605901937 1668829253)
> (3262456359 8838015003 1557481481 3270092634)
>
> 3 ; <- This is P matrix representation
> 2
> 0
> 1
> 7
>
> (1 0 0 0) ; <- this is A * (inverse A)
> (0 1 0 0)
> (0 0 1 0)
> (0 0 0 1)
>
> But, when i load this code in TeXmacs Scheme session i get
> strange console output. For instance (in the result of
> evaluating (load "mmul.scm"))
>
> WARNING: (guile-user): `receive' imported from both (kernel boot srfi) and
> (ice-9 receive)
> (1824518241 5458396045 2655456309 6130377838)
> (2647726516 8160738062 4747358222 9690212499)
> (3133317917 5397980949 743583991 8628595145)
> (7288149089 9806540532 4929698641 2481269591)
>
> (7288149089 9806540532 4929698641 2481269591)
> (850281521796992308/7288149089
> -433474879616604043800916553102/2223115077637124927
> 16719259231553166563679395186/2223115077637124927
> -514716152454708799741106682579/2223115077637124927)
> (1824518241 5458396045 2655456309 6130377838)
> (3133317917 -286725186406368577856421475029/2223115077637124927 743583991
> 8628595145)
>
> 3
> 1
> 0
> 2
> 6
>
> (1 0 0 0)
> (17072928790327166778760849184501179449622921216/9309701256049657709054838362264082416807641613
>
> -2033734070649485744757270652366904646568574451/9309701256049657709054838362264082416807641613
>
> 745398178510862613887104599240022568088895488/9309701256049657709054838362264082416807641613
>
> -473525573379058173074395000195796253280305152/9309701256049657709054838362264082416807641613)
> (0 0 1 0)
> (0 0 0 1)
>
> I do not understand completely, what is going on and what is
> the problem. May anyone provide any help?
>
> - MB. Respectfully
>
> P.S. If this is important, TeXmacs version is 1.99.15. The
> system is X86_64 ArchLinux
- Trying to invert matrix. Is it a bug or something else?, Михаил Бахтерев, 12/12/2020
- Re: Trying to invert matrix. Is it a bug or something else?, Михаил Бахтерев, 12/12/2020
- Re: Trying to invert matrix. Is it a bug or something else?, TeXmacs, 12/12/2020
Archive powered by MHonArc 2.6.19.