Thanks  Davide!
It works now 

On Wednesday, May 5, 2021 at 2:02:48 PM UTC+1 [email protected] wrote:

> Use the doit() method, something like the following: f.doit()
>
> Davide.
>
>
> Il giorno mer 5 mag 2021 alle ore 14:58 Areeb Sherjil <[email protected]> 
> ha scritto:
>
>> Oh no sorry, I used %matplotlib tk at the start and now it opens the 
>> graph in separate window.(Google groups does not allow to edit messages )
>>
>> But how to expand the summation series?
>>
>> On Wednesday, May 5, 2021 at 1:52:16 PM UTC+1 Areeb Sherjil wrote:
>>
>>> Respond to  Davide
>>>
>>> Hi,
>>> Thanks for this.
>>> 1-I want to ask: how do I expand the sigma summation like : 
>>> cos+cos2+cos3..... etc 
>>> 2- Also how do I open the plot in a separate window to make it 
>>> bigger/zoom etc?
>>>
>>>
>>> On Wednesday, May 5, 2021 at 1:31:05 PM UTC+1 [email protected] 
>>> wrote:
>>>
>>>> Whenever it makes sense, you should use assumptions on symbols. Since 
>>>> you are dealing with a Fourier Series, you should set:
>>>>
>>>> import sympy as syms
>>>> import matplotlib.pyplot as plot
>>>> import numpy as linspace
>>>> n = syms.symbols('n', real=True, integer=True, positive=True)
>>>> t = syms.symbols('t', real=True)
>>>>
>>>> T= 1
>>>> w= 2*syms.pi/T
>>>> V=1   # square wave of 1volts with 1second period
>>>> Ao= (w/syms.pi)* syms.integrate(V,(t,0,0.5))
>>>> An= (w/syms.pi)*syms.integrate(V*syms.cos(w*n*t),(t,0,T/2))
>>>> Bn= (w/syms.pi)*syms.integrate(V*syms.sin(w*n*t),(t,0,T/2))
>>>> f= Ao/2 +syms.Sum(An*syms.cos(n*w*t),(n,1,5))+ 
>>>> syms.Sum(Bn*syms.sin(n*w*t),(n,1,5))
>>>> f
>>>>
>>>> At this point, the expression f looks like can be simplified. Then:
>>>>
>>>> syms.plot(f.simplify(), (t, 0, 4*T))
>>>>
>>>> Davide.
>>>>
>>>>
>>>> Il giorno mer 5 mag 2021 alle ore 14:07 Areeb Sherjil <
>>>> [email protected]> ha scritto:
>>>>
>>>>> No one is replying, lemme paste the code here:
>>>>>
>>>>>
>>>>> import sympy as syms
>>>>> import matplotlib.pyplot as plot
>>>>> import numpy as linspace
>>>>> n,t= syms.symbols('n,t')
>>>>> T= 1
>>>>> w= 2*syms.pi/T
>>>>> V=1   # square wave of 1volts with 1second period
>>>>> Ao= (w/syms.pi)* syms.integrate(V,(t,0,0.5))
>>>>> An= (w/syms.pi)*syms.integrate(V*syms.cos(w*n*t),(t,0,T/2))
>>>>> Bn= (w/syms.pi)*syms.integrate(V*syms.sin(w*n*t),(t,0,T/2))
>>>>> f= Ao/2 +syms.Sum(An*syms.cos(n*w*t),(n,1,5))+ 
>>>>> syms.Sum(Bn*syms.sin(n*w*t),(n,1,5))
>>>>> f
>>>>>
>>>>> syms.plot(f,(t,0,2*T))
>>>>>
>>>>>
>>>>>
>>>>> On Friday, April 23, 2021 at 4:09:20 PM UTC+1 Areeb Sherjil wrote:
>>>>>
>>>>>> Hi all, 
>>>>>> I hope everyone is enjoying themselves!
>>>>>> I am trying to compute the Fourier series of a simple signal(1 Volt 
>>>>>> square with freq of 1hz and 0.5T pulse width). 
>>>>>>
>>>>>> This is what I need help with:
>>>>>> 1- How can I make sympy display the results of the sigma summation as 
>>>>>> : Ao+An1+An2+An3....... etc instead of the way it now?Like how do I 
>>>>>> expand 
>>>>>> it?
>>>>>> 2- When I try to plot this, I get a warning message telling me to 
>>>>>> report this as a bug? Why is this ?(look at screenshot)
>>>>>>
>>>>>> Any response is very much appreciated 
>>>>>> All necessary file attached(CODE:
>>>>>> https://drive.google.com/file/d/17W3GqiN0x1oByMdgAiZHssGNu2aCJdPV/view?usp=sharing
>>>>>> )[image: Screenshot (286).png]
>>>>>>
>>>>> -- 
>>>>> 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 view this discussion on the web visit 
>>>>> https://groups.google.com/d/msgid/sympy/05c2fc4e-82a6-447f-aca3-3694af254938n%40googlegroups.com
>>>>>  
>>>>> <https://groups.google.com/d/msgid/sympy/05c2fc4e-82a6-447f-aca3-3694af254938n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>> -- 
>> 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 view this discussion on the web visit 
>> https://groups.google.com/d/msgid/sympy/51ab68de-b41b-4fce-9b41-e428d2c8d42dn%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/sympy/51ab68de-b41b-4fce-9b41-e428d2c8d42dn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/164c25e4-c17b-433a-be42-cc5b7bb2680bn%40googlegroups.com.

Reply via email to