Skip to content

A simple cpp program that parses a polynomial and calculates its roots using Newton's method. (uni, April 2015)

Notifications You must be signed in to change notification settings

agajnw/polynomials

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

A simple cpp program that parses a polynomial and calculates its root using Newton's method. (April 2015)

How to run the program:

arguments: -r fileName - name of the file from which to get the polynomial -s fileName - name of the file to which the polynomial should be saved -p startPoint - start point of Newton's method -t - launch tests

If read file name is not specified, the program will read the polynomial from standard input. The program accepts polynomials of the following format: a1x^n+a2x^n-1+....+bx+c Terms' coefficients need to be defined even if equal to 0; they can be negative.

Tests have been divided into 3 groups: 1)testFileManager: reading/writing polynomial to file

    1. wrong file name (file doesn't exist)
    1. read empty file
    1. write to existing file
    1. read polynomial of power=0, check value and write it to different file
    1. read polynomial of power=1, check value and write it to different file
    1. read polynomial of power=2, check value and write it to different file
    1. read polynomial of power=3, check value and write it to different file
    1. read polynomial of power=10, check value and write it to different file
  1. testHelper: test Term and Root classes
    1. create Term obj and check values returned by class's getters
    1. create Term of power=1 and check derivative;
    1. create Term of power=10 and check derivative;
    1. create Root obj and check values returned by class's getters
  1. testPolynomial: test Polynomial class: proper execution of Newton's method
  • and quality of results
    1. test polynomial with negative values
    1. test polynomial of power=1
    1. test polynomial of power=2
    1. test polynomial of power=3
    1. test polynomial of power=10

About

A simple cpp program that parses a polynomial and calculates its roots using Newton's method. (uni, April 2015)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages