program with arrays: y=ln(x)
Posted on 2006-04-24
Wondered if anyone might have any idea how to do this program, been giving me a bit of hassle. Thanks a million!
y=loge(x), i need to write a program which will display a table of logs for varying values of x. Theuser should be instructed to enter the minimum value of x, the maximum value and the size of increment between these values. The program should then use one procedure to calculate thevalues of x and store them in an array and another procedure to calculate the corresponding values of y (also in an array).
e.g.. the user has entered xmin = 0.1, xmax = 1.0, xincrement = 0.05
The x array will therefore have the values :
0.10, 0.15, 0.20, …. Which will fill the x array.
And the y array will therefore have the values :
-2,30, -1.89, -1.61, …. Which will fill the y array.
You will have to make sure the user can't ask for more points than are contained in the array.
For example, if you define your arrays to have 50 elements and the user needs 100 points
between xmin and xmax then you must stop and warn the user that they have asked for too many
points and ask them to try again..