Re: [Tutor] coding help with maxwell-boltzmann distribution

2017-10-13 Thread Peter Otten
D.V.N.Sarma డి.వి.ఎన్.శర్మ wrote: > f = np.zeros(40) > v = np.arange(0,4,0.1) > for i in np.arange(0, 40): > f[i] = v[i]**2*(np.exp(-v[i]**2)) Note that you can write this without Python loop as v = np.arange(0, 4, 0.1) f = v**2 * np.exp(-v**2)

Re: [Tutor] sibling import

2017-10-13 Thread Alex Kleider
On 2017-10-12 15:58, Mats Wichmann wrote: On 10/12/2017 05:15 AM, Atar new wrote: Hi Team, Here is my problem. I want to use sibling import but it is not working . I know taht if we add the directory in sys.path ,it will work. But I have to package the whole application and will create a

Re: [Tutor] coding help with maxwell-boltzmann distribution

2017-10-13 Thread D . V . N . Sarma డి . వి . ఎన్ . శర్మ
Yes we can vectorize. regards, Sarma. On Fri, Oct 13, 2017 at 9:43 PM, Peter Otten <__pete...@web.de> wrote: > D.V.N.Sarma డి.వి.ఎన్.శర్మ wrote: > > f = np.zeros(40) > > v = np.arange(0,4,0.1) > > for i in np.arange(0, 40): > > f[i] = v[i]**2*(np.exp(-v[i]**2)) > > Note that you can write

[Tutor] How to test for the existence of a table in a sqlite3 db?

2017-10-13 Thread boB Stepp
I want to use Alan's (and others') idea to run a SQL file to create a table if that table does not exist. Alan suggested using executescript() to do this. I misunderstood Alan and thought that this would take a filename and execute it. Instead, it appears that I must pass to it a string which

Re: [Tutor] coding help with maxwell-boltzmann distribution

2017-10-13 Thread D . V . N . Sarma డి . వి . ఎన్ . శర్మ
Except for some constants the essential behaviour of Maxweell-Boltzmann distribution is determined by v**2 * exp(-v**2) The following code will gove you a plot of the shape of the curve. from matplotlib import pyplot as plt import numpy as np f = np.zeros(40) v = np.arange(0,4,0.1) for i in

Re: [Tutor] using while loop for read process memory

2017-10-13 Thread Michael C
Sorry Alan, Steve, everyone Can you take a look of this please? Here is my question about the memory: So I have a base address of a chunk of memory from it's size, from VirtualQueryEx (if you dont use windows, it's ok, it's not about how u get these values, because I think the base concept is

Re: [Tutor] problem with program

2017-10-13 Thread Mark Lawrence via Tutor
On 13/10/17 13:04, Chris Coleman wrote: just learning python as my first programming language. going through the book "python in easy steps" by mike mcgrath. i am going through the programs in chapter 7 and can't get them to work. here is the first one in the chapter: class Bird: '''A

Re: [Tutor] problem with program

2017-10-13 Thread Alan Gauld via Tutor
On 13/10/17 18:53, Alan Gauld via Tutor wrote: > On 13/10/17 13:04, Chris Coleman wrote: > >> def_init_(self,chat): > >> File "scripts/bird.py", line 4 >> def_init_(self,chat): >> ^ >> SyntaxError: invalid syntax > > There are two problems here. I meant to

[Tutor] OT: New book on pytest

2017-10-13 Thread boB Stepp
I just got the book in The Pragmatic Programmers series, "Python Testing with pytest -- Simple, Rapid, Effective, and Scalable" by Brian Okken, c. 2017. I've gone through about three chapters so far and I am really liking this book and pytest. Now that I am playing around with pytest, I must say

[Tutor] problem with program

2017-10-13 Thread Chris Coleman
just learning python as my first programming language. going through the book "python in easy steps" by mike mcgrath. i am going through the programs in chapter 7 and can't get them to work. here is the first one in the chapter: class Bird: '''A base class to define bird properties.'''

Re: [Tutor] coding help with maxwell-boltzmann distribution

2017-10-13 Thread Mark Lawrence via Tutor
On 12/10/17 21:22, Cameron McKay wrote: Hello, I've never used python trying to plot a graph. Thus I am having difficulties trying to plot the maxwell-boltzmann distribution. right now i've defined the y-axis given the probability, but the difficult part is trying to plot x in the form of: x =

Re: [Tutor] using while loop for read process memory

2017-10-13 Thread Michael C
Here is my question about the memory: So I have a base address of a chunk of memory from it's size, from VirtualQueryEx (if you dont use windows, it's ok, it's not about how u get these values, because I think the base concept is the same) start = mbi.BaseAddress finish = mbi.RegionSize So at

Re: [Tutor] using while loop for read process memory

2017-10-13 Thread Michael C
in fact, when I am using this: end = start + mbi.RegionSize I was getting error from the ReadProcessMemory function, and I couldn't figure it out why. Until I did this: end = current_address + mbi.RegionSize - 7 then it doesn't complain anymore. I think it's because I ran this

Re: [Tutor] using while loop for read process memory

2017-10-13 Thread Alan Gauld via Tutor
On 13/10/17 02:58, Michael C wrote: >         end = current_address + mbi.RegionSize - 7 > > then it doesn't complain anymore. I think it's because I ran this in a > while loop with start += 1 > so in the last 7 bytes, I'd be reading past the end of this memory chunk. > > Is this right? Yes,

Re: [Tutor] problem with program

2017-10-13 Thread Alan Gauld via Tutor
On 13/10/17 13:04, Chris Coleman wrote: > def_init_(self,chat): > File "scripts/bird.py", line 4 > def_init_(self,chat): > ^ > SyntaxError: invalid syntax There are two problems here. The first is that you need a space after the def. The second is that