[Tutor] Gaussian function

bob gailer bgailer at gmail.com
Sun Aug 17 23:26:46 CEST 2008


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?



More information about the Tutor mailing list