GSoC 2020 Week-5
My goal for this week was to add support of integration over objects of geometry module.
Integrating over objects of geometry module
In my GSoC proposal, I mentioned implementing classes to represent commonly used regions. It will allow a user to easily define regions without bothering about its parametric representation. SymPy’s geometry module has classes to represent commonly used geometric entities like line, circle, and parabola. Francesco told me it would be better to add support to use these classes instead. The integral takes place over the boundary of the geometric entity, not over the area or volume enclosed.
My first approach was to add a function parametric_region
to the classes of geometry module. Francesco suggested not to modify the geometry module as this would make it dependent on vector module. We decided to implement a function parametric_region
to return a ParametricRegion
of objects of geometry module.
I learned about the singledispatch decorater of python. It is used to create overloaded functions.
Polygons cannot be represented as a single ParametricRegion
object. Each side of a polygon has its separate parametric representation. To resolve this, we decided to return a list of ParametricRegion objects.
My next step was to modify vector_integrate
to support objects of geometry module. This was easy and involved calling the parametric_region_list
function and integrating each ParametricRegion
object.
The PR for the work has been merged. Note that we still do not have any way to create regions like disc and cone without their parametric representation. To support such regions, I think we need to add new classes to the geometry module.
Next week’s goal
I plan to work on implementing a class to represent implicitly defined regions.