On 05/28/2018 08:53 AM, Marduk wrote:
> Dear all,
> 
> As the following example shows, when writing polynomials with noncommutative
> variables one has to specify that the symbols belong to the list of NC 
> variables:
> 
> ops := OVAR[A,B]
> 
> ncomm := XDPOLY(ops, Integer)
> 
> q : ncomm := 3*B::ops*A::ops
> 
> 
> I just found out that doing the same in REDUCE is more pleasant, since one 
> can
> tell the interpreter that some identifiers are to be treated as 
> noncommuting variables:
> 
> nc_setup({A,B});
> 
> A*B - B*A;
> 
> 
> How could one achieve the same with FriCAS?

Just don't compute with symbols. Turn the symbols A and B into elements
of the respective domain, i.e. make them noncommutative polynomials.

ls: List Symbol := ["a"::Symbol, "b"::Symbol]
ops := OrderedVariableList ls
NPol := XDistributedPolynomial(ops, Fraction Integer)
vars :=[index(i)$ops::NPol for i in 1..#ls]
a := vars.1
b := vars.2
a*b - b*a

Note that instead of

  "a"::Symbol

you can also simply write

  'a

That notation seems to be influenced by LISP and denotes the VALUE

  of a symbol with name a.

As long as the programming variable a is unassigned in the current
session, you can also simply write a and the interpreter will try to
figure out would you could have meant by it. With

  "a"::Symbol

however, there is no doubt.

Enjoy.

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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to