It should work, yes. plot() will evaluate the integral numerically.

Aaron Meurer

On Wed, May 3, 2017 at 4:58 PM, Carlos Bouthelier Madre <
[email protected]> wrote:

> All right! Thanks again.
>
> If later I would like to plot that integral(f(xi,Beta)*dxi) with Beta in
> the X axis, would it work?
>
>
> El miércoles, 3 de mayo de 2017, 0:17:41 (UTC+2), Aaron Meurer escribió:
>>
>> If you use Integral() instead of integrate() it will keep the integral
>> unevaluated. Otherwise, it will try to compute it, and if it cannot compute
>> a closed-form expression, it will return an Integral object.
>>
>> Aaron Meurer
>>
>> On Tue, May 2, 2017 at 6:16 PM, Carlos Bouthelier Madre <
>> [email protected]> wrote:
>>
>>> Thanks for your message, Aaron!
>>> I restarted my computer and it worked, not having changed a thing,
>>> so.... problem solved!
>>>
>>> I have another problem though,  I have a function f(x) which I know has
>>> no primitive, but I want to define its integral from 0 to 2*pi, would
>>> python know what integrate(f(x),(x,0,2*pi)) means? Or, conversely, would it
>>> keep trying to get a primitive expression "indefinitely"? (I think this is
>>> what is happening) If so, does anybody know if there is another way to do
>>> this?
>>>
>>> In fact , what I have is f(x1,x2,...xi,xi+1,....xn,Beta) and I want to
>>> define the integral of that function in the xi variables from i=1 to n
>>> iteratively (n is a value, like 10) from i=1 to N, obtaining an expression
>>> exclusively on Beta (I say this just in case it makes harder the use of an
>>> hypothetic method that could solve my problem )
>>>
>>> Thanks in advance!!
>>>
>>> El domingo, 30 de abril de 2017, 3:16:11 (UTC+2), Aaron Meurer escribió:
>>>>
>>>> Matrices can have expressions as elements. What does the code do when
>>>> you run it? It doesn't run for me because kron is not defined.
>>>>
>>>> Aaron Meurer
>>>>
>>>> On Sat, Apr 29, 2017 at 7:52 AM, Carlos Bouthelier Madre <
>>>> [email protected]> wrote:
>>>>
>>>>> Hi, I have just started using sympy and I don't really know how to
>>>>> make this work. I've got functions that should return a matrix (I don't
>>>>> know if that is possible) whose elements are expressions of symbolic
>>>>> variables.
>>>>> This is my code, I've made a logical analysis of it (in pseudo-code)
>>>>> and it should do what I want to, the issue is that I am neither used to
>>>>> sympy variables nor to python syntaxis, so I would really appreciate your
>>>>> help.
>>>>>
>>>>> from sympy import *
>>>>> from sympy import cos
>>>>> from sympy.tensor.array import Array
>>>>> from sympy import I, Matrix, symbols
>>>>> from sympy import init_printing
>>>>> from sympy import init_session
>>>>>
>>>>>
>>>>> from IPython.display import display, Math, Latex
>>>>>
>>>>>
>>>>> var('Tita1 Tita2 Tita3 Tita4 Tita5 Tita6 Beta eps', real=True)
>>>>> def delta(n):
>>>>>     f='Tita'+str(n)
>>>>>     return sqrt(cos(f)*cos(f)*eps*eps+1)
>>>>>
>>>>> def EF(i):
>>>>>     return Matrix([[0,0],[0,2*delta(i)]])
>>>>>
>>>>> ID=Matrix([[1,0],[0,1]])
>>>>>
>>>>> def ExtDim(X,n):
>>>>>     if n==1:
>>>>>         return X
>>>>>     else:
>>>>>         return kron(ExtDim(X,n-1),ID)
>>>>>
>>>>> def n_energy(n):
>>>>>     if n==1:
>>>>>         return EF(n)
>>>>>     else:
>>>>>         return kron(ID,n_energy(n-1))+ExtDim(EF(n),n) #This should be
>>>>> a matrix
>>>>>
>>>>>
>>>>> Thanks in advance!
>>>>>
>>>>> --
>>>>> 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/ea805a03-ad40-44e9-
>>>>> 8b44-f9957536e192%40googlegroups.com
>>>>> <https://groups.google.com/d/msgid/sympy/ea805a03-ad40-44e9-8b44-f9957536e192%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>> --
>>> 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/ms
>>> gid/sympy/59614cf0-8cc3-43c5-946a-af3058c7f770%40googlegroups.com
>>> <https://groups.google.com/d/msgid/sympy/59614cf0-8cc3-43c5-946a-af3058c7f770%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> 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/e721540f-d18e-4bdf-bcca-f98b940a2d66%40googlegroups.com
> <https://groups.google.com/d/msgid/sympy/e721540f-d18e-4bdf-bcca-f98b940a2d66%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAKgW%3D6Lfxq%3DoOY36tAJtejsufXH0BX-kFF2KZ1DfMQ_c%2B%2BtLew%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to