Cpsc 440 Problem Set 3 Question 1

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

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

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

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

View Full Document
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
hw3p1.c 4/7/2008 tp - > title = title

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 07/19/2008 for the course CPSC 440 taught by Professor Vladimirrokhlin during the Spring '08 term at Yale.

### Page1 / 7

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

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

View Full Document
Ask a homework question - tutors are online