On 06/14/2010 03:32 PM, [email protected] wrote:
> While we are at it, here is another example of the interpreter
> being to ambitious:
> ************************************************************
> (1) -> A:Matrix IntegerMod 5 := [[2,3],[3,2]]
> 
>         +2  3+
>    (1)  |    |
>         +3  2+
>                                                   Type: Matrix(IntegerMod(5))
> (2) -> inverse A
> 
>         +  2   3 +
>         |- -   - |
>         |  5   5 |
>    (2)  |        |
>         | 3     2|
>         | -   - -|
>         + 5     5+
>                                    Type: Union(Matrix(Fraction(Integer)),...)

Oh, that should not happen. I only see a function

convert: IntegerMod(p) -> Integer

But wasn't it an agreement that only "coerce" (and perhaps "retract")
functions are to be applied in the interpreter?

I also would like the "inverse" above to fail. Better would be to offer
PrimeField 5, but that might involve checking for primeness of 5.

Maybe it would be a nice exercise to create a testing branch where
src/interp/i-coerce.boot does actually no coercion.

I guess, "no coercion" is too drastic a change, but is there some nice
way to restrict the types that are in scope and bring them in scope as
they are needed? I'd rather like to type "import from Something" than
having the interpreter apply a coercion I don't want.

> (3) -> B:Matrix PrimeField 5 := [[2,3],[3,2]]
> 
>         +2  3+
>    (3)  |    |
>         +3  2+
>                                                   Type: Matrix(PrimeField(5))
> (4) -> inverse B
> 
>    (4)  "failed"
>                                                     Type: Union("failed",...)

This one is OK.

(9) -> determinant B

   (9)  0
                                     Type: PrimeField(5)

:-)

Ralf

-- 
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