Relmath DEMO


In [ ]:


In [12]:
from relmath import *
from relmath_bq import *

State.s.push_env()

with quote():

    A = Rel([
                [0.1, 0.6, 0.3, 0.0],
                [0.0, 0.8, 0.2, 0.0],
                [0.0, 0.0, 0.1, 0.9]
            ], 
            ['Mario','Luigi','Bowser'], 
            ['Movies','Music','Sport','Kidnapping'])

    M = A * A.T
    MAT = A * A.T.simp()
    
print(MAT)
Ms = M.simp()
print(Ms)

    
M.to_bq()


╒════════╤════════╤═══════╤═══════╤════════════╕ ╒════════════╤═══════╤═══════╤════════╕
│        │ Movies │ Music │ Sport │ Kidnapping │ │            │ Mario │ Luigi │ Bowser │
├────────┼────────┼───────┼───────┼────────────┤ ├────────────┼───────┼───────┼────────┤
│ Mario  │ 0.1    │ 0.6   │ 0.3   │ 0.0        │ │ Movies     │ 0.1   │ 0.0   │ 0.0    │
├────────┼────────┼───────┼───────┼────────────┤ ├────────────┼───────┼───────┼────────┤
│ Luigi  │ 0.0    │ 0.8   │ 0.2   │ 0.0        │*│ Music      │ 0.6   │ 0.8   │ 0.0    │
├────────┼────────┼───────┼───────┼────────────┤ ├────────────┼───────┼───────┼────────┤
│ Bowser │ 0.0    │ 0.0   │ 0.1   │ 0.9        │ │ Sport      │ 0.3   │ 0.2   │ 0.1    │
╘════════╧════════╧═══════╧═══════╧════════════╛ ├────────────┼───────┼───────┼────────┤
                                                 │ Kidnapping │ 0.0   │ 0.0   │ 0.9    │
                                                 ╘════════════╧═══════╧═══════╧════════╛
                                                

╒════════╤══════════╤══════════╤══════════╕
│        │ Mario    │ Luigi    │ Bowser   │
├────────┼──────────┼──────────┼──────────┤
│ Mario  │ 0.46 ... │ 0.54     │ 0.03     │
├────────┼──────────┼──────────┼──────────┤
│ Luigi  │ 0.54     │ 0.68 ... │ 0.02 ... │
├────────┼──────────┼──────────┼──────────┤
│ Bowser │ 0.03     │ 0.02 ... │ 0.82 ... │
╘════════╧══════════╧══════════╧══════════╛

In [ ]:


In [ ]: