rtoy / maxima

A Clone of Maxima's repo
Other
0 stars 0 forks source link

Inconsistencies in noun/verb #1388

Open rtoy opened 3 weeks ago

rtoy commented 3 weeks ago

Imported from SourceForge on 2024-07-04 14:06:46 Created by macrakis on 2003-03-28 19:58:07 Original: https://sourceforge.net/p/maxima/bugs/280


-- nounify(diff) displays as derivative when display2d is true, and diff when display2d is false.

-- In some cases, the noun form is spelled differently from the verb form. This can be handy, though it is confusing. For example, "IF" has a convenient noun form, COND, so you can write COND(a,b,c) without getting an error ("unable to evaluate predicate").
However, though the noun form of DIFF displays as DERIVATIVE, when Maxima reads in DERIVATIVE, it in fact uses the verb form DIFF. Example:

if(1<2,a,b) => a Verb form nounify("IF") => COND (%cond) (nounify("IF"))(a,b) Noun form cond(1<2,a,b) => cond(1<2,a,b) Noun form part(_,0) => cond Noun form

diff(x^2,x) => 2*x Verb form nounify('diff) => DERIVATIVE (%derivative) (nounify('diff))(x^2,x) Noun form derivative(x^2,x) => 2*x Verb form part(_,0) => diff Verb form

-- apply_nouns is documented, but nowhere defined

-- Noun/verb behavior of operators like "+" and "IF" is messed up:

-- ev( (' "+")(x,x), nouns) returns +(x,x) instead of 2*x.
This is because (' "+")(x,y) gives ((&+) x y). It should give the same thing as (nounify("+"))(x,y), namely ((% mplus simp) x y).

-- Similarly for "IF".

-- I haven't tested thoroughly, but there seem to be similar confusions for "DO"/MDO, ":"/SETQ, etc.

rtoy commented 3 weeks ago

Imported from SourceForge on 2024-07-04 14:06:47 Created by macrakis on 2003-03-28 22:34:31 Original: https://sourceforge.net/p/maxima/bugs/280/#a1d1


Logged In: YES user_id=588346

I spoke too soon about the "convenience" of COND.

verbify(COND) and verbify(nounify(COND)) give %COND rather than MCOND as they should, so COND(a,b,c) doesn't get an error because it has nothing to do with IF/MCOND.

rtoy commented 3 weeks ago

Imported from SourceForge on 2024-07-04 14:06:50 Created by macrakis on 2003-08-30 21:31:01 Original: https://sourceforge.net/p/maxima/bugs/280/#2de0


Logged In: YES user_id=588346

The semantics of noun/verb are pretty unclear.

In the case of trig functions, verbs return floating-point results: (verbify('sin))(0) => 0.0; but not for elementary arithmetic: (verbify('"+"))(0,4) => 4.

In the case of trig functions, nouns simplify: (nounify('sin))(% pi) => 0; but not for elementary arithmetic: (nounify('"+")) (4,5) => PLUS(4,5).

rtoy commented 3 weeks ago

Imported from SourceForge on 2024-07-04 14:06:54 Created by macrakis on 2003-12-21 20:43:34 Original: https://sourceforge.net/p/maxima/bugs/280/#c647


Logged In: YES user_id=588346

In general, the noun/verb forms for infix operators are screwed up:

I was going to write up a detailed analysis, but it is too much of a mess. Here is a transcript showing some of the peculiar cases:

(C17) ?print([">",verbify(">"),nounify(">")]);

((MLIST SIMP) &> MGREATERP %GREATERP) (D17) [>, ">", GREATERP] (C18) string(%); (D18) [">",?MGREATERP,GREATERP] (C19) is(nounify(">")=GREATERP); (D19) FALSE (C20) is(nounify(">")=greaterp); (D20) FALSE (C21) ?print(["+",verbify("+"),nounify("+")]);

((MLIST SIMP) &+ MPLUS %PLUS) (D21) [+, "+", PLUS] (C22) string(%); (D22) ["+",?MPLUS,PLUS] (C23) ["+"(a,b),'"+"(a,b),?MPLUS(a,b),PLUS(a,b)]; (D23) [b + a, PLUS(a, b), b + a, PLUS(a, b)] (C24) map(op,%); (D24) [+, PLUS, +, PLUS] (C25) ?print(%);

((MLIST SIMP) &+ %PLUS &+ $PLUS) (D25) [+, PLUS, +, PLUS] (C26)

rtoy commented 3 weeks ago

Imported from SourceForge on 2024-07-04 14:06:57 Created by robert_dodier on 2004-11-25 18:02:15 Original: https://sourceforge.net/p/maxima/bugs/280/#1d70


Logged In: YES user_id=501686

Description of "apply_nouns" has been struck from doc/info/Simplification.texi.

rtoy commented 3 weeks ago

Imported from SourceForge on 2024-07-04 14:07:01 Created by robert_dodier on 2006-07-06 05:42:02 Original: https://sourceforge.net/p/maxima/bugs/280/#3366