RobinHankin / stokes

methods for exterior calculus
https://robinhankin.github.io/stokes/
3 stars 0 forks source link

operator precedence problem #69

Closed RobinHankin closed 2 years ago

RobinHankin commented 2 years ago
 dx ^ (6*dy)
An alternating linear map from V^2 to R with V=R^2:
         val
 1 2  =    6
 dx ^ 6*dy
Error in Ops.kform(dx^6, dy) : 
  binary operator '*' is not implemented for kforms

Above, both forms make sense (and should be identical). But the second is interpreted as (dx ^ 6)*dy, and this gives an error because a*b is not defined for a and b k-forms. Not 100% sure, but I think that we want an error here. But it should be documented somewhere.

RobinHankin commented 2 years ago

Also note that *, while being able to multiply a kform by a number, does not allow one to multiply a kform by a scalar():

 scalar(6)
An alternating linear map from V^0 to R with V=R^0:
     val
  =    6
> dx
An alternating linear map from V^1 to R with V=R^1:
       val
 1  =    1
> dx*6
An alternating linear map from V^1 to R with V=R^1:
       val
 1  =    6
> dx*scalar(6)
Error in Ops.kform(dx, scalar(6)) : 
  binary operator '*' is not implemented for kforms
> 

Above, see how dx*6 works fine but dx * scalar(6) does not. Arguably, both should work. But again, I am not sure.