sympy / sympy

A computer algebra system written in pure Python

Home Page:https://sympy.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Simplification of equations with Singularity Functions

mvg2002 opened this issue · comments

The SymPy code is currently not able to simplify equations with singularity functions. This does not lead to incorrect results, but it can give result with weird notation. An example where this happens is shown in #26683. @Tom-van-Woudenberg shows this file where the outputs from calculations in the Beam module look a bit weird. The equations with singularity functions can be still be simplified.

The simplification of equations with singularity functions does not happen right now. This is shown in the following example:

x = Symbol('x')
a = SingularityFunction(x, 0, 0)
a**2

Output: $(< x > ^0)^2$
This can be simplified to: $< x > ^0$

Another example:

x = Symbol('x')
a = SingularityFunction(x, 0, 0)
b = SingularityFunction(x, 0, 1)
a * b

Output: $< x > ^0 < x > ^1$
This can be simplified to: $< x > ^1$

This is obviously not a pressing issue. Still, it would be better if these equations with singularity functions would be automatically simplified. This would make the equations shorter and easier to understand.

it would be better if these equations with singularity functions would be automatically simplified

It is always better in the first instance to have a function that can perform some simplification rather than using automatic simplification. It might also be that these simplifications or something else could be used in the beam code to avoid having strange looking results.

Generally it is probably better to work with Piecewise rather than singularity functions:

In [6]: (a**2).rewrite(Piecewise)
Out[6]: 
⎧1  for x0
⎨            
⎩0  otherwise