To my 

>> Introduce the program variables  x,y... and bound them to the symbolic 
>> indeterminates. [..] in DoCon program, it is arranged about like this:
>> 
>> let  {s = cToPol ["x","y"] 1;  [x,y] = varPs s}  in  x^2*(x - x*y) ...
>> [..]
>> Hence, in many computations after `in',  x,y  denote what is needed.


D. Tweed <[EMAIL PROTECTED]>  writes on 28 Nov 1999 

> This sounds fascinating: is this approach powerful enough that if I have
> a definition of a haskell function purely as a definition for actual
> values and then apply it to an indeterminate I automatically get the
> expected result (no evaluation)? (ie,can I write
>
> harmonic n = (sum.map (\x->1/x)) [1..n]
> result = let  {s = cToPol ["x"];  [x] = varPs s}
>          in harmonic x
>
> to get result => harmonic(x)?) 
> [..]


I feel, i am missing something in the question, and in the initial 
notice on the Maple variables too.
Anyway, here what i wanted to tell.
The DoCon application written in Haskell supports the following 
algebraic programming style:

  let  s     = cToPol ["x","y"] 1  :: P
                               -- unity polynomial in x,y over Integer
                               -- - a sample element of domain  P
       [x,y] = varPs s         -- images of "x","y" in  P
  in   
  x^2*(x - x*y) ...
  
As the polynomial constructor is supplied with the  Ring 
(or call it  Num & Fractional)  instance, the program after `in' can
do arithmetics on  x,y.  Because they are polynomials. And  varPs  
sets the correspondence between the true algebraic indeterminates x,y 
and their names  "x","y".
varPs  makes, say,  x  from  "x",  x :: P  - a value of type P.   
Hence, everything applicable to type  P  can apply to  x.

DoCon provides the standard functions  
                                  cToPol  "coefficient to polynomial",
                                  varPs   "variables as polynomials".
In other algebra systems, they are easy to program too - as soon as 
the polynomial representation method is chosen.
How this all relates to your question?

In your example, if you set     harmonic x  
after the above `in',  it might have sense only if  [1..x],  1/x
have sense. The domain  P  (polynomials!) to which  x  belongs, should
have  Enum  order. How do you put it, in what order the polynomials
                   "from  1 :: P  up to  x :: P"   
have to follow?
If you had set such reasonable Enum instance, then, according to
your formula,  1/f  will start to evaluate for several  f :: P.
harmonic x  might produce some result, but, hm... may fail at  1/x.

If you put, say, the rational functions  F = Fraction P  rather than 
P,  then  harmonic (x ...::F)  would have more chances ...

Again, i fear i mislead the idea.

------------------
Sergey Mechveliani
[EMAIL PROTECTED]

Reply via email to