From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,URIBL_SBL_A autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 1918 invoked from network); 2 Oct 2023 01:22:50 -0000 Received: from cgl.ntg.nl (5.39.185.202) by inbox.vuxu.org with ESMTPUTF8; 2 Oct 2023 01:22:50 -0000 Received: from localhost (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id 213DE48316C for ; Mon, 2 Oct 2023 03:22:42 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at cgl.ntg.nl Received: from cgl.ntg.nl ([127.0.0.1]) by localhost (cgl.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Ax_z_CR6-elo for ; Mon, 2 Oct 2023 03:22:41 +0200 (CEST) Received: from cgl.ntg.nl (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id 25EA54832E2 for ; Mon, 2 Oct 2023 03:20:27 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id 1D0BA482FF4 for ; Mon, 2 Oct 2023 03:20:04 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at cgl.ntg.nl Received: from cgl.ntg.nl ([127.0.0.1]) by localhost (cgl.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ntCjLiK5n599 for ; Mon, 2 Oct 2023 03:20:03 +0200 (CEST) X-Greylist: delayed 353 seconds by postgrey-1.36 at cgl.ntg.nl; Mon, 02 Oct 2023 03:20:03 CEST Received: from pv50p00im-ztdg10012001.me.com (pv50p00im-ztdg10012001.me.com [17.58.6.51]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by cgl.ntg.nl (Postfix) with ESMTPS id 63885482FF0 for ; Mon, 2 Oct 2023 03:20:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mac.com; s=1a1hai; t=1696209249; bh=++h0A71D5sijoW6dn/my2qdBeCkDNa3WWvGpYT268zE=; h=From:Content-Type:Mime-Version:Subject:Date:To:Message-Id; b=LiiQ6g0KPWbzuLqEmd5y+y8gJfNQsKb5z7lrzdxQrFdR+s+Vjm2n12w17xyvaiAco SN0PL0spuVVD+dvJTnJUeDrxsEAP2aIK1aZUSmTT8P1u717ftO2FLh3Dn3EHjbDdJL Ypg+drd3DOSD80HYgc6K6SOF0L48fx1Wf5KwQxNJFqzFxNZW4VYtqmc9tGm3FO0GD2 mi5b5tBE9VZYp7dDGuJHDwin8HWvGUjd2qPHcuUynejFGCwr3YK+EZfdxvPrPGrs7E 9OTETICnVOdBH6gpcVJ1GhZpxn+6CZtvS3mep8xyF0Qyn+EUF0dqx3Csncqsd3QR3k 10B8S0kCqyjqA== Received: from smtpclient.apple (pv50p00im-dlb-asmtp-mailmevip.me.com [17.56.9.10]) by pv50p00im-ztdg10012001.me.com (Postfix) with ESMTPSA id 8304FA012A for ; Mon, 2 Oct 2023 01:14:08 +0000 (UTC) Content-Type: multipart/mixed; boundary="Apple-Mail=_903A9764-CC7C-4354-8839-74CACB2FF90C" Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.15\)) Date: Mon, 2 Oct 2023 10:14:03 +0900 References: <2503d184-6256-1cec-1480-2b0faa377a0f@fiee.net> <51D9198A-B87D-4F8E-9599-1FC86D7EFA1B@gmail.com> To: mailing list for ConTeXt users In-Reply-To: Message-Id: <3762160F-54D6-41B1-9101-64B71173E89C@mac.com> X-Mailer: Apple Mail (2.3654.120.0.1.15) X-Proofpoint-ORIG-GUID: fawlwmhznDo2uQSsjdxRTgsmxI2Evri7 X-Proofpoint-GUID: fawlwmhznDo2uQSsjdxRTgsmxI2Evri7 X-Proofpoint-Virus-Version: =?UTF-8?Q?vendor=3Dfsecure_engine=3D1.1.170-22c6f66c430a71ce266a39bfe25bc?= =?UTF-8?Q?2903e8d5c8f:6.0.138,18.0.572,17.11.64.514.0000000_definitions?= =?UTF-8?Q?=3D2020-02-14=5F11:2020-02-14=5F02,2020-02-14=5F11,2022-02-23?= =?UTF-8?Q?=5F01_signatures=3D0?= X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxlogscore=999 adultscore=0 clxscore=1015 malwarescore=0 mlxscore=0 phishscore=0 suspectscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2310020008 Message-ID-Hash: G5MUV5DC75MPYAVNHJHJOCHBFVOR5CWE X-Message-ID-Hash: G5MUV5DC75MPYAVNHJHJOCHBFVOR5CWE X-MailFrom: haksan@mac.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list Reply-To: mailing list for ConTeXt users Subject: [NTG-context] Re: wiki update: Modules List-Id: mailing list for ConTeXt users Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Jeong Dal via ntg-context Cc: Jeong Dal --Apple-Mail=_903A9764-CC7C-4354-8839-74CACB2FF90C Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Dear Hraban, When I wrote a class material for Linear Algebra, it is nice to use = \pmatrix and \bmatrix etc.=20 But, for example, to write a result matrix of the product of two = matrices, I need to calculate it somewhere and copy it to my text. = Hence, I tried to use Lua to handle it in the ConTeXt. And, it is nicely = working. During the process, I asked many questions to Hans and he gladly helped = me. It is the first time for me to code using Lua, so my coding was clumsy. = However, Hans corrected it to be usable in ConTeXt even though he is = very very busy in many things. And, he made it a module and put it in the list. Thanks Hans. Finally I finished several chapters on Linear Algebra using that code. It was many years ago. Here is a document of it. I confirm that it is running well without any = problem. I hope that someone who wants to write an article on Linear Algebra use = it. Thanks for reading. Best regards, Dalyoung --Apple-Mail=_903A9764-CC7C-4354-8839-74CACB2FF90C Content-Disposition: attachment; filename=matrixDoc.tex Content-Type: application/octet-stream; x-unix-mode=0644; name="matrixDoc.tex" Content-Transfer-Encoding: 7bit \usemodule[m-matrix] \usemodule[art-01] \starttext \startluacode document.DemoMatrixA = { { 0, 2, 4, -4, 1 }, { 0, 0, 2, 3, 4 }, { 2, 2, -6, 2, 4 }, { 2, 0, -6, 9, 7 }, { 2, 3, 4, 5, 6 }, { 6, 6, -6, 6, 6 }, } document.DemoMatrixB = { { 0, 2, 4, -4, 1 }, { 0, 0, 2, 3, 4 }, { 2, 2, -6, 3, 4 }, { 2, 0, -6, 9, 7 }, { 2, 2, -6, 2, 4 }, } document.DemoMatrixC = { { 3, 3, -1, 3 }, { -1, 4, 1, 3 }, { 5, 4, 0, 2 }, { 2, 4, 0, -1 }, } \stopluacode \startbuffer[demo] \typebuffer \startalignment[middle] \dontleavehmode\inlinebuffer \stopalignment \stopbuffer \setuphead[section][before={\testpage[5]\blank[2*big]}] \startsubject[title={A symbolic matrix}] \startbuffer \ctxmodulematrix{typeset(moduledata.matrix.symbolic("a", "m", "n"))} $\qquad\qquad$ \ctxmodulematrix{typeset(moduledata.matrix.symbolic("a", "m", "n", 4, 8))} \stopbuffer \getbuffer[demo] \stopsubject \startsubject[title={Generate a new $m \times n$ matrix}] \startbuffer \startluacode moduledata.matrix.typeset(moduledata.matrix.makeR(4,3, 0,5)) context.qquad() context("\\qquad") moduledata.matrix.typeset(moduledata.matrix.makeR(5,5,-1,5)) \stopluacode \stopbuffer \getbuffer[demo] \stopsubject \startsubject[title={Swap two rows (ex: 2 and 4)}] \startbuffer \startluacode moduledata.matrix.typeset(document.DemoMatrixA) context("$\\qquad \\Rightarrow \\qquad$") moduledata.matrix.typeset(moduledata.matrix.swaprows(document.DemoMatrixA,2,4)) \stopluacode \stopbuffer \getbuffer[demo] \stopsubject \startsubject[title={Swap two columns (ex: 1 and 3)}] \startbuffer \startluacode moduledata.matrix.typeset(document.DemoMatrixA) context("$\\qquad \\Rightarrow \\qquad$") moduledata.matrix.typeset(moduledata.matrix.swapcolumns(document.DemoMatrixA,1, 3)) \stopluacode \stopbuffer \getbuffer[demo] \stopsubject \startsubject[title={Multiply 3 to row 2($3 \times r_2$)}] \startbuffer \startluacode moduledata.matrix.typeset(document.DemoMatrixA) context("$\\qquad \\Rightarrow \\qquad$") moduledata.matrix.typeset(moduledata.matrix.multiply(document.DemoMatrixA,2,3)) \stopluacode \stopbuffer \getbuffer[demo] \stopsubject \startsubject[title={Add 4 times of row 3 to row 2($r_2 + 4 \times r_3$)}] \startbuffer \startluacode moduledata.matrix.typeset(document.DemoMatrixA) context("$\\qquad \\Rightarrow \\qquad$") moduledata.matrix.sumrow(document.DemoMatrixA,2,3,4) moduledata.matrix.typeset(document.DemoMatrixA) \stopluacode \stopbuffer \getbuffer[demo] \stopsubject \startsubject[title={Transpose a matrix}] \startbuffer \startluacode moduledata.matrix.typeset(document.DemoMatrixA) context("$\\qquad \\Rightarrow \\qquad$") moduledata.matrix.typeset(moduledata.matrix.transpose(document.DemoMatrixA)) \stopluacode \stopbuffer \getbuffer[demo] \stopsubject \startsubject[title={The inner product of two vectors}] \startbuffer \startluacode context("$<1,2,3> \\cdot <3,1,2> \\ =\\ $ ") context( moduledata.matrix.inner({ 1, 2, 3 }, { 3, 1, 2 })) \stopluacode \stopbuffer \getbuffer[demo] \startbuffer \startluacode context("$<1,2,3> \\cdot <3,1,2,4> \\ =\\ $ ") context(moduledata.matrix.inner({ 1, 2, 3 }, { 1, 2, 3, 4 })) \stopluacode \stopbuffer \getbuffer[demo] \stopsubject \startsubject[title={The product of two matrices}] \startbuffer \startluacode context("$\\ $") moduledata.matrix.typeset(document.DemoMatrixB) context("$\\cdot$") moduledata.matrix.typeset(document.DemoMatrixA) context("$ = $") moduledata.matrix.typeset(moduledata.matrix.product (document.DemoMatrixB,document.DemoMatrixB)) \stopluacode \stopbuffer \getbuffer[demo] \stopsubject \startsubject[title={An Upper Triangular Matrix}] \startbuffer \startluacode moduledata.matrix.typeset(document.DemoMatrixB) context("$\\qquad \\Rightarrow \\qquad$") moduledata.matrix.typeset(moduledata.matrix.uppertri(document.DemoMatrixB)) \stopluacode \stopbuffer \getbuffer[demo] \stopsubject \startsubject[title={Determinant: using triangulation}] \startbuffer \startluacode local m = { { 1, 2, 4 }, { 0, 0, 2 }, { 2, 2, -6 }, { 2, 2, -6 }, } moduledata.matrix.typeset(m, {fences="bars"}) context("$\\qquad = \\qquad$") context(moduledata.matrix.determinant(m)) \stopluacode \stopbuffer \getbuffer[demo] \startbuffer \startluacode moduledata.matrix.typeset(document.DemoMatrixC, { fences = "bars" }) context("$\\qquad = \\qquad$") context(moduledata.matrix.determinant(document.DemoMatrixC)) \stopluacode \stopbuffer \getbuffer[demo] \stopsubject \startsubject[title={Determinant: using Laplace Expansion}] \startbuffer \startluacode moduledata.matrix.typeset(document.DemoMatrixC, { fences = "bars" }) context("$\\qquad = \\qquad$") context(moduledata.matrix.laplace(document.DemoMatrixC)) \stopluacode \stopbuffer \getbuffer[demo] \stopsubject \startsubject[title={Example of Laplace Expansion using submatrix function}] \startbuffer \startluacode local m = { { 1, 5, 4, 2 }, { 5, 2, 0, 4 }, { 2, 2, 1, 1 }, { 1, 0, 0, 5 }, } local options = {fences = "bars"} moduledata.matrix.typeset(m,options) context("\\par $=$") for j = 1, #m[1] do local mm = moduledata.matrix.submatrix(m, 1, j) local factor = (-1)^(1+j) *(m[1][j]) context("\\ ($%d$) \\cdot ", factor) moduledata.matrix.typeset(mm, options) if j < #m[1] then context("\\ $+$ ") end end \stopluacode \stopbuffer \getbuffer[demo] \stopsubject \startsubject[title={Row echelon form}] \startbuffer \startluacode local m = { { 1, 3, -2, 0, 2, 0, 0 }, { 2, 6, -5, -2, 4, -3, -1 }, { 0, 0, 5, 10, 0, 15, 5 }, { 2, 6, 0, 8, 4, 18, 6 }, } moduledata.matrix.typeset(m) context("$\\Rightarrow$") moduledata.matrix.typeset(moduledata.matrix.rowechelon(m,1)) \stopluacode \stopbuffer \getbuffer[demo] \stopsubject \startsubject[title={Solving linear equation}] \startbuffer \startluacode local m = { { 1, 3, -2, 0 }, { 2, 0, 1, 2 }, { 6, -5, -2, 4 }, { -3, -1, 5, 10 }, } local c = { 5, 2, 6, 8 } moduledata.matrix.typeset(moduledata.matrix.solve(m,c)) context.blank() moduledata.matrix.typeset(moduledata.matrix.solve(m,c), { template = 6 }) context.blank() moduledata.matrix.typeset(moduledata.matrix.solve(m,c), { template = "no" }) context.blank() moduledata.matrix.typeset(moduledata.matrix.solve(m,c), { template = "%0.3f" }) context.blank() moduledata.matrix.typeset(moduledata.matrix.solve(m,c), { template = "%0.4F" }) \stopluacode \stopbuffer \getbuffer[demo] \stopsubject \startsubject[title={Inverse matrix}] \startbuffer \startluacode local m = { { 1, 1, 1 }, { 0, 2, 3 }, { 3, 2, 1 }, } context("$A =\\quad$") moduledata.matrix.typeset(m) context("$\\qquad A^{-1} = \\quad$") moduledata.matrix.typeset(moduledata.matrix.inverse(m)) context("\\blank\\ ") moduledata.matrix.typeset(m) context("$\\cdot$") moduledata.matrix.typeset(moduledata.matrix.inverse(m)) context("$ = $") moduledata.matrix.typeset(moduledata.matrix.product(m, moduledata.matrix.inverse(m))) \stopluacode \stopbuffer \getbuffer[demo] \stopsubject \startsubject[title={make matrices(zero, identiry, random)}] \startbuffer \startluacode moduledata.matrix.typeset(moduledata.matrix.makeM(3, 0)) context.qquad() moduledata.matrix.typeset(moduledata.matrix.makeM(3, 1)) context.qquad() moduledata.matrix.typeset(moduledata.matrix.makeR(4,3)) \stopluacode \stopbuffer \getbuffer[demo] \stopsubject \startsubject[title={join rows, join columns}] \startbuffer \startluacode local mat1, mat2 mat1 = moduledata.matrix.makeR(3, 4) mat2 = moduledata.matrix.makeR(4, 3) context("Appending as columns: ") context.blank() moduledata.matrix.typeset(mat1) context("$\\&$") moduledata.matrix.typeset(mat1) context("\\quad $\\Rightarrow$ \\quad") moduledata.matrix.joinColumns(mat1, mat1) moduledata.matrix.typeset(mat1) context.blank() context("Appending as rows: ") context.blank() moduledata.matrix.typeset(mat2) context("$\\&$") moduledata.matrix.typeset(mat2) context("\\quad $\\Rightarrow$ \\quad") moduledata.matrix.joinRows(mat2, mat2) moduledata.matrix.typeset(mat2) \stopluacode \stopbuffer \getbuffer[demo] \stopsubject \stoptext --Apple-Mail=_903A9764-CC7C-4354-8839-74CACB2FF90C Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > 2023. 10. 1. =EC=98=A4=ED=9B=84 6:01, Henning Hraban Ramm = =EC=9E=91=EC=84=B1: >=20 > Am 01.10.23 um 05:51 schrieb Otared Kavian: >> Hi Hraban, >> Thank you for your updating of the modules stuff. >> As far as I remember the matrix features are not related to any = modules, but rather are part of LMTX. In nay case next week I will look = at the page >> https://wiki.contextgarden.net/Matrix_in_maths = >> and verify that eveything on that page works fine and is up to date. >=20 > Thank you! >=20 > But there _is_ a matrix module (hey, I just looked through all this = stuff!) by Jeong Dalyoung & Hans; apparently it can do matrix = calculations. >=20 > = https://source.contextgarden.net/tex/context/modules/mkiv/m-matrix.mkiv >=20 > Hraban >=20 > = __________________________________________________________________________= _________ > If your question is of interest to others as well, please add an entry = to the Wiki! >=20 > maillist : ntg-context@ntg.nl / = https://www.ntg.nl/mailman/listinfo/ntg-context > webpage : https://www.pragma-ade.nl / http://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : https://contextgarden.net > = __________________________________________________________________________= _________ --Apple-Mail=_903A9764-CC7C-4354-8839-74CACB2FF90C Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___________________________________________________________________________________ --Apple-Mail=_903A9764-CC7C-4354-8839-74CACB2FF90C--