Just briefly introducing a new operator. Not sure how useful it is going to be, but may as well document it. Basically, I wanted to implement this equation:
```R0 = r0
R_k = R_k-1 + r_k * [simm(R_k-1,r_k)]^p
```
where r_k are superpositions, simm is our similarity metric, and if we set p = 0 this reduces to a simple sum:
`R_k = r1 + r2 + ... + r_k`
The intended effect is that you add new superpositions weighted somewhat on how close they are to those already in the sum. Noting of course, that simm gives results in [0,1]. Like I said, I don't know if this will turn out useful, but figured why not add it.

Here is the python:
```def simm_add(one,context,parameters):
try:
op,p = parameters.split(',')
p = int(p)                     # maybe try float(p) later
except:
return ket("",0)

for x in tail:
rk = x.apply_op(context,op)
similarity = silent_simm(Rk,rk)**p
Rk = Rk + rk.multiply(similarity)
return Rk
```
And a use case from earlier:
```  sadd |result 1> => simm-add[noise,1] select[1,1] rel-kets[noise] |>
...
```
Though in that case the difference from just a plain sum was essentially zero.

In general, usage is simply: simm-add[op,p] with some similarity to common[op] and union[op].

May as well note, since simm is in [0,1], and assuming all superpositions have positive coeffs, then we have the property:
```0 <= R_k <= r1 + r2 + ... + r_k
```
where it reaches the upper bound only if p = 0, or all r_k are identical. The more "diverse" the superpositions (ie, smaller simm values), the smaller R_k will be.

Home
previous: averaging out noise
next: introducing a new tool wikivec and wikivec similarity

updated: 19/12/2016
by Garry Morrison
email: garry -at- semantic-db.org