The domain InputForm can be quite useful for manipulating parts of expressions. For example
Type: Union(Expression Integer,...)
Type: InputForm
Type: Expression Integer
If you would like to do this with a more common type of expression and hide the details, you can define
Type: Void
Then manipulating expressions looks like this:
axiom Compiling function op with type (PositiveInteger,Expression Integer)
-> Anyaxiom Compiling function op with type (PositiveInteger,Any) -> Any
Type: Expression Integer
Type: Expression Integer
Other OperationsThe domain FunctionSpace? includes the following operations:
isExpt(p,f:Symbol) returns [x, n] if p = x**n and n <> 0 and x = f(a)
isExpt(p,op:BasicOperator) returns [x, n] if p = x**n and n <> 0 and x = op(a)
isExpt(p) returns [x, n] if p = x**n and n <> 0
isMult(p) returns [n, x] if p = n * x and n <> 0
isPlus(p) returns [m1,...,mn] if p = m1 +...+ mn and n > 1
isPower(p) returns [x, n] if p = x**n and n <> 0
isTimes(p) returns [a1,...,an] if p = a1*...*an and n > 1
If these conditions are not met, then the above operations return "failed". For example,
Type: Union(Record(coef: Integer,var: Kernel Expression Integer),...)
but
Type: Union("failed",...)
In the context of Not exactly analogously
Type: Union(Record(val: Expression Integer,exponent: Integer),...)
whereas
Type: Union(Record(val: Expression Integer,exponent: Integer),...)
In the first case the We have:
Type: Union(List Polynomial Integer,...)
Type: Union(List Polynomial Integer,...)
Whereas
Type: Union("failed",...)
That is because the expression is internally treated as a
If you say:
Type: Union(List Polynomial Integer,...)
perhaps the result makes sense? For some of the details of these operations I consulted the actual algebra code at: http://wiki.axiom-developer.org/axiom--test--1/src/algebra/FspaceSpad Click on You can also enter expressions like |