Hi, I have written some code which solve's the 2d wave equation (code is
below). It seems to work, however when the wave reaches the boundaries it
reflects off them and I would like to remove this effect. Does anyone know
of a method to do this?
Also, I would like to run it over a large area, but w
Hi again, sorry if that wasnt clear. I am using the ipython interpreter
to debug scripts. I have a function:-) saved as part of a module called
daves_modules.py.
import numpy as np
def find_nearest(array,value):
idx=(np.abs(array-value)).argmin()
return array[idx], idx
Hi,
I am new to python and have made a couple of definitions. I imported
them and they worked ok except for one which gave me the error
"NameError: global name 'np' is not defined". I then edited my script
for the def to include "import numpy as np" saved it and imported the
def again. However
Hi,
I am new to python and have made a couple of definitions. I imported
them and they worked ok. I they worked except for one which gave me the
error "NameError: global name 'np' is not defined". I then edited my
script for the def to include "import numpy as np" saved it and imported
the def
. Anyone know the best way to go about this?
thanks,
D
Original Message
Subject:Re: [Tutor] Solve wave equation
Date: Thu, 23 Feb 2012 15:24:45 +
From: David Craig
To: tutor@python.org
Hooray it works,
thanks
On 02/23/2012 01:39 PM, Ken Oliver wrote:
Do you
Hooray it works,
thanks
On 02/23/2012 01:39 PM, Ken Oliver wrote:
Do you really want dt = 1**-4 or would 10**-4 be better
-Original Message-
From: David Craig
Sent: Feb 23, 2012 7:57 AM
To: tutor@python.org
Subject: [Tutor] Solve wave equation
Hi,
I am trying to write some code that
Hi,
I am trying to write some code that will solve the 2D wave equation by
the finite difference method, but it just returns an array full of zeros
and NaN's. Not sure where I am going wrong, the code is attached so if
could someone point me in the right direction I'd appreciate this.
Thanks
D
Thanks everyone, was able to get what I wanted from '/t' but I'm sure
the other formatting options will be useful in future.
@Peter
a = [[]] * 3
>>> a
[[], [], []]
>>> a[0].append(42)
>>> a
[[42], [42], [42]]
you had me worried for a minute, but
a = [[]] * 3
a[0]=[1,2,3]
a
[[1, 2, 3], [
Hi,
I have created a list of containing strings that represent distances
between many different points and would like to display the results in a
table.
I have been trying to write them to a text file but it is difficult to
organise them into rows and columns with appropriate spacing to make it
Hi,
I have a function that calculates the distance between two points on a
sphere. It works but I cant get it to return a float for use in another
script. Anyone know how I do that??
The function is below,
Thanks,
D
import math
def distance_on_unit_sphere(lat1, long1, lat2, long2):
# Con
Hi,
I use emacs with ipython (or I would like to) on a GNU/linux machine. To
be able to use it from the ipython shell through %ed I added the
following lines to my .bashrc file,
export LESS="-R"
export EDITOR=emacs
this seemed to work as when I try %ed filename it opens and is editable
in th
Hi,
I'm trying to write a function that will either take arguments when the
function is called, such as myFunc(x,y,z) or if the user does not enter
any arguments, myFunc() the raw_input function will ask for them. But I
dont know how to check how many arguments have been entered. My code is
be
12 matches
Mail list logo