|
From: Barton W. <wi...@un...> - 2024-10-14 19:34:19
|
I use 'ev' to apply nouns, but not much else; for example:
(%i12) X : determinant(a);
(%o12) 'determinant(a)
(%i13) subst(a=matrix([1,2],[3,4]),X);
(%o13) 'determinant(matrix([1,2],[3,4]))
(%i14) ev(%,nouns);
(%o14) -2
The function 'makelist' is terribly useful, but I sometimes avoid it:
(%i15) load(integer_sequence)$
(%i16) map(lambda([q],q^2), 0 .. 9);
(%o16) [0,1,4,9,16,25,36,49,64,81]
--Barton
________________________________
From: Stavros Macrakis <mac...@gm...>
Sent: Monday, October 14, 2024 14:00
To: Eduardo Ochs <edu...@gm...>
Cc: <max...@li...> <max...@li...>; Robert Dodier <rob...@gm...>
Subject: Re: [Maxima-discuss] How do I translate the "ev" in "[a:b,b:c,c:d]; ev('[a,b,c],'a=42); " to a "subst"?
Caution: Non-NU Email
Internally makelist calls ev, but I've got to say that that shocks me even more than the fact that ev has bizarre behavior itself. In particular, I find this ridiculous:
makelist(['(x), '('x),'('('x))],'x,17,17) => [[17, '17, '('17)]]
Re using 'x as a variable in ev and makelist, I doubt that the implementers considered that case. It should probably raise an error.
Also, I don't know what you're trying to investigate by testing with ''a and ''''a. That syntax is evaluated at read, so those are precisely equivalent to b and c.
-s
On Sun, Oct 13, 2024 at 7:00 PM Eduardo Ochs <edu...@gm...<mailto:edu...@gm...>> wrote:
On Sun, 13 Oct 2024 at 18:24, Stavros Macrakis <mac...@gm...<mailto:mac...@gm...>> wrote:
To elaborate a bit on what Robert said, I strongly discourage you from using ev programmatically if there is some other way to accomplish what you want.
Hi all,
I only tried to use ev because the documentation of makelist -
from here:
(info "(maxima)makelist")
https://maxima.sourceforge.io/docs/manual/maxima_21.html#makelist<https://urldefense.com/v3/__https://maxima.sourceforge.io/docs/manual/maxima_21.html*makelist__;Iw!!PvXuogZ4sRB2p-tU!E8DB51pqACvJJe_rDtXYKNRBji_gCK9BtGTqBoMiSOjdTMtKffAdNfCRz_CvJYxVrufSDCD_KhCb104$>
says this:
The most general form, 'makelist (<expr>, <i>, <i_0>, <i_max>,
<step>)', returns the list of elements obtained when 'ev (<expr>,
<i>=<j>)' is applied to the elements <j> of the sequence: <i_0>,
<i_0> + <step>, <i_0> + 2*<step>, ..., with <|j|> less than or
equal to <|i_max|>.
and that gave me the impression that it was standard, or at least
common, to use ev to explain the semantics of special forms... but I
find ev very confusing - and I only tried to understand ev because
I tried this,
[a:'b, b:'c, c:'d]; /* [b,c,d] */
['a, a, ''a, ''''a]; /* [a,b,c,d] */
makelist([a,b,c], 'a, 42,43); /* [[42,c,d], [43,c,d]] */
makelist([a,b,c], a, 42,43); /* [[42,c,d], [43,c,d]] */
makelist([a,b,c], ''a, 42,43); /* [[b,42,d], [b,43,d]] */
makelist([a,b,c], ''''a, 42,43); /* [[b,c,42], [b,c,43]] */
and I found the result of the first makelist very surprising.
Anyway: now I have many more things in my to-do list... I need to
finish some experiments with Sly/Slime (urgent), understand the last
messages by Robert and Stavros (urgent), and learn how to use trace
(not urgent). =/
Cheers, thanks, etc...
Eduardo
|