[Tutor] Gaussian function
optimum
jozzy_a at hotmail.com
Sun Aug 17 22:08:37 CEST 2008
Hey. Is there anyone who can give me some help?
I am having trouble with the gaussian function and don't really know where
to start.
Below is the question I was set.
"Write a program which asks the user for values
of xmin, dx and nx. The program should then
output a plot of the gaussian function
at the following series of values of x:
xmin, xmin+dx, xmin+2*dx, xmin+3*dx, : : :,
xmin+(nx-1)*dx. e.g. the following output
should result if xmin = 2:5, dx = 0:5 and
nx = 11.
-2.50 *
-2.00 ***
-1.50 ******
-1.00 ************
-0.50 ******************
0.00 ********************
0.50 ******************
1.00 ************
1.50 ******
2.00 ***
2.50 *
The program should contain and make full use
of the following functions:
gauss(x) - Returns the value of the Gaussian
function
line(n) - Prints a line of n asterisks followed
by a newline character.
You will need to choose a scale for your plot;
in the example shown the number of asterisks
is 50 * gauss(x).
Should I start with a program like this?
s=''
for n in range (0,100):
s=s+ '*'
print s
Thanks for any help received. :confused:
--
View this message in context: http://www.nabble.com/Gaussian-function-tp19022946p19022946.html
Sent from the Python - tutor mailing list archive at Nabble.com.
More information about the Tutor
mailing list