rtoy / maxima

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

tellsimp/tellsimpafter confused about noun/verb distinction #3796

Open rtoy opened 1 month ago

rtoy commented 1 month ago

Imported from SourceForge on 2024-07-08 17:03:12 Created by robert_dodier on 2005-05-16 14:40:41 Original: https://sourceforge.net/p/maxima/bugs/740


tellsimp and tellsimpafter are somewhat confused about the noun/verb distinction. The same rule name is constructed for both the noun and verb form of a function. (E.g., the rule is namd $FOORULE1 for both $FOO and %FOO.) However, the rule is associated with the operator name ($FOO or %FOO). I ran into this problem trying to make rules for "integrate".

This has following observable effect:

simp: false; tellsimpafter (foo(x), fooverb(x));
simp: true;

foo(x); => fooverb(x); /* OK */ 'foo(x); => 'foo(x) /* Hmm ... */

simp: false; tellsimpafter ('foo(x), foonoun(x)); simp: true;

foo (x); => foonoun(x) /* Hmm ...*/ 'foo(x); => foonoun(x) /* OK */

Either the noun and verb forms should (a) always be treated the same, or (b) always separately. (Behavior consistent with (a) is 'foo(x) => 'foo(x) in the first example, and foo(x) => foo(x) in the second. Behavior consistent with (b) is 'foo(x) => fooverb(x) in the first example, and foo(x) => foonoun(x) in the second.)

My recommendation at this point is to treat noun and verb forms by the same rule always. This can be effected by adding code to tellsimp and tellsimpafter to construct the verb or noun form from the noun or verb (resp), and assign the rule to both.

(The noun form of built-in operators is a little messy -- nounify ("+") => MPLUS, nounify("*") => MTIMES, etc. However, I recommend against special-casing built-in operators here.)

rtoy commented 1 month ago

Imported from SourceForge on 2024-07-08 17:03:13 Created by robert_dodier on 2006-08-12 15:22:09 Original: https://sourceforge.net/p/maxima/bugs/740/#05be