Waldek Hebisch <[EMAIL PROTECTED]> writes:

> I must say that ATM I would prefer to postpone deeper changes to operators.

I'm not quite sure what you mean with "deeper changes"...

> Currenly have no clear idea which design is better.  There are few
> possibilities:
> 
> 1) each "functional" domain has its own oparators
> 2) common oparators but domain specific properties
> 3) common oparators including properties
> 
> Theoretically the first possibility is in spirit of other parts of
> Axiom/FriCAS.  But we clearly need to pass operators between domains, so
> first possibility means that we need some dictionaries to convert operators.
> In practice we are likely to use common dictionary or just use name for
> translation.  In other words the first variant looks rather impractical.  On
> the other hand second and third variant require coordination between domains.

I would suggest to leave the design as it is for the moment, since it's a
rather straightforward change to correct the problem with name capture for the
moment.  I checked this weekend the usage of is?:

the only place where we really want that is? tests name equality is in the
"operator" functions in COMBF, EF, etc.

In all the other places we want that the operators to be equal.

(Note that equality of user defined operators is usually the same as name
equality, since users typically do not put domain specific properties on their
operators...)

You find a small sample of my patch below.  I think it's not very pretty, but
at least it's correct.  Well, untested...  It should not have a big effect on
speed, here is the definition of equality of operators:

    op1 = op2 ==
      (EQ$Lisp)(op1, op2) => true
      name(op1) ^= name(op2) => false
      op1.narg ^= op2.narg => false
      brace(keys properties op1)^=$Set(Symbol) brace(keys properties op2) => 
false
      (func := property(op1, EQUAL?)) case None =>
                   ((func::None) pretend (($, $) -> Boolean)) (op1, op2)
      true

Of course, it means a little more time is spent in instantiation of domains,
but I think it will be negligible.

I do not think that we can do much better: we need to fetch the actual operator
from the domain F we are working in.

If you say go ahead, I'll finish the patch (it is a lot of work, albeit stupid
work...) and test it, and then post it for revision.

However, I think that a lot of testing would be wise.  Unfortunately, it seems
that operators are very little tested (also when I look at Tim's tests).

Martin


Index: defintef.spad.pamphlet
===================================================================
--- defintef.spad.pamphlet      (revision 398)
+++ defintef.spad.pamphlet      (working copy)
@@ -98,6 +98,23 @@
       ((u := checkSMP(d, x, k, a, b)) case "failed") or (u::B) => u
       checkSMP(numer f, x, k, a, b)
 
+    opexp   := operator(operator("exp"::Symbol)$CommonOperators)$F 
+    oplog   := operator(operator("log"::Symbol)$CommonOperators)$F 
+    opacot  := operator(operator("acot"::Symbol)$CommonOperators)$F 
+    opsin   := operator(operator("sin"::Symbol)$CommonOperators)$F 
+    opcos   := operator(operator("cos"::Symbol)$CommonOperators)$F 
+    opsinh  := operator(operator("sinh"::Symbol)$CommonOperators)$F 
+    opcosh  := operator(operator("cosh"::Symbol)$CommonOperators)$F 
+    optanh  := operator(operator("tanh"::Symbol)$CommonOperators)$F 
+    opsech  := operator(operator("sech"::Symbol)$CommonOperators)$F 
+    opatan  := operator(operator("atan"::Symbol)$CommonOperators)$F 
+    opacot  := operator(operator("acot"::Symbol)$CommonOperators)$F 
+    opasin  := operator(operator("asin"::Symbol)$CommonOperators)$F  
+    opacos  := operator(operator("acos"::Symbol)$CommonOperators)$F 
+    opasinh := operator(operator("asinh"::Symbol)$CommonOperators)$F
+    opacosh := operator(operator("acosh"::Symbol)$CommonOperators)$F
+    opatanh := operator(operator("atanh"::Symbol)$CommonOperators)$F 
+
 -- true if p has a zero between a and b exclusive
     checkFor0(p, x, a, b) ==
       (u := polyIfCan(p, x)) case UP => checkForZero(u::UP, a, b, false)
@@ -108,9 +125,9 @@
       (z := isExpt p) case "failed" => "failed"
       k := z.var
 -- functions with no real zeros
-      is?(k, "exp"::SE) or is?(k, "acot"::SE) or is?(k, "cosh"::SE) => false
+      is?(k, opexp) or is?(k, opacot) or is?(k, opcosh) => false
 -- special case for log
-      is?(k, "log"::SE) =>
+      is?(k, oplog) =>
         (w := moreThan(b, 1)) case "failed" or not(w::B) => w
         moreThan(-a, -1)
       "failed"
@@ -145,21 +162,21 @@
       nullary? operator kk => false
       f := first argument kk
       -- functions which are defined over all the reals:
-      is?(kk, "exp"::SE) or is?(kk, "sin"::SE) or is?(kk, "cos"::SE)
-        or is?(kk, "sinh"::SE) or is?(kk, "cosh"::SE) or is?(kk, "tanh"::SE)
-          or is?(kk, "sech"::SE) or is?(kk, "atan"::SE) or is?(kk, "acot"::SE)
-            or is?(kk, "asinh"::SE) => checkForPole(f, x, k, a, b)
+      is?(kk, opexp) or is?(kk, opsin) or is?(kk, opcos)
+        or is?(kk, opsinh) or is?(kk, opcosh) or is?(kk, optanh)
+          or is?(kk, opsech) or is?(kk, opatan) or is?(kk, opacot)
+            or is?(kk, opasinh) => checkForPole(f, x, k, a, b)
       -- functions which are defined on (-1,+1):
-      is?(kk, "asin"::SE) or is?(kk, "acos"::SE) or is?(kk, "atanh"::SE) =>
+      is?(kk, opasin) or is?(kk, opacos) or is?(kk, opatanh) =>
         ((w := checkForPole(f, x, k, a, b)) case "failed") or (w::B) => w
         ((w := posit(f - 1, x, k, a, b)) case "failed") or (w::B) => w
         negat(f + 1, x, k, a, b)
       -- functions which are defined on (+1, +infty):
-      is?(kk, "acosh"::SE) =>
+      is?(kk, opacosh) =>
         ((w := checkForPole(f, x, k, a, b)) case "failed") or (w::B) => w
         negat(f - 1, x, k, a, b)
       -- functions which are defined on (0, +infty):
-      is?(kk, "log"::SE) =>
+      is?(kk, oplog) =>
         ((w := checkForPole(f, x, k, a, b)) case "failed") or (w::B) => w
         negat(f, x, k, a, b)
       "failed"



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/fricas-devel?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to