That’s all for this week. Cheers !!

Happy Coding.

- DiracDelta can be represented in piecewise form.
- DiracDelta and Heaviside have a detailed docstring.
- DiracDelta can be pretty printed using δ(x).
- Singularity Function module which can perform all sort of mathematical operations on discontinuity functions.
- Beam module which can solve 2D beam bending problems.

Jason has came up with some new ideas for beam module:

- Plot the shear, bending, slope and deflection diagrams..
- Compute the strain and stress at any location in the beam.
- Improve the beam module for more complicated loads.

I have planed for a long term association with SymPy, I am taking the full responsibilty of my code and I will try to contribute as much as I can. I will help the new developers with the Sympy code paradigms and the development workflow.

I have been able to meet all the target that I had mentioned in my proposal and all of my pull requests have got merged except PR 11494. It was great working with Sympy. Jason, Sartaj, Aaron, Kalevi, Isuru and all other sympy members have helped me a lot. Many of the times, I used to get stuck with some implementation, testing or with the Travis CI build but, for everytime they have always tried to help me fix them. My mentors have always appreciated and motivated me. I got to learn many new thing about the software development workflow. Thank you Sympy for making this summer an awesome journey of learning and coding.

That’s all folks.

Happy Coding.

]]>

Let us see the capabilities:-

- Can create a beam object of certain length, second moment of area and modulus of elasticity. A symbol can also be passed for further uses.
- Can apply loads using its value, start, end and order.
- Can set boundary conditions for the beam.
- Can find the load distribution function.
- Can find the shear force function.
- Can find the bending moment function.
- Can find the slope function.
- Can find the deflection function.
- Can represent each of those function in the Piecewise form.
- Can perform all sorts of mathematical operations on these functions.

A full fledged documentation of tutorial and example for this module is on its way.

- To complete documenting examples and tutorials.
- Get PR 11374 merged.

That’s all for now, looking forward for week 12.

Happy Coding.

]]>

Let us see how to solve a beam bending problem using this module.

Problem Statement :

The deflection is restricted at the end of the beam.

Solution :

```
>>> from sympy.physics.continuum_mechanics.beam import Beam
>>> from sympy import Symbol, Piecewise
>>> x = Symbol('x')
>>> E = Symbol('E')
>>> I = Symbol('I')
>>> b = Beam(4, E, I)
>>> b.apply_load(value=-9, start=4, order=-1)
>>> b.apply_load(value=-3, start=0, order=-1)
>>> b.apply_load(order=0, start=2, value=6)
>>> b.bc_deflection = [(4, 0)]
>>> b.boundary_conditions
{'deflection': [(4, 0)], 'moment': [], 'slope': []}
>>> b.load
-3*SingularityFunction(x, 0, -1) + 6*SingularityFunction(x, 2, 0) - 9*SingularityFunction(x, 4, -1)
>>> b.shear_force()
-3*SingularityFunction(x, 0, 0) + 6*SingularityFunction(x, 2, 1) - 9*SingularityFunction(x, 4, 0)
>>> b.bending_moment()
3*SingularityFunction(x, 0, 1) - 3*SingularityFunction(x, 2, 2) + 9*SingularityFunction(x, 4, 1)
>>> b.slope()
(3*SingularityFunction(x, 0, 2)/2 - SingularityFunction(x, 2, 3) + 9*SingularityFunction(x, 4, 2)/2 - 7)/(E*I)
>>> b.deflection()
(-7*x + SingularityFunction(x, 0, 3)/2 - SingularityFunction(x, 2, 4)/4 + 3*SingularityFunction(x, 4, 3)/2)/(E*I)
```

If the user wants to represent the deflection in the piecewise form, then:

```
>>> b.deflection().rewrite(Piecewise)
(-7*x + Piecewise((x**3, x > 0), (0, True))/2
+ 3*Piecewise(((x - 4)**3, x - 4 > 0), (0, True))/2
- Piecewise(((x - 2)**4, x - 2 > 0), (0, True))/4)/(E*I)
```

- Add the end argument in the apply_load method.
- Add Sphinx documentations.

That’s all for this week. Cheers !!

Happy Coding.

]]>

- I have closed the PR 11266.
- In PR 11374, I have removed the use of mechanics Point.
- I have made boundary_conditions as property and the inputs are no longer as **kwargs. Each of the inputs namely moment, slope and deflection are initiated as an empty list. But I have some doubts regarding the behaviour of this method. I feel that this should be used only in the case when a full new set of boundary conditions are given as input. Since to input dynamically, there exists some methods already which would handle each of the cases explicitly. Those methods appends the new inputs whereas this method would delete the existing boundary conditions and apply the newer one. This way the property of being mutable would remain.
- Replaced the solve function by linsolve. Since solve is going to be depreciated in the mear future.
- I have added the docstrings for slope and deflection method as well as for the beam class.
- In deflection method, I have added a new case where if there is no slope boundary condition but there is deflection boundary conditions, it would give operate.

- I will be working on adding a documentation file for this beam bending problem module exclusively.
- Add some more test for checking the corner cases.

That’s all for this week. Cheers !!

Happy Coding.

]]>

Instead of doing :

```
In [ ]: b = []
In [ ]: for x in a:
b.append(10 * x)
....:
```

we can do :

```
In [ ]: b = [10 * x for x in a]
```

I came to know about stuff , like using zip for transposing a matrix and dividing a list into groups of** ****n . **This week I had my weekly meeting with Jason and Sartaj on 13th of this month. They were in Austin, Texas attending Scipy 2016, the 15th annual Scientific Computing with Python conference.

- PR 11178 and PR 11237 got merged. So, now the master branch is updated with a module of singularity functions which can handle almost all the mathematical operations.
- I have used the Singularity Functions to continue developing the beam bending module at PR 11374. I have added the following methods:
: This is a private method which represents a PointLoad and DistributedLoad object into a Singularity Function object and stores in the load beam object attribute.**load_as_SingularityFunction**: This is a public method which outputs a load distribution curve of a beam.**load_distribution**This is also a public method. It at first checks whether the moment list in boundary conditions dictionary have elements. If it has then it call the bending_moment method and then differentiate the output w.r.t to the free symbol else it just integrates the output of load_distribution method.**shear_force :**: The initial part of this method is similar to the method shear_force. If the test passes then it integrates the load_distibution twice using contants of integrations and later the contants are solved else it just integrates the output of shear_force method.**bending_moment**: It outputs the slope of a beam by solving the constants.**slope**: It outputs the elastic curve of the beam.**deflection**

**Next Week**

- Modify the Beam Module.
- Add Sphinx documentations.

That’s all for this week. Cheers !!

Happy Coding.

]]>

- In PR PR 11178 and PR 11237, I have added the suggested modifications.
- In PR 11266, I have done some modifications in the DistributedLoad class. Initially, it had “start”,” end” and “value” as its attribute but Jason suggested me to add an attribute which would denote the order of the load. This attribute would help while representing a load in the form of Singularity Functions. Such as:
- Order = 0 will denote Step Function,
- Order = 1 will denote Ramp Function,
- Order = 2 will denote Parabolic Ramp Function and
- so on …

- In the same PR, I have added some more method for taking boundary conditions explicitly for different cases such as for deflection, slope and moment as inputs. I made a private attribute
*_boundary_conditions*and initiated as an empty dictionary of lists with keywords deflection, slope and moment. Later on each of the methods, namely,- apply_boundary_conditions
- apply_moment_boundary_conditions
- apply_slope_boundary_conditions
- apply_deflection_boundary_conditions

just updates that dictionary. The method

*boundary_conditions*would return the dictionary itself.

- I will try to get PR 11178 and PR 11237 merged.
- Add
*apply_load*method to the Beam class. - Successfully convert all the load inputs through the
*apply_load*method into Singularity Functions. - Write methods which would output load curve, shear curve and moment curve.

That’s all for this week. Cheers !!

Happy Coding.

]]>

**So Far**

- Until last week, I have completed the implementation of
*PointLoad*and*DistributedLoad.*This week I started implementing the class for the principle object of the Beam Bending problems. I have implemented the Beam class. The work is not completed yet. I have initiated the class with*length*,*Young’s Modulus*and*Moment of Inertia.*I have to discuss with the mentor about the mutability of this class. :- It is a public method of the beam class which takes the boundary conditions of the beam bending problem as input. I found out that there are only three types of boundary conditions : Deflection, Shear and Moment. So, I made them input in the form of keyword arguments and for each key, the value would be a list of tuples where each of the tuples would contain location and value in this format : (location, value). This method returns the boundary conditions in the form of a python dictionary. For example: Let a problem have boundary conditions as: Moment(x = 0) = 1, Deflection(x = 0) = 0, Deflection(x = 4) = 0. Then the API is:**BoundaryConditions**-
`>>> from sympy.physics.mechanics.beam import Beam >>> from sympy import Symbol >>> E = Symbol('E') >>> I = Symbol('I') >>> b = Beam(4, E, I) >>> b.BoundaryConditions(moment = [(0, 1)], deflection = [(0, 0), (4, 0)]) {'deflection':`

`[(0, 0), (4, 0)]`

`, 'moment':`

`[(0, 1)]}`

**Next Week**

That’s all for this week. Cheers !!

Happy Coding.

]]>

- In PR 11266 , I have implemented three major classes :
: Have the attributes**DistributedLoad***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.: 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.**PointLoad**: It is the principle object of the Beam Bending problems. I have started working on it.**Beam**

**Next Week**

Thats all for this week. Cheers !!

Happy Coding.

]]>

- 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).

Looking forward toward an another great week. Cheers!

Midterm Evaluation is Coming !!! All the best.

Happy Coding.

]]>

- 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.

- 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.

- Continue with the implementation of integrations of Singularity Functions.

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

Cheers. Happy Coding.

]]>