# Question:Defining Function properties and using it for simplification

## Question:Defining Function properties and using it for simplification

Maple

Hi. I am very new to Maple and there is something I can't find an answer on.

I would like to perform symbolic manipulation to help me simplify some equations. I was trying to define E to be a generic function operator, (expectation in statistics)

I have a equation y = a + b + c*d + e*f +..... something really long

I am to say R(y) = E(p*y)

How do I go about teaching Maple that my function is commutative and there are sets of rules which can be used? e.g.:

I would like to program E so that Maple is able to recognise the fact that E(a+b) = E(a) + E(b), and E(a*x) = a*E(x) if a is constant, without me explicitly defining what E(x) really is algebrarically, which is unknown as this is a general case.

Also, if you use type(x, scalar) it returns true. How do you assign a type to x, y to be variables and separate the type for say a, b so that they represent constants? This will aid in using functions e.g. subsindets where you tell Maple to do certain operations only for certain type of operands in an expression.

Anyway when I put R(y) I would like Maple to give me y = pE(a) + pE(b) + .... etc

Then I'd need to do even more advanced general rule such that E(x)*E(y) = -1/n if x=y and E(x)E(x) = 1/n, etc. This I am not sure how to do either. I can't really use simple command like subs(-1/n,E(x)*E(y)) as there are many possibilites of x and y, it'd be just as time consuming to manually do that then to solve the equation on paper. E.g. I have E(u1)*E(u2),E(u2)*E(u3),E(u1)*E(u3)

I'd just need general guidance and small pieces of codes so I can learn about doing it

Thanks very much

﻿