# Week 7 - All about logics and algorithms

This week required a lot of thinking before jumping to code the stuff. Interested? Okay move on to next paragraph.

Basically, I worked on three PRs, #17163 for continuous time Markov chains, #17174 for random matrices and #17146 for symbolic Ranges. The first and the last PRs are very much intensive. I developed a new algorithm for the query handler of `ContinuousMarkovChain.probability`

method, because the previous one which I implemented in `DiscreteMarkovChain.probability`

, was not easy to maintain, quite ad-hoc, rigid and difficult to extend. The philosophy behind the algorithm is recursion i.e., boil everything down to `Relational`

query, convert them to sets and then calculate the probability. You can find the complete description here. I am waiting for any critical objections from my mentors and after that I will refactor the code as suggested by oscarbenjamin and jksuom. So, now let’s move on to random matrices. As it was to be implemented from scratch, it required a bit of thinking to reach a decent architecture. Currently, the PR is at a basic level, and some more testing is to be done. Now, coming on to symbolic `Range`

. Let me tell you, it requires a lot of logical thinking to make `Range`

accept symbolic parameters. A lot of tests fail, and a lot of debugging has to be done to make a method work. In fact, we might deprecate `xrange`

support from `Range`

because we are going to drop `Python 2`

support from `SymPy`

.

This week I learnt to combine the concepts from algorithms and software engineering to develop the stuff I mentioned above. This was the best week of my overall GSoC experience till now.

A lot more lies ahead. Bye!!