Subversion Repositories programming

Rev

Rev 155 | Rev 157 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 155 Rev 156
Line 131... Line 131...
131
 * @param y[] the array that will hold the y[i] values
131
 * @param y[] the array that will hold the y[i] values
132
 */
132
 */
133
void GenEvenPts (int num_pts, double(*func)(double), double x[], double y[])
133
void GenEvenPts (int num_pts, double(*func)(double), double x[], double y[])
134
{
134
{
135
    int i;
135
    int i;
136
    double h = 10.0 / (double)num_pts;
136
    double h = 10.0 / (double)(num_pts-1);
137
    double xtemp = -5.0;
137
    double xtemp = -5.0;
138
 
138
 
139
    for (i=0; i<num_pts; i++)
139
    for (i=0; i<num_pts; i++)
140
    {
140
    {
141
        x[i] = xtemp;
141
        x[i] = xtemp;
Line 157... Line 157...
157
{
157
{
158
    int i;
158
    int i;
159
 
159
 
160
    for (i=0; i<num_pts; i++)
160
    for (i=0; i<num_pts; i++)
161
    {
161
    {
162
        x[i] = -5.0 * cos((float)i * M_PI / (float)num_pts);
162
        x[i] = -5.0 * cos((float)i * M_PI / (float)(num_pts-1));
163
        y[i] = func(x[i]);
163
        y[i] = func(x[i]);
164
    }
164
    }
165
}
165
}
166
 
166
 
167
int main (void)
167
int main (void)