Sushant Hiray's Webspace

Sushant Hiray's Webspace

Profile Picture

Sushant Hiray

GSoC Week 9: Complexions in Complex Module

Week 9 for GSoC ended a couple of days back. I’m still working on the Complex Module.


I started of the week continuing the work on pull 248.

Initially I started working on the add and mul functions and integrating the complex module with them. This part was pretty easy as Complex addition and Complex multiplication was completely implemented. Intially I just added special cases for the case of Complex in pow. But this quickly ran into issues as is_canonical failed in some testcases.

Next I simplified the complex power for the following cases:

  • When exp is 1 or -1
  • When the base is purely imaginary and exp is integer.

Following this I made appropriate changes to is_canonical for pow

Meanwhile @certik sent a couple of PR’s sushant-hiray/csympy/#1 and sushant-hiray/csympy/#2 for implementing the Python wrappers for Complex Module. I spent some time trying to sync the wrappers and make sure they work as intended.

One important fix needed was to improve the printing. Over the entire PR, the printing has been changed multiple times to match the SymPy output. With this PR I’ve updated the current existing printing for add, mul as well as pow

The expand function is also updated to handle the case of Complex Numbers. Currently it doesn’t expand terms like: (2 + 3I)^n. Apart from this all the issues which were found have been fixed.

The Week Ahead

Merge the current PR and send a new PR for handling the cases like (2 + 3I)^n in expand

Thats all for now :) Will get back next week!

Separator line
Separator line
Sushant Hiray - Foodie. Coder. Reader. Binge Watching.
Open Source Evangelist