Yah, It works. Thanks.



Regards
Sampad Kumar Saha
Mathematics and Computing
I.I.T. Kharagpur

On Fri, Mar 25, 2016 at 2:59 AM, Sartaj Singh <[email protected]>
wrote:

> Sorry, for not being clear the first time. x needs to be real. Symbol('x',
> real=True) should also work.
>
> On 25 March 2016 at 02:54, SAMPAD SAHA <[email protected]> wrote:
>
>> Thank you Sartaj for the explanation.
>>
>> But why is it so that only after appling : *x = Symbol('x',
>> nonnegative=True) *the above statement works.
>>
>> If we dont use *x = Symbol('x', nonnegative=True) *it gives :
>>
>> In [35]: Heaviside(x).rewrite(Piecewise)
>> Out[35]: Heaviside(x)
>>
>>
>>
>>
>>
>> Regards
>> Sampad Kumar Saha
>> Mathematics and Computing
>> I.I.T. Kharagpur
>>
>> On Fri, Mar 25, 2016 at 2:42 AM, Sartaj Singh <[email protected]>
>> wrote:
>>
>>> In [20]: x = Symbol('x', nonnegative=True)
>>>
>>> In [21]: Heaviside(x).rewrite(Piecewise)
>>> Out[21]:
>>> ⎧ 1   for x > 0
>>> ⎪
>>> ⎨1/2  for x = 0
>>> ⎪
>>> ⎩ 0   otherwise
>>>
>>>
>>>
>>>
>>> On Friday, 25 March 2016 02:15:34 UTC+5:30, SAMPAD SAHA wrote:
>>>>
>>>>
>>>> We have this *_eval_rewrite_as_Piecewise()  *method defined in
>>>> *Heaviside* Class.
>>>> But How can we call it or use this implemented functionality from
>>>> terminal?
>>>>
>>>>
>>>>
>>>> Regards
>>>> Sampad Kumar Saha
>>>> Mathematics and Computing
>>>> I.I.T. Kharagpur
>>>>
>>>> On Fri, Mar 25, 2016 at 2:00 AM, SAMPAD SAHA <[email protected]>
>>>> wrote:
>>>>
>>>> Hi Aaron,
>>>>
>>>> Pardon Please. I am bit confused. Are you taking about the "*Piecewise
>>>> Representation*" that I have mentioned in Phase I ?
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Regards
>>>> Sampad Kumar Saha
>>>> Mathematics and Computing
>>>> I.I.T. Kharagpur
>>>>
>>>> On Fri, Mar 25, 2016 at 12:00 AM, Aaron Meurer <[email protected]>
>>>> wrote:
>>>>
>>>> You should call the method _eval_rewrite_Piecewise. Then you can call
>>>> it with expr.rewrite(Piecewise). The advantage here is that this will
>>>> automatically work even if it's a subexpression of some larger expression.
>>>>
>>>> Aaron Meurer
>>>>
>>>> On Fri, Mar 18, 2016 at 9:37 PM, Jason Moore <[email protected]>
>>>> wrote:
>>>>
>>>> Simplification means something very specific in SymPy, see the
>>>> simplify() function. I think you need to choose a different method name for
>>>> converting to piecewise continuous. Maybe: .to_piecewise()?
>>>>
>>>> You will need to implement some method for dealing with the constants
>>>> of integration and boundary conditions. Maybe you should have a look at the
>>>> ordinary differential equations package in SymPy to get some ideas about
>>>> that.
>>>>
>>>>
>>>> Jason
>>>> moorepants.info
>>>> +01 530-601-9791
>>>>
>>>> On Fri, Mar 18, 2016 at 4:04 PM, SAMPAD SAHA <[email protected]>
>>>> wrote:
>>>>
>>>> Thank You Jason for the appreciation.
>>>>
>>>> Yah, that *Simplify  * method would convert  into continous piecewise.
>>>> Like this :-
>>>>
>>>> In    [ ] : F = singularityFunc(x, 0, 1) +  singularityFunc(x, 3, 2)
>>>>
>>>> In    [ ] : F
>>>> Out [ ] :
>>>>                     2
>>>> <x> + <x - 3>
>>>>
>>>> In [ ] : F.simplify()
>>>> Out [ ] :
>>>>
>>>> 0                   for x < 0
>>>> x                   for 0 <= x < 3
>>>> x + (x-3)^2    for x  >= 3
>>>>
>>>>
>>>> As you have suggested earlier, I have solved some examples by hand and
>>>> then tried to implement a desired api. From that I came to this conclusion
>>>> that if we implement Addition, Substraction, Integration,
>>>> Differentiation, Simplify on Singularity Functions then we can successfully
>>>> solve out the beam problems.
>>>>
>>>> But i got doubt while implementing the boundary constants. I mean to
>>>> say that sympy dont gives constant of integration while doing indefinite
>>>> integration. We can take boundary conditions as input from users that is
>>>> not a problem, but we cant use it since there will be no constant of
>>>> integration.
>>>>
>>>>
>>>>
>>>> Regards
>>>> Sampad Kumar Saha
>>>> Mathematics and Computing
>>>> I.I.T. Kharagpur
>>>>
>>>> On Sat, Mar 19, 2016 at 4:07 AM, Jason Moore <[email protected]>
>>>> wrote:
>>>>
>>>> Sounds like a good start. How about a method to convert to continuous
>>>> piecewise?
>>>>
>>>> Like I said earlier, you should pick some examples that you want the
>>>> software to be able to solve and then implement methods and functionality
>>>> based on those examples. It's hard to think of all the needed functionality
>>>> and API without motivating examples first.
>>>>
>>>>
>>>> Jason
>>>> moorepants.info
>>>> +01 530-601-9791
>>>>
>>>> On Fri, Mar 18, 2016 at 10:27 AM, SAMPAD SAHA <[email protected]>
>>>> wrote:
>>>>
>>>> Jason,
>>>>
>>>> I have thought of implementing Addition, Substraction, Integration,
>>>> Differentiation, Simplify on Singularity Functions.
>>>>
>>>> What are the other functionalities we should implement?
>>>>
>>>>
>>>>
>>>>
>>>> Regards
>>>> Sampad Kumar Saha
>>>> Mathematics and Computing
>>>> I.I.T. Kharagpur
>>>>
>>>> On Fri, Mar 18, 2016 at 8:16 PM, SAMPAD SAHA <[email protected]>
>>>> wrote:
>>>>
>>>> Yah you are correct. Differentiation of heaviside and diracdelta also
>>>> exists.
>>>>
>>>> It was my mistake. Thanks for rectifying me.
>>>>
>>>>
>>>>
>>>>
>>>> Regards
>>>> Sampad Kumar Saha
>>>> Mathematics and Computing
>>>> I.I.T. Kharagpur
>>>>
>>>> On Fri, Mar 18, 2016 at 8:02 PM, Tim Lahey <[email protected]> wrote:
>>>>
>>>> For differentiation you’re missing a case,
>>>>
>>>> if n = 0 or n = -1
>>>>    return Singularity(x, a, n-1)
>>>> else if n < -1
>>>>    return error
>>>>
>>>> In other words, you can still differentiate for the n = 0 and n = -1
>>>> cases.
>>>>
>>>> Cheers,
>>>>
>>>> Tim.
>>>>
>>>> > On Mar 18, 2016, at 10:22 AM, SAMPAD SAHA <[email protected]> wrote:
>>>> >
>>>> > And what about the pseudocode of integration and differentiation i
>>>> have posted earlier , is it alright?
>>>> >
>>>> >
>>>> >
>>>> >
>>>> >
>>>> > Regards
>>>> > Sampad Kumar Saha
>>>> > Mathematics and Computing
>>>> > I.I.T. Kharagpur
>>>> >
>>>> > On Fri, Mar 18, 2016 at 7:51 PM, SAMPAD SAHA <[email protected]>
>>>> wrote:
>>>> > Thanks Tim,
>>>> >
>>>> > It is really a nice and effective solution.
>>>> >
>>>> >
>>>> >
>>>> >
>>>> >
>>>> > Regards
>>>> > Sampad Kumar Saha
>>>> > Mathematics and Computing
>>>> > I.I.T. Kharagpur
>>>> >
>>>> > On Fri, Mar 18, 2016 at 7:46 PM, Tim Lahey <[email protected]> wrote:
>>>> > Add the constants when you integrate in your beam class.
>>>> >
>>>> >
>>>> > On 2016-03-18, at 10:12 AM, SAMPAD SAHA <[email protected]> wrote:
>>>> >
>>>> >> Thanks TIm,
>>>> >>
>>>> >> Integration and Differentiation are really very straight forward
>>>> that is why i am thinking to add diff and integrate method to the
>>>> Singularity function class itself.
>>>> >>
>>>> >> For integrate the pseuesocode will be :-
>>>> >>
>>>> >> if(n<0)
>>>> >>     return SingularityFunction(x , a, n+1)
>>>> >> else
>>>> >>     return (1/n+1 * SingularityFunction(x , a, n+1))
>>>> >>
>>>> >> Similarly for differentiation:
>>>> >>
>>>> >> if (n>0)
>>>> >>    return n * SingularityFunction(x , a, n - 1)
>>>> >> else
>>>> >>    Error message
>>>> >>
>>>> >>
>>>> >> My doubt regarding Boundary condition was actually was that since
>>>> sympy don't provide constant of integration while performing indefinite
>>>> integration on any expression, how to use the boundary conditions to find
>>>> the exact values of constant of integration?
>>>> >>
>>>> >>
>>>> >>
>>>> >>
>>>> >>
>>>> >> Regards
>>>> >> Sampad Kumar Saha
>>>> >> Mathematics and Computing
>>>> >> I.I.T. Kharagpur
>>>> >>
>>>> >> On Fri, Mar 18, 2016 at 6:09 PM, Tim Lahey <[email protected]>
>>>> wrote:
>>>> >> Hi,
>>>> >>
>>>> >> Do you know the integration and differentiation rules for
>>>> singularity functions? They’re pretty straightforward.
>>>> >>
>>>> >> As for boundary conditions, the beam will have supports (or a free
>>>> end) at each end of the beam and as part of the beam creation each end type
>>>> is specified. Each type corresponds to a specific set of conditions on that
>>>> end (either at x=0 or x=L). You substitute those conditions in the
>>>> appropriate equation and solve for the integration constant as necessary.
>>>> All of the conditions should be in any decent mechanics of deformable
>>>> solids text book.
>>>> >>
>>>> >> You’ll want to do sums of forces and moments as well to solve for
>>>> reaction forces as well.
>>>> >>
>>>> >> The only trick is making sure you don’t double count things. If you
>>>> have a step function due to a reaction force at the start of the beam and
>>>> assume it’s zero at x=0 (effectively the limit at x=0^-) you can get a
>>>> non-zero integration constant that can be double counting that reaction
>>>> since at x=0^+ that reaction force is non-zero. Note that you can get a
>>>> non-zero integration constant (even when including reaction forces in the
>>>> loading function) for shear and moment equations if you have non-polynomial
>>>> loads (e.g., sine and cosine). You’ll also have to think about the other
>>>> end as well. I leave it up to you to reason that out. Make sure you
>>>> completely document how you’ve implemented it for the user (and why).
>>>> >>
>>>> >> Beam coordinate systems must start at the left end and increase to
>>>> the right. The definition of the singularity functions require this.
>>>> >>
>>>> >> I hope this helps.
>>>> >>
>>>> >> Cheers,
>>>> >>
>>>> >> Tim.
>>>> >>
>>>> >> > On Mar 18, 2016, at 8:17 AM, SAMPAD SAHA <[email protected]>
>>>> wrote:
>>>> >> >
>>>> >> > I am also confused about implementing the boundary conditions for
>>>> getting the deflection curve.
>>>> >> >
>>>> >> > Any suggestions on how to implement it.
>>>> >> >
>>>> >> >
>>>> >> >
>>>> >> >
>>>> >> >
>>>> >> > Regards
>>>> >> > Sampad Kumar Saha
>>>> >> > Mathematics and Computing
>>>> >> > I.I.T. Kharagpur
>>>> >> >
>>>> >> > On Fri, Mar 18, 2016 at 5:36 PM, SAMPAD SAHA <[email protected]>
>>>> wrote:
>>>> >> > Yah, you are right multiplication of singularity functions are not
>>>> needed for solving beam problems. Mathematically, it is also not used that
>>>> much. So lets leave this multiplication and powers part.
>>>> >> >
>>>> >> > I was thinking about the integrate and diff methods. I feel that
>>>> we should define instance methods diff and  integrate  in the singularity
>>>> function module which would internally use the existing diff and integrate
>>>> function for Differentiation and Integration respectively.
>>>> >> >
>>>> >> > I need your suggestions.
>>>> >> >
>>>> >> >
>>>> >> >
>>>> >> >
>>>> >> >
>>>> >> >
>>>> >> >
>>>> >> > Regards
>>>> >> > Sampad Kumar Saha
>>>> >> > Mathematics and Computing
>>>> >> > I.I.T. Kharagpur
>>>> >> >
>>>> >> > On Fri, Mar 18, 2016 at 3:14 AM, Jason Moore <[email protected]>
>>>> wrote:
>>>> >> > I think you need to override the operators. I'm not sure if
>>>> multiplying singularity functions is needed (at least for beam problems),
>>>> even if it is mathematically correct, you don't have to implement it. If it
>>>> is easy to implement then, sure, do so.
>>>> >> >
>>>> >> >
>>>> >> > Jason
>>>> >> > moorepants.info
>>>> >> > +01 530-601-9791
>>>> >> >
>>>> >> > On Thu, Mar 17, 2016 at 1:34 PM, SAMPAD SAHA <[email protected]>
>>>> wrote:
>>>> >> >
>>>> >> > Jason,
>>>> >> >
>>>> >> > For implementing Additon , Multiplication Do we need to over ride
>>>> __mul__ , __add__  these methods inside the class SingularityFunction or we
>>>> can just use simplify for getting the results.
>>>> >> >
>>>> >> > I am really confused.
>>>> >> >
>>>> >> >
>>>> >> >
>>>> >> >
>>>> >> > Regards
>>>> >> > Sampad Kumar Saha
>>>> >> > Mathematics and Computing
>>>> >> > I.I.T. Kharagpur
>>>> >> >
>>>> >> > On Fri, Mar 18, 2016 at 1:59 AM, SAMPAD SAHA <[email protected]>
>>>> wrote:
>>>> >> >
>>>> >> > I was thinking about multiplication of two singularity functions.
>>>> It is possible and it is mathematically significant. We can implement this
>>>> too in Sympy. Similarly with powers.
>>>> >> >
>>>> >> > I need your suggestions.
>>>> >> >
>>>> >> >
>>>> >> >
>>>> >> >
>>>> >> >
>>>> >> > Regards
>>>> >> > Sampad Kumar Saha
>>>> >> > Mathematics and Computing
>>>> >> > I.I.T. Kharagpur
>>>> >> >
>>>> >> > On Wed, Mar 16, 2016 at 9:41 PM, SAMPAD SAHA <[email protected]>
>>>> wrote:
>>>> >> > Yah , You are right . A software having good documentations about
>>>> all the functionality is preffered more over the others by the users. I
>>>> will be spending a good amount of time in preparing the documentation
>>>> citing plenty of examples and tutorials.
>>>> >> >
>>>> >> > Here is link to my proposal. I have almost added all the things
>>>> which we have disscussed. I still need to add the example and many more
>>>> "TODO"s are left. I am working on those.
>>>> >> >
>>>> >> >
>>>> >> > Suggestions are welcomed.
>>>> >> >
>>>> >> >
>>>> >> >
>>>> >> >
>>>> >> >
>>>> >> >
>>>> >> > Regards
>>>> >> > Sampad Kumar Saha
>>>> >> > Mathematics and Computing
>>>> >> > I.I.T. Kharagpur
>>>> >> >
>>>> >> > On Wed, Mar 16, 2016 at 6:18 AM, Jason Moore <[email protected]>
>>>> wrote:
>>>> >> > Looks good. I think you should have plenty of examples in the
>>>> docs. People tend to use software more if the docs are top notch. So plenty
>>>> of examples and tutorials will really help.
>>>> >> >
>>>> >> >
>>>> >> > Jason
>>>> >> > moorepants.info
>>>> >> > +01 530-601-9791
>>>> >> >
>>>> >> > On Tue, Mar 15, 2016 at 5:25 PM, SAMPAD SAHA <[email protected]>
>>>> wrote:
>>>> >> > You are right. delta_function.py needs to be improved. I will to
>>>> be using only DiracDelta and Heaviside for generating almost all the
>>>> Singularity Functions.
>>>> >> >
>>>> >> > I was also thinking to complete this project in four phases:
>>>> >> >       • Improving existiing Functions.
>>>> >> >       • Creating Singularity Functions module
>>>> >> >       • Creating beam Module
>>>> >> >       • Documentation
>>>> >> >
>>>> >> >
>>>> >> >
>>>> >> >
>>>> >> >
>>>> >> > Regards
>>>> >> > Sampad Kumar Saha
>>>> >> > Mathematics and Computing
>>>> >> > I.I.T. Kharagpur
>>>> >> >
>>>> >> > On Wed, Mar 16, 2016 at 5:44 AM, Jason Moore <[email protected]>
>>>> wrote:
>>>> >> > https://www.python.org/dev/peps/pep-0008/
>>>> >> >
>>>> >> > I think you will need a pure singularity function module and then
>>>> you will need a beam module that utlizes the singularity function module.
>>>> You will also likely need to improve the discontinuous functions that are
>>>> already in sympy. There are at least three layers to this in my eyes.
>>>> >> >
>>>> >> >
>>>> >> > Jason
>>>> >> > moorepants.info
>>>> >> > +01 530-601-9791
>>>> >> >
>>>> >
>>>>
>>>> ...
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "sympy" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To post to this group, send email to [email protected].
>>> Visit this group at https://groups.google.com/group/sympy.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/sympy/1271931a-6b6f-4352-8b21-82621cb06842%40googlegroups.com
>>> <https://groups.google.com/d/msgid/sympy/1271931a-6b6f-4352-8b21-82621cb06842%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>
>
> --
> Regards
> *Sartaj Singh*
>
> *Mathematics and Computing*,
> Indian Institute of Technology,
> Varanasi - 221 005 INDIA
>
> E-mail: [email protected], *[email protected]
> <[email protected]>*
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CANzav4FA3%2Bdr8omo%2B%2Boa0o4kfNfQ_XVd8O0%2Bm0JeLScR4co2mw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to