Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- As Chibill posted we are making a polynomial multilayer.
- We are going to use a basic "algorithm", I guess you could call it.
- I mean all we are doing is multiplying by repetitively adding.
- SOME Background...
- For this examples I'm going to be using a max of x^3.
- First let look at a normal polynomial.
- A1x2+B1x+C1 and A2x2+B2x+C2
- So we multiply the second polynomial by the first .
- (A1x2)X(A2x2+B2x+c2) = A1A2x4+A1B2x3+A1C2X
- And now we repeat for the other and add them all up and we end up with
- A1A2x4+A1B2x3+A1C2x+B1A2x3+B1B2x2+B1C2x+C1A2x2+C1B2x+C1C2
- now group alike terms
- A1A2x4+(A1B2x3+B1A2x3)+(B1B2x2+C1A2x2)+(A1C2x+B1C2x+C1B2x+C1C2)
- As you can see these thing get big FAST!!!!
- Another BIG problem is that they come in many different sizes.
- like x6,x4,x8
- You may have noticed that i used ”A”,”B”,”C” in the polynomial this is standard practice.
- By taking these NUMBERS/VARIABLES and putting them into a list we can do some cool stuff.
- Lets look at a few examples of this.
- x2 + x + 6 would be [1,1,6]
- 3x2+3x + 3 would be [3,3,3]
- x6 + 4x5 +2x2 +3 would be [1,4,0,0,2,0,3] (hime check your math,chib)
- You may have noticed that I filled in some extra zeros in that list. this is because you start on the largest number exponent.and continue down to no exponent and if you hit a exponent where the coefficient is zero you put a zero.
- Now we start having fun! :) ( I,himehowareu, am a complete math and algorithm nut )
- when i was working on some math problems for a different project i was doing some polynomial multiplication and noticed a pattern. By using these lists we can use some simple addition and a “equal to” test to multiply the two polynomials.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement