# Question:Structured types

## Question:Structured types

Maple
Considering updating my old package COSVAM, which treats complex-octonionic-valued scalars, vectors, and matrices, first of all I want a much better type check of whether an expression is indeed a complex-octonionic scalar. A complex-octonionic-valued scalar is a linear combination over the complex numbers of the eight units of the octonions 1,e1,...,e7, say. So all the following expressions are valid examples of complex-octonionic-valued scalars
```expr1 := 10;
expr2 := e1;
expr3 := e1*I;
expr4 := e1*cos(t)+e2*sin(t);
```
whereas the following examples are invalid
```expr5 := e1*e2;
expr6 := e1*cos(e2);
```
I consider using structured types, but I cannot quite find a way to make it work: For instance in
```type(e1*cos(x),`&*`(identical(e1),freeof(e1)));
type(e1*cos(x)*2,`&*`(identical(e1),freeof(e1)));
```
the first gives true, whereas the second gives false (quite correct, of course, but of no use to me) because of the extra factor of 2. For sums of products it becomes even more difficult to control: For instance the following two expressions (quite correctly, of course, but also of no use to me) give true and false, respectively,
```type(e1*cos(x)+e2*sin(x),`&+`(
`&*`(identical(e1),freeof(e1)),
`&*`(identical(e2),freeof(e2))
));
type(e2*sin(x)+e1*cos(x),`&+`(
`&*`(identical(e1),freeof(e1)),
`&*`(identical(e2),freeof(e2))
));
```
even though the two expressions being tested are mathematically identical. Any suggestions?
﻿