<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Matrix from variables in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Matrix-from-variables/m-p/594033#M79792</link>
    <description>&lt;P&gt;If I defined variables&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;a=5;
b=3;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;what is the fastest/most elegant way to get?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;m = [5,3]&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Is there something better than&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;m= Matrix(Eval({a,b}));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;And why does&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;m=[Eval(a),Eval(b)]&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;not work?&lt;BR /&gt;&lt;BR /&gt;Any links to related posts are welcome :)&lt;/img&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 08 Jun 2023 16:40:28 GMT</pubDate>
    <dc:creator>hogi</dc:creator>
    <dc:date>2023-06-08T16:40:28Z</dc:date>
    <item>
      <title>Matrix from variables</title>
      <link>https://community.jmp.com/t5/Discussions/Matrix-from-variables/m-p/594033#M79792</link>
      <description>&lt;P&gt;If I defined variables&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;a=5;
b=3;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;what is the fastest/most elegant way to get?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;m = [5,3]&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Is there something better than&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;m= Matrix(Eval({a,b}));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;And why does&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;m=[Eval(a),Eval(b)]&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;not work?&lt;BR /&gt;&lt;BR /&gt;Any links to related posts are welcome :)&lt;/img&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jun 2023 16:40:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Matrix-from-variables/m-p/594033#M79792</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2023-06-08T16:40:28Z</dc:date>
    </item>
    <item>
      <title>Re: Matrix from variables</title>
      <link>https://community.jmp.com/t5/Discussions/Matrix-from-variables/m-p/594079#M79796</link>
      <description>&lt;P&gt;For me, the easiest way to get to the result is&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;m=matrix(a) |/ matrix(b);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 27 Jan 2023 14:41:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Matrix-from-variables/m-p/594079#M79796</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2023-01-27T14:41:57Z</dc:date>
    </item>
    <item>
      <title>Re: Matrix from variables</title>
      <link>https://community.jmp.com/t5/Discussions/Matrix-from-variables/m-p/594089#M79797</link>
      <description>&lt;P&gt;oh, Matrix evaluates the list? got it!&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_0-1674830940841.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/49532i15A375331B9C81B2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_0-1674830940841.png" alt="hogi_0-1674830940841.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Then&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;m= Matrix({a,b});&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;works as well :)&lt;/img&gt;&lt;BR /&gt;&lt;BR /&gt;And what's the reason that&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;m=[Eval(a),Eval(b)]&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;doesn't work?&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jan 2023 14:49:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Matrix-from-variables/m-p/594089#M79797</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2023-01-27T14:49:28Z</dc:date>
    </item>
    <item>
      <title>Re: Matrix from variables</title>
      <link>https://community.jmp.com/t5/Discussions/Matrix-from-variables/m-p/594389#M79815</link>
      <description>&lt;P&gt;Using &lt;CODE class=" language-jsl"&gt;Matrix( {a, b} )&lt;/CODE&gt; is probably the easiest way. One way that I use commonly is &lt;CODE class=" language-jsl"&gt;[](0,1) |/ a |/ b&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-jsl"&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;As for your second question, matrices are special in JSL and are not evaluated as you would expect. Normally you can put a JSL expression anywhere in the JSL script and only the final argument would get returned. However, with matrices (probably for the code to be more optimized and speedy), you cannot put expressions in the matrix elements and expect that it will be populated with the number returned by that expression. Expressions are strictly _not_ allowed in matrices, only numbers are allowed. This is also why variables don't work within matrices, as variables only make sense when they are evaluated as an expression.&lt;/P&gt;</description>
      <pubDate>Sat, 28 Jan 2023 00:03:48 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Matrix-from-variables/m-p/594389#M79815</guid>
      <dc:creator>ErraticAttack</dc:creator>
      <dc:date>2023-01-28T00:03:48Z</dc:date>
    </item>
    <item>
      <title>Re: Matrix from variables</title>
      <link>https://community.jmp.com/t5/Discussions/Matrix-from-variables/m-p/594412#M79818</link>
      <description>&lt;P&gt;OK understood.Thanks a lot for the explanation.&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/26363"&gt;@ErraticAttack&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;you cannot put expressions in the matrix elements and expect that it will be populated with the number returned by that expression.&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Is a good wording :)&lt;/img&gt;&lt;BR /&gt;It could work but you cannot expect that it will work:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;a=5;
matrix(a/b); // -&amp;gt; works&lt;BR /&gt;matrix(char(a)) // -&amp;gt; doesn't 
matrix({char(a)})&amp;nbsp;//&amp;nbsp;--&amp;gt;&amp;nbsp;doesn't&amp;nbsp;(I&amp;nbsp;hoped&amp;nbsp;this&amp;nbsp;could&amp;nbsp;be&amp;nbsp;a&amp;nbsp;workaround&amp;nbsp;...)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;CODE class=" language-jsl"&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;CODE class=" language-jsl"&gt;So&amp;nbsp;..&lt;/CODE&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/26363"&gt;@ErraticAttack&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;Expressions are strictly _not_ allowed in matrices, only numbers are allowed.&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;seems to be slightly too strict - but a good approach "to be on the safe side"&lt;BR /&gt;&lt;CODE class=" language-jsl"&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 28 Jan 2023 11:04:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Matrix-from-variables/m-p/594412#M79818</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2023-01-28T11:04:57Z</dc:date>
    </item>
    <item>
      <title>Re: Matrix from variables</title>
      <link>https://community.jmp.com/t5/Discussions/Matrix-from-variables/m-p/594796#M79868</link>
      <description>&lt;P&gt;It's amazing that&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;[](0,1) |/ a |/ b&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;works. That means, it automatically evaluates the arguments and converts them into a matrix?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;a= {{5,3}}
b = {{7 ,6}}
[](0,2) |/ a |/ b&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While sharing my learning with my colleagues I noticed:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Up to now, I thought that [a, b] is just a short form of the constructor &lt;STRONG&gt;matrix({a,b})&lt;/STRONG&gt;.&lt;BR /&gt;But it's the &lt;STRONG&gt;&lt;EM&gt;result&lt;/EM&gt;&lt;/STRONG&gt;, right?&lt;BR /&gt;&lt;BR /&gt;Now I &lt;EM&gt;really&lt;/EM&gt; understand what you mean::&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;A href="https://community.jmp.com/t5/user/viewprofilepage/user-id/26363" target="_blank"&gt;@ErraticAttack&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;wrote:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;you cannot put expressions in the matrix &lt;EM&gt;&lt;STRONG&gt;elements&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Then the examples in my last post don't make sense. They just don't work because the matrix() function doesn't have a function to &lt;STRONG&gt;set non-numerical values to "."&lt;/STRONG&gt; (missing) - compare the original topic.&lt;BR /&gt;&lt;BR /&gt;By the way:&lt;BR /&gt;I am a bit surprised to see the result of&amp;nbsp;&lt;FONT face="courier new,courier"&gt;matrix(3)&lt;/FONT&gt;. Kind of an easter egg ?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jan 2023 10:24:46 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Matrix-from-variables/m-p/594796#M79868</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2023-01-30T10:24:46Z</dc:date>
    </item>
    <item>
      <title>Re: Matrix from variables</title>
      <link>https://community.jmp.com/t5/Discussions/Matrix-from-variables/m-p/595424#M79916</link>
      <description>&lt;P&gt;What do you think about&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;a=5;
b=3;
m=matrix(a) |/b &amp;nbsp;//-&amp;gt;&amp;nbsp;works&amp;nbsp;!?!&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;a combination of all &lt;EM&gt;riddles&lt;/EM&gt; in one expression :)&lt;/img&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2023 11:43:12 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Matrix-from-variables/m-p/595424#M79916</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2023-01-31T11:43:12Z</dc:date>
    </item>
  </channel>
</rss>

