Re: [Tutor] While Loops: Coin Flip Game :p:

2010-11-15 Thread Dave Angel
When I run this code (I'm also a noob) I get this result:- [evaluate lines 1-22 from untitled-1.py] The number of heads was 73 The number of tails was 100 Press the enter key to exit. # Surely, if flipping a single coin 100 times your total number of heads and tails should add up to 100 # not

Re: [Tutor] program hangs in while loop using wx.yield

2010-11-15 Thread Terry Carroll
On Sun, 14 Nov 2010, Alex Hall wrote: Is there a basic tutorial for this sort of thing? Chapter 3 ("Working in an event-driven environment") of the book "wxPython in Action" is a pretty good tutorial on event-driven GUI programming in wxPython. The book in general is pretty good; I no longe

Re: [Tutor] I try to convert a MATLAB program to Python...

2010-11-15 Thread Henri Heinonen
These are the four (out of eight) first results I get with the MATLAB code: >> nonhomog(0.2) nonhomog: using 300 grid points. BC1_disc_left = -4.8436e-12 BC1_disc_right = -1.1027e-13 BC2_disc_left = -1.1269e-11 BC2_disc_right = -1.8657e-13 lambda = 0.9976 V0 = 7

[Tutor] I try to convert a MATLAB program to Python...

2010-11-15 Thread Henri Heinonen
Hi! Can you, please, try to help me with Python? I try to convert a MATLAB program to Python. Here are the MATLAB codes: http://pastebin.com/MbPZ8Z7X http://pastebin.com/dDnF5AF2 Here is my Python code: http://pastebin.com/jCPdLHx7 What is wrong with my Python code? The program doesn't produce

Re: [Tutor] Math: integers to a fractional power (Matthew Denaburg)

2010-11-15 Thread C or L Smith
If you are interested in a symbolic solution or numerical solution without missing any of the possible roots (real or imaginary) you could check out sympy, a CAS that offers a quartic solution. It uses appropriate simplifications besides a general solution to the quartic. The code for this is i

Re: [Tutor] While Loops: Coin Flip Game :p:

2010-11-15 Thread Nithya Nisha
Hi Tom, Your code is almost correct. Little mistake is there.The random number generate should be in while loop. > import random > > # set the coin > headsCount = 0 > tailsCount = 0 > count = 0 > > # the loop > while count < 100: #If you declare count = 0. The while loo

Re: [Tutor] While Loops: Coin Flip Game :p:

2010-11-15 Thread Luke Pettit
When I run this code (I'm also a noob) I get this result:- >>> [evaluate lines 1-22 from untitled-1.py] The number of heads was 73 The number of tails was 100 Press the enter key to exit. # Surely, if flipping a single coin 100 times your total number of heads and tails should add up to 100 # no

Re: [Tutor] While Loops: Coin Flip Game :p:

2010-11-15 Thread Nithya Nisha
Hi Tom, Your code is almost correct. Little mistake is there.The random number generate should be in while loop. > import random > > # set the coin > headsCount = 0 > tailsCount = 0 > count = 0 > > # the loop > while count < 100: #If you declare

Re: [Tutor] Math: integers to a fractional power

2010-11-15 Thread Dave Angel
On 2:59 PM, Matthew Denaburg wrote: Hi, OK, so I have a question for you math people: I am trying to solve a quartic equation (Ax^4 + Bx^3 + Cx^2 + Dx + E) using Ferrari's Method, which I found on Wikipedia at this location. I'm using Python 3.1.2 (on Mac OS X 10.6, in case th

Re: [Tutor] Math: integers to a fractional power

2010-11-15 Thread Steven D'Aprano
Matthew Denaburg wrote: -27**(1/3) -3.0 math.pow(-27, 1/3) Traceback (most recent call last): File "", line 1, in math.pow(-27, 1/3) ValueError: math domain error Is there something going on here that I am unaware of? Yes, various things. The precedence of the exponentiatio

Re: [Tutor] Math: integers to a fractional power

2010-11-15 Thread Evert Rol
> OK, so I have a question for you math people: I am trying to solve a > quartic equation (Ax^4 + Bx^3 + Cx^2 + Dx + E) using Ferrari's Method, which > I found on Wikipedia at this location. > > I'm using Python 3.1.2 (on Mac OS X 10.6, in case that matters). > > First, since

[Tutor] Math: integers to a fractional power

2010-11-15 Thread Matthew Denaburg
Hi, OK, so I have a question for you math people: I am trying to solve a quartic equation (Ax^4 + Bx^3 + Cx^2 + Dx + E) using Ferrari's Method, which I found on Wikipedia at this location. I'm using Python 3.1.2 (on Mac OS X 10.6, in case that matters). First, since I d

Re: [Tutor] Threading and Sockets

2010-11-15 Thread Wayne Werner
Well, I solved the issue myself I changed the server class to the following: class Server(threading.Thread): def __init__(self, port=1500, max_connections=5): ''' Setup the server elements. ''' threading.Thread.__init__(self) self.server = socket.socket(socket.AF_INET

[Tutor] Threading and Sockets

2010-11-15 Thread Wayne Werner
Hi, I'm working on creating a server/client bit of software using threading and sockets (it's a project so I can't use something like twisted), and I've run into a slight issue with my server. My server currently looks like this: class ClientThread(threading.Thread): def __init__(self, socket

Re: [Tutor] program hangs in while loop using wx.yield

2010-11-15 Thread Alan Gauld
"Alex Hall" wrote Is there a basic tutorial for this sort of thing? There are a few books on the suvbject but I can't thik of any titles off the top of my head. And mostly they are written for C++ rather than Python. fraction of a second. However, I need to wait for as long as the human ta