Not Yet Answered # Polynomial functions stores

Gribouillis 1,313 Schol-R-LEA 1,003 OK, so HostGator for some reason no longer allows gcc/g++ access unless you have a Designated Server account, which is a lot of money to spend just to compile my "Hello World" program. Thus I figured I'd compile at home, then upload. Program is your regular old bare-bones Hello World ...

0

It looks like homework. Did you try to add the polynomials in a python console ?

0

As Gribouilis said, there is only so much we can suggest without doing the work for you. As for data structures, there are three options I can recommend, in order from least preferred to most:

- Use a list consisting of lists of exponent:coefficient pairs (you want the exponent first because the exponents are unique, while the coefficients can be repeated). This is simple and easy to define, but not very structured. Also, if the polynomial is in more than one variable, you would need multiple lists representing each variable.
- Use a dictionary of dictionaries with the exponent as the key and the coefficient as the value for the inner dictionaries, and the variable as the key for the outer dictionary. This is a bit better structured, and makes it somewhat easier to handle reduction when performing arithmetic, but it would still be a rather problematic.
- Define a class, to represent each exponent:coefficient pair, and a dictionary of with the variables as the keys and a list of the objects as the value. This is the most structured approach, but also the most complex.

I would probably choose version two, as it probably would be the easiest for handling the arithmetic. I would wrap that representation in a `Polynomial`

class to make the arithmetic operations part of the whole structure.

This article has been dead for over six months. Start a new discussion instead.

Recommended Articles

Hi. I have a form with list box : lst_product, datagridview : grd_order and button: btn_addline. lst_product has a list of product ids selected from database (MS Acess 2013) , grd_order is by default empty except for 2 headers and btn_addline adds rows to grd_order.

btn_addline :

`Private Sub btn_addline_Click(ByVal ...`

I don’t want at this stage work on a big separate project as I've already got plenty ...