GithubHelp home page GithubHelp logo

Comments (8)

smichr avatar smichr commented on June 24, 2024 1

There used to be an infinitesimal assumption that symbols could use. Use of a specific symbol seems fragile. What about using an expression eps = 1/Dummy('OO', infinite=True)? Used with L=var('L', positive=True) gives SingularityFunction(L - eps, L/2, 1)->L/2-1/OO For clean-up, replace with oo and you should have what you want.

from sympy.

moorepants avatar moorepants commented on June 24, 2024

Can the epsilon symbol be used to track this symbolically?

from sympy.

mvg2002 avatar mvg2002 commented on June 24, 2024

@moorepants, It is possible to use the epsilon symbol here. This will result in answers that still contain singularity functions. Example 1 with the use of epsilon will look like:

from sympy.physics.continuum_mechanics.beam import Beam
from sympy import Symbol
L = Symbol('L', positive='true')
eps = Symbol('eps', positive='true')
F = Symbol('F')
E = Symbol('E')
I = Symbol('I')
b = Beam(L, E, I)
r0 = b.apply_support(0, type="pin")
rL, mL = b.apply_support(L, type="fixed")
b.apply_load(F, L/2, -1)
b.apply_rotation_hinge(L-eps)
b.solve_for_reaction_loads(r0, rL, mL)
b.reaction_loads
{R_0: -F*SingularityFunction(L - eps, L/2, 1)/SingularityFunction(L - eps, 0, 1),
 R_L: -F + F*SingularityFunction(L - eps, L/2, 1)/SingularityFunction(L - eps, 0, 1),
 M_L: -F*L/2 + F*L*SingularityFunction(L - eps, L/2, 1)/SingularityFunction(L - eps, 0, 1)}

Simplifying this with the knowledge that eps is very close to 0 gives:
{R_0: -F/2, R_L: -F/2, M_L: 0}

This is correct. The problem is that sympy does not know that eps is very close to zero and is only there to show which item should be evaluated first. That is why it can't solve the SingularityFunction(L - eps, L/2, 1) to L/2.

This problem can be solved by hand for these type of equations, but for larger equations this will become a lot of work.

from sympy.

mvg2002 avatar mvg2002 commented on June 24, 2024

@smichr Thanks for thinking with me. This is something I would not have come up with. The strange thing is that the solution changes when doing this.

from sympy.physics.continuum_mechanics.beam import Beam
from sympy import Symbol, Dummy, var

L = var('L', positive=True)
eps = 1/Dummy('OO', infinite=True)
F = Symbol('F')
E = Symbol('E')
I = Symbol('I')
b = Beam(L, E, I)
r0 = b.apply_support(0, type="pin")
rL, mL = b.apply_support(L, type="fixed")
b.apply_load(F, L/2, -1)
b.apply_rotation_hinge(L-eps)
b.solve_for_reaction_loads(r0, rL, mL)
b.reaction_loads

Outputs: {R_0: -F, R_L: 0, M_L: F*L/2}

It should not be possible to get a bending moment in the fixed support as there is a hinge right before it. I am not sure why this still happens.

from sympy.

mvg2002 avatar mvg2002 commented on June 24, 2024

A way that does work:

from sympy.physics.continuum_mechanics.beam import Beam
from sympy import Symbol, Dummy, var

L = var('L', positive=True)
eps = Dummy('eps', positive=True)
F = Symbol('F')
E = Symbol('E')
I = Symbol('I')
b = Beam(L, E, I)
r0 = b.apply_support(0, type="pin")
rL, mL = b.apply_support(L, type="fixed")
b.apply_load(F, L/2, -1)
b.apply_rotation_hinge(L - eps)
b.solve_for_reaction_loads(r0, rL, mL)
b.subbed_reaction_loads = {reaction: eq.subs(eps, 0) for reaction, eq in b.reaction_loads.items()}
b.subbed_reaction_loads

Ouputs: {R_0: -F/2, R_L: -F/2, M_L: 0}

This does not seem like the most robust way to do this, but does give the correct answer for this example.

from sympy.

mvg2002 avatar mvg2002 commented on June 24, 2024

Another strange thing. If you try the same code for example 2, the correct output depends on if you use b.apply_load(M, L/2+eps, -2) or b.apply_rotation_hinge(L/2-eps).

from sympy.physics.continuum_mechanics.beam import Beam
from sympy import Symbol, Dummy, var
L = var('L', positive=True)
eps = Dummy('eps', positive=True)
M = Symbol('M')
E = Symbol('E')
I = Symbol('I')
b = Beam(L, E, I)
r0 = b.apply_support(0, type="pin")
rL, mL = b.apply_support(L, type="fixed")
b.apply_load(M, L/2+eps, -2)
b.apply_rotation_hinge(L/2)
b.solve_for_reaction_loads(r0, rL, mL)
b.reaction_loads

Outputs: {R_0: 0, R_L: 0, M_L: 0}

While

from sympy.physics.continuum_mechanics.beam import Beam
from sympy import Symbol, Dummy, var
L = var('L', positive=True)
eps = Dummy('eps', positive=True)
M = Symbol('M')
E = Symbol('E')
I = Symbol('I')
b = Beam(L, E, I)
r0 = b.apply_support(0, type="pin")
rL, mL = b.apply_support(L, type="fixed")
b.apply_load(M, L/2, -2)
b.apply_rotation_hinge(L/2-eps)
b.solve_for_reaction_loads(r0, rL, mL)
b.reaction_loads

Outputs: {R_0: 0, R_L: 0, M_L: -M}, which is correct.

from sympy.

smichr avatar smichr commented on June 24, 2024

Rethinking about OO: if it is only infinite, then the sign is unknown so x+1/OO might be greater, equal or less than x. If you make it positive, there is no guarantee about ordering, e.g. x+eps might be bigger than y. But maybe (in this case) that is not a concern?

from sympy.

smichr avatar smichr commented on June 24, 2024

If you need a number that is guaranteed less than 1 you could use 1/Dummy(prime=True).

from sympy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.