calculate curve