GSoC Week 5

Hi there! It’s been five weeks and midterm evaluations are going on. I have completed the implementations of Singularity Function module and headed towards the Implementation of Beam Bending Module.

So far

  • In PR 11266 , I have implemented three major classes :
    • DistributedLoad : Have the attributes start, end and value. This object can be used to generate a distributed load. It is a mutable object. The start and  end attribute should be the instance of mechanics Point. The value can take any function as input. This Load can be represented as a Singularity Function (i have not implemented this functionality yet) and used for solving the beam bending problems.
    • PointLoad : There are two types : Moment and Point Load. Moments are basically the couple of forces and are represented by the Doublet function whereas Point Load is the force which acts on a single unique point of the Beam and is represented as a DiracDelta Function.
    • Beam : It is the principle object of the Beam Bending problems. I have started working on it.

Next Week

Thats all for this week. Cheers !!

Happy Coding.



GSoC Week 4

Hi there! It’s been four weeks at GSoC. This week, I have been working on integrations. I had a meeting with my mentors on 12th June. It was great. I got stuck while implementing the integrations of Singularity Function earlier. I had already discussed that in my previous blog post. But at the meeting, I got some good ideas from Sartaj and Jason which not only cleared my doubts but also helped me to complete the implementation of integration of Singularity Functions. Firstly, they suggested me to start with the integration part in a new PR, since PR 11178 was quite good enough to get merged. Secondly, to integrate the Singularity Functions having exponents -1, we need to rewrite it as  DiracDeltas and then to use the methods of integration which are already available at sympy and then again rewrite it back as Singularity Functions.  Now I am almost completed with the “Implementation of Singularity Functions”.

So Far

  • In  PR 11178, I have added the changes that Jason had suggested. This PR is now ready.
  • In PR 11237, I have almost completed implementing the integrations of Singularity Function both definite and indefinite. I have implemented methods to rewrite DiracDeltas and Heaviside back to Singularity Functions.  The arguments of DiracDeltas and Heavisides should be a linear polynomial to use these methods.
  • I have added a module named “singularityfunctions” in the integrals directory. In there I have defined a function “singularityintegrate”. This one is the core function to integrate the Singularity Functions. SingularityFunction(x, a, -1) perfectly behaves as DiracDelta(x – a).

Next Week

  • To polish PR 11178  and PR 11237 and get them merged.
  • To start working with Beam Bending Module.

Looking forward toward an another great week. Cheers!

Midterm Evaluation is Coming !!! All the best.

Happy Coding.

GSoC Week 3

Hi! It’s been three weeks into the coding period, & I have managed to get some pace.I had a meeting with Jason and Sartaj on 5th of this month. We exchanged our thoughts on implementing the integration of Singularity Function objects. Then our discussion moved on towards the implementation of the Beam Bending Module. We focused on whether a Beam object will be mutable or immutable.We ended up discussing two approaches for the implementation of the integration of Singularity Function objects.

So far

  •  PR 11103 and PR 11137 has finally got merged.
  • In  PR 11178, I have added two important methods under  Singularity Function class.
      • rewrite(Heaviside)
      • rewrite(DiracDelta)

    These would help to convert a Singularity Function object into a mixture of DiracDeltas and Heavisides.

    But while doing the inverse i.e. rewriting DiracDeltas and Heavisides I got stuck. I have implemented that in a way which can’t handle a bit complex expressions,but good for simple DiracDelta and Heaviside expressions. I need to work on this method.

  • In the same PR, I am also working on the integration of the Singularity Functions. There are two approaches which I have discussed with my mentors.
    • Directly use the rules of integrations:- I mean if the exponent is greater than zero then increase the exponent by 1 and divide the whole by the resulting exponent. Else just increase the exponent by 1.
      The issue with this approach is if we perform Sympy integrations over SingularityFunction(x, a, 0) ,which is basically DiracDelta(x – a), then it doesn’t satisfy the fundamentals properties of DiracDelta integrations. For the purpose, I am trying the next approach.
    • Using Heaviside and DiracDelta :- Convert the Singularity function into expressions containing DiracDeltas and Heavisides and then integrate that. Integrations of DiracDeltas and Heavisides are already there in Sympy. Then rewrite that result back into the Singularity Function. Lastly, just output that resulting expression.
      Currently, I am working on rewriting the DiracDeltas and Heavisides back into the Singularity Function.

Next Week

  • Continue with the implementation of integrations of Singularity Functions.

That’s all for now, looking forward to week 4.

Cheers. Happy Coding.

GSoC Week 2

Hi there! It’s been two weeks into the coding period, & I have managed to flip some bits. I had a meeting with Jason and Sartaj on 30th April. We were discussing on the implementation of Singularity Functions. I have implemented them using the properties of Heaviside and Diracdelta under eval() method. But they suggested me to return Heaviside and Diracdelta directly instead of their properties only. This way we can reuse the functionality that has been already there in Sympy. I tried doing that,but I am having problems with the representation part.

With the former one:-
In [2]: SingularityFunction(x, 3, 4)
<x - 3>
With the latter one:-
In [3]: SingularityFunction(x, 3, 4)
(x - 3) ⋅Heaviside(x - 3)

I have to figure out the representation part of Singularity Function class. If I can succeed, then we can follow the latter idea of implementation without any worry.

We further discussed a bit about the integrations of Singularity Functions.

Progress of Week 2

The major portion of this week went into working with the printing modules. Due to which I had to switch between the targets of this week and the next week.

  • In  PR 11139, I was finally able to figure out how to implement the pretty printing of derivatives of the DiracDelta Class similar to the one with latex printing. Hence, it got merged.
  • In PR 11178, I’ve enabled the pretty printing and latex printing of Singularity Functions and added their tests too. The output somewhat looks like (both in pretty printing and latex printing :
In [3]: SingularityFunction(x, 3, 4)
<x - 3>

In [4]: SingularityFunction(x, -5, 4)
<x + 5>

In [5]: SingularityFunction(x, 0, 4)
  • I was looking into  PR 11192, it seems a great work to me. Docstrings are quite well defined.

Next Week

  • To get  PR 11103 and PR 11137 merged.
  • Integrations of Singularity Functions.
  • Improve the Implementation of Singularity Functions.

That’s all for now, looking forward to week 3.

Cheers. Happy Coding.

GSoC Week 1

The First week of the coding period has come to an end, I had a meeting with Jason and Sartaj, my mentors, on 22nd of May. I was going to start working on the Singularity Functions class, so we had a discussion on how to proceed. We exchanged our thoughts on removing the is_real check for the arguments passed through the rewrite(Piecewise) method. We also discussed how we can let the pretty printer prints the derivatives of DiracDelta class. They suggested me to review some Pull Requests of other members in order to encourage them, interact with other community members  and learn. The meeting was quite interesting. We ended up discussing many new things that we can implement.

Progress of Week 1

  • In PR 11139, I was trying to figure out how to pretty print the derivative of DiracDelta class as:-
In [1]: DiracDelta(y, 3)
δ   (y)

Jason helped me to figure out the way. I will try to complete the implementation part by the middle of the next week.

  • In PR 11178, I have started working on the Singularity Functions class. Sartaj suggested me to keep the implementation of pretty printing part for later. Till now I have defined eval(), fdiff(), rewrite(Piecewise) only.
In [2]: SingularityFunction(x, a, n)
Out[2]: SingularityFunction(x, a, n)

In [3]: SingularityFunction(y, 6, 2).diff(y)
Out[3]: 2*SingularityFunction(y, 6, 1)

In [4]: SingularityFunction(x, 4, 5).rewrite(Piecewise)
Out[4]: Piecewise(((x - 4)**5, x - 4 > 0), (0, True))

In [5]: SingularityFunction(x, 3, 2).subs(x, 6)
Out[5]: 9
  • I was reviewing  PR 11065 and have suggested some modifications. The idea of having an another argument for defining the value of Heaviside(0) is great. But at the same time, we can not allow that argument to pass values other than 1 and 1/2.

Next Week

  • Implementation of a method to integrate Singularity Functions.
  • Adding the pretty printing of the derivatives of DiracDelta.

Looking forward toward an another great week. Cheers!

Happy Coding.

GSoC Community Bonding Period Week 4

The last week of Community Bonding period was awesome. From tomorrow onwards, the coding period will begin. I am supposed to start working on my project from tomorrow, but I have done that already from the second week of the Community Bonding Period because I was supposed to take a vacation of 4 days (25 May – 29 May). Due to some issues, I have had to cancel that vacation. Now I have got some more days to work on my project. Let’s see what I have done so far…

So far

  •  PR 10863 had finally got merged.
  •  rewrite(Piecewise) :- In PR 11103, I was trying to solve the  arg = 0 part using solve functionality in sympy. But Jason suggested not to use solve as because there may arise some cases when solve will not be able to provide the desired output. So I kept  the arg = 0 part as  it is.  The story doesn’t end here. There is a confusion regarding keeping the check for whether  arg is real. Personally, I think that check should be there since both Heaviside and DiracDelta is defined only on real axis.
  • In PR 11137, I have improved the doc strings of all the methods under DiracDelta and Heaviside classes. I have added the contextual example for DiracDelta(x, k) and described the relation between fdiff() and diff() . This pull request needs a final review.
  • In PR 11139, I have added the functionality to pretty print the DiracDelta(x) as δ(x). This pull request also needs a final review.
  • Finally, almost every proposed improvement under the issue 11075 is being fulfilled.

Next Week

My plans for next weeks are:-

  • To polish PR 11103PR 11137 and PR 11139 and get them merged.
  • To start working on the implementation of Singularity Functions.

GSoC Community Bonding Period Week 3

Hi there ! This week was great. I got to learn about many new things. I have mentioned in my last post, about my goals for this week, let us see what I have done so far.

So far

  • In PR 10863, implementation of  _eval_expand_diracdelta is almost done . A final review is needed. But at the same time, I was forgetting about the fact that the   simplify  method has to be deprecated in order to make things backwards compatible. Thanks Jason for the suggestion.

I have made the simplify() method call the _eval_expand_diracdelta() method and raise a deprecation warning. I have also added the tests for this method by catching the deprecation warnings properly. The API works like this:-

In [3]: DiracDelta(x*y).simplify(x)
/home/ahappyidiot/anaconda2/bin/ipython:1: SymPyDeprecationWarning: 

simplify has been deprecated since SymPy 1.0.1. Use
expand(diracdelta=True, wrt=x) instead.

Out[3]: DiracDelta(x)/Abs(y)

These commits are needed to be reviewed properly in order to merge PR 10863.

  •  rewrite(Piecewise) :- In PR 11103, I have implemented a new method under DiracDelta class which would successfully output a Piecewise representation of a DiracDelta Object. For this pull request also, a final review is needed. The API works as:-
In [4]: DiracDelta(x).rewrite(Piecewise)
⎧  oo       for x = 0
⎩  0        otherwise 

In [4]: DiracDelta(x - 5).rewrite(Piecewise)
⎧  oo       for x - 5 = 0
⎩  0        otherwise
  • I have also reviewed PR 11065, I personally think that the implementation is a great idea.

Next Week

My plans for next weeks are:-

  • Polish both PR 11103 and  PR 10863 and get these pull requests merged
  • Improve doc strings of the DircaDelta and Heaviside classes and methods.


I will again get back by the end of the next week. Cheers !!!

Happy Coding.