On 3/2/2011 11:51 PM, redneb at gmx.com wrote:
> On Wed, Mar 02, 2011 at 10:57:57PM -0800, Richard Fateman wrote:
>> On 3/2/2011 10:43 PM, redneb at gmx.com wrote:
>>> Hello all,
>>>
>>> When I enter "factor(6)" in maxima it returns "2*3" (with display2d
>>> set to false). I am trying to write a function that does the same
>>> thing, ie it returns a product as a noun. But when I define for example
>>>
>>> f(x,y) := '"*"(x,y)
>>>
>>> then f(2,3) returns
>>>
>>> '?mtimes(2,3)
>>
>> no, it should return 6. It does that for me.
>
> There is a (single) quote in front of "*".
>
>
>>>
>>> and not 2*3. How does factor do it?
>>
>> type
>> factor(6);
>> ?print(%)
>>
>>
>> The factor program puts a "simp" indicator on the result, i.e. ((mtimes
>> simp) 2 3)
>> even though the expression is not really simplified.
>>
>
> Ok, so is there a way I can insert a simp indicator just like factor
> does? Do I have to do it lisp?
If you use this idea, I think you probably need a one-line lisp program.
You can use the ide you propose, which is equivalent to
q: nounify(?mtimes)
q(1,2,3)
%,eval
which uses a different mechanism, which is a noun form of "*". I did
not realize
it existed. But a function like q, above, seems to be what you need.
RJF