|
From: Richard F. <fa...@be...> - 2016-03-31 19:15:24
|
maybe lisp #c(1 3) should print in Maxima as escaped lisp... e.g. ?complex(1,3) Actually, typing k: ?complex(1,3) is an even simpler way to create k. Along these lines, is there any reason to print ?foo(x) as foo(x)? It is hard to explain the display foo(x)-?foo(x). Internally there are two function names, distinct. $foo and foo. Externally, why not use foo and ?foo for them? And for the rational number created in Lisp by typing 3/4 we could display ?/(3,4), rather than making believe it is the same as Maxima's 3/4. At least until, as Ray says, everything works the same regardless. So here's the proposal, which should break nothing that already exists: change nformat so that lisp ((foo) ....) is printed as ?foo( ....) change nformat and/or wxformat so that common lisp #c(1 3) is printed as ?complex(1,3) change nformat and/or wxformat so that common lisp 3/4 is printed as ?/(3,4) Oh, why I care ... messing around with intervals, computing sqrt( [-2,2]) produced complex numbers, but I was not prepared for non-real results.... FYI, I thought this could all be fixed by changing a function in suprv1.lisp called appropriately enough, stripdollar. So I traced it. Not the answer. More later. Richard On 3/31/2016 11:19 AM, Raymond Toy wrote: >>>>>> "Richard" == Richard Fateman <fa...@be...> writes: > Richard> It is possible to construct complex numbers in lisp (though so far we have > Richard> mostly avoided it....) . The simplest way is > > Richard> :lisp (setf $k #c(1 3) > > Richard> now > Richard> k; prints as 3 %i+1 > > I wish maxima didn't do that. Well, as long as maxima doesn't really > operate with Lisp complex numbers. > > Richard> however, k -3*%i -1 > Richard> prints as 0 + 3 %i - 3 %i. > > Richard> There are other anomalies, such as > > Richard> ratcoef(k,%i) returns 0. > Richard> k+1/2 signals an error. > Richard> sin(k) signals an error > > We should probably fix those. For k+1/2, the error comes from trying > to print k+1/2 which has somehow been computed as ((rat simp) #c(3 6) > 2) and printing wants to compare #c(3 6) with 0. > > sin(k) fails trying to apply the reflection formula and ends up > comparing (in lisp) #c(-2 -6) and 0. I have no idea where the #c(-2 > -6) comes from. > > -- > Ray > > |