Forwarding to the list. Please always reply to the list.
It seems like you need a course on the fundamentals of programming!
What output did you get?
How does it differ from what you want?
You define 2 functions but never call them. So they will never run.
Do you know the difference?
I will not write a program for you, but will, as offered, help.
For starters what do the colons in the input mean? Are they decimal
points? When I apply the input xmin = 2:5, dx = 0:5 and nx = 11 to the
series definition xmin, xmin+dx I get 2.5 3.0 3.5 etc to infinity. Where
did the -2.5 in the output come from?
If you assume xmin = -2.5 then it will work.
How in Python can you express this series (for loop?)
What class is this question from? Have you met the prerequisites for the
class? If so why is the instructor expecting you to do something he has
not prepared you for?
--
Bob Gailer
Chapel Hill NC
919-636-4239
When we take the time to be aware of our feelings and
needs we have more satisfying interatctions with others.
Nonviolent Communication provides tools for this awareness.
As a coach and trainer I can assist you in learning this process.
What is YOUR biggest relationship challenge?
--- Begin Message ---
I have tried to do the program. But I still cant get the output desired. Could
you please give me a hint if I am close to whats required?
Thank you for your time once again. I am sure you have more complex programs to
deal to.
from __future__ import divisionimport math
a=raw_input("what is the value of xmin?")b=raw_input("what is the value of
dx?")c=raw_input("what is the value of nx?")
xmin=float(a)dx=float(b)nx=int(c)n=int(c)l=[]
for x in range(0.0,n): print xmin+x*dxdef line(n): s=''
i=raw_input("Please choose a scale for your plot") n=int(i) for j in
range(0.0,n): s= s+ "*" + "\n" print s def gauss(x):
g1=math.pi(2) g2=math.sqrt(g1) g3=1/g2 g4=math.exp(-0.5*-2.00**2)
print g4> Date: Sun, 17 Aug 2008 17:26:46 -0400> From: [EMAIL PROTECTED]> To:
[EMAIL PROTECTED]> CC: tutor@python.org> Subject: Re: [Tutor] Gaussian
function> > optimum wrote:> > Hey. Is there anyone who can give me some help? >
> Below is the question I was set.> > > This sounds like a homework assignment.
We don't write programs for > assignments. We offer help after you give it your
best effort.> > I am having trouble with the gaussian function and don't really
know where> > to start.> > > > It sounds like you are having trouble with
programming, not with the > gaussian function. Did you run the following code?
Did it give you any > useful results? (I expect it to raise an exception.) At
least run it and > see what happens. How does it contribute to the overall
result?> > s=''> for n in range (0,100):> s=s+ '*'> print s> > > Can you at
least outline the program or algorithm as a starting place.> > "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:> > > > > -- > Bob Gailer> Chapel Hill NC > 919-636-4239> > When we
take the time to be aware of our feelings and > needs we have more satisfying
interatctions with others.> > Nonviolent Communication provides tools for this
awareness.> > As a coach and trainer I can assist you in learning this
process.> > What is YOUR biggest relationship challenge?>
--- End Message ---
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor