Cpsc 440 Problem Set 3 Question 1

Cpsc 440 Problem Set 3 Question 1 - hw3p1.h #ifndef HW3P1_H...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
hw3p1.h 4/2/2008 # ifndef HW3P1_H # define HW3P1_H typedef struct trig_polynomial * trig_polynomial ; typedef struct sample_set * sample_set ; typedef struct data_set * data_set ; typedef double ( * fptr )( double ) ; trig_polynomial newTrigPolynomial ( int degree , fptr f , char * title ) ; void freeTrigPolynomial ( trig_polynomial tp ) ; double evaluateTrigPolynomial ( trig_polynomial tp , double x ) ; void printTrigPolynomial ( trig_polynomial tp , FILE * output ) ; sample_set newSampleSet ( double min , double max , int n , fptr f ) ; void freeSampleSet ( sample_set ss ) ; void printSampleSet ( sample_set ss ) ; data_set newDataSet ( double min , double max , int n , trig_polynomial tp ) ; void freeDataSet ( data_set ds ) ; void createSimpleCSV ( data_set ds , FILE * output ) ; void createComparisonCSV ( data_set ds , fptr f , FILE * output ) ; double f ( double x ) ; # endif 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
hw3p1.c 4/7/2008 # include < math . h > # include < stdio . h > # include < stdlib . h > # include "hw3p1.h" # define PI 3.141592653589793 # define MAX_DEGREE 10 struct trig_polynomial { int degree ; fptr f ; char * title ; double * a_values ; double * b_values ; } ; struct sample_set { double a ; double b ; int n ; double * x_values ; double * y_values ; double h ; } ; struct data_set { double a ; double b ; int n ; double * x_values ; double * y_values ; double h ; } ; trig_polynomial newTrigPolynomial ( int degree , fptr f , char * title ) { trig_polynomial tp = malloc ( sizeof ( struct trig_polynomial ) ) ; tp - > degree = degree ; tp - > f = f ; 1
Background image of page 2
hw3p1.c 4/7/2008 tp - > title = title
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 7

Cpsc 440 Problem Set 3 Question 1 - hw3p1.h #ifndef HW3P1_H...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online