trick is to define (interpreter) variables a, b and c which point to objects in the desired distributed domain, which are a, b, c. This forces the interpreter not to choose Polynomal Integer , but direktly allows to do the desired operation in dmp.

True.

Actually, I am not so sure to suggest this. Recently, I worked quite some bit in the interpreter and I must say that with a not well planned session, it is sometimes inconvenient having types declared on some identifiers.

The reason is that if I can say

(210) -> foo := 1

   (210)  1
                                       Type: PositiveInteger
(211) -> foo := "hello"

   (211)  "hello"
                                               Type: String
(212) -> foo

   (212)  "hello"
                                               Type: String

But I get

b(213) -> bar: Integer := 1

   (213)  1
                                               Type: Integer
(214) -> bar := "hola"

   Cannot convert right-hand side of assignment
   "hola"

      to an object of the type Integer of the left-hand side.

(214) -> bar: String := "hola"

   You cannot declare bar to be of type String because either the
      declared type of bar or the type of the value of bar is different
      from String .

No, I am not saying that this behaviour of FriCAS is bad. Actually, I rather like it. The point is that I did not know until I figured out that there is a different behaviour for undeclared and declared identifiers.

However, good that you mentioned it. I will also put this into the notebook. It's good if beginners learn that right away.

Some addition here.

(7) -> dmp := DMP([a,b,c], Integer)

    (7)  DistributedMultivariatePolynomial([a,b,c],Integer)
Type: Type
(8) -> a : dmp := a

Line (8) seems to look pretty stupid, but, in fact, almost all computer algebra systems have this. The a on the left of := is actually an identifier of the SPAD language (like in any other programming language). On the right of := the a is a value.

(214) -> dmp := DMP([a,b,c], Integer)

   (214)  DistributedMultivariatePolynomial([a,b,c],Integer)
                                                           Type: Type
(215) -> a

   (215)  a
                                                     Type: Variable(a)

Hmmmm, the a on the lefthand side is of type Variable(a). It shouldn't be possible to assign this to some identifier that has type dmp.

Again, the interpreter jumps in and tries to convert the a of type Variable(a) into the value a of type DistributedMultivariatePolynomial([a,b,c],Integer) and then assign it to the identifier a. So when we now enter a, the interpreter interprets this as the identifier a and this identifier has a value, namely a (being of type DistributedMultivariatePolynomial([a,b,c],Integer).

(216) -> a : dmp := a

   (216)  a
         Type: DistributedMultivariatePolynomial([a,b,c],Integer)
(217) -> a

   (217)  a
         Type: DistributedMultivariatePolynomial([a,b,c],Integer)

Ralf

--
You received this message because you are subscribed to the Google Groups "FriCAS - 
computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to fricas-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/930dcfe0-2b05-bd86-1c93-be78eea41607%40hemmecke.org.

Reply via email to