Message Boards Message Boards

0
|
5989 Views
|
3 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Polynomial Division in a traditional form

Posted 11 years ago
Is there any way to display polynomial division modulo n in traditional long form?


Thanks,

Dean Sparrow
Attachments:
POSTED BY: Dean Sparrow
3 Replies
You might have a look at code available from Demonstrations.

http://demonstrations.wolfram.com/PolynomialLongDivision/

http://demonstrations.wolfram.com/PolynomialLongDivision/
POSTED BY: Daniel Lichtblau
Thanks, will do.
POSTED BY: Dean Sparrow

Not there yet, but I can see patterns emerging which I'm hoping would allow me to make this to work without having to change the code.

Maybe using NestList?

Although it looks simpler to use the Mathematica PolynomialQuotient and PolynomialRemainder functions, for the sake of better understanding, I'd also like to calculate them myself. But I think I need some temporary variables in that case and I'm not sure where the best place to declare them would be.

I wish there were a simpler way to do this, with having to Pad the polynomials out with zeroes so they're the same length. Maybe converting them to strings. But then there's a tradeoff with the code becoming less intuitive.

A screenshot of the table for polynomial long division. Polynomials are entered as globals at the top of the notebook file.

Row[{
  Grid[
   {{}, D}~Join~Table[{}, {i, 3, nCols}],
   Dividers -> {
     Table[i -> RGBColor[0.67, 0.8, 1.], {i, 1, d}],
     {2 -> RGBColor[0.67, 0.8, 1.], 3 -> RGBColor[0.67, 0.8, 1.]}
     },
   Spacings -> {1, 1}
   ],
  Grid[{
    Q,

    A,
    pl[A[[1]]/D[[1]] D, a, 0, 2],

    A - pl[A[[1]]/D[[1]] D, a, 0, 2],
    pl[(A - pl[A[[1]]/D[[1]] D, a, 0, 2])[[2]]/D[[1]] D, a, 0, 1],

    A - pl[A[[1]]/D[[1]] D, a, 0, 2] - 
     pl[(A - pl[A[[1]]/D[[1]] D, a, 0, 2])[[2]]/D[[1]] D, a, 0, 1],
    pl[Q[[3]] D, a, 0],

    A - pl[Q[[1]] D, a, 0, 2] - pl[Q[[2]] D, a, 0, 1] - 
     pl[Q[[3]] D, a, 0]
    },
   Dividers -> {
     {1 -> RGBColor[1, 0, 0], 
      Table[i -> RGBColor[0.65, 0.62, 1.], {i, 2, a}]},
     {1 -> RGBColor[0.67, 0.8, 1.], 2 -> GrayLevel[0], 
      3 -> RGBColor[0.67, 0.8, 1.], 4 -> GrayLevel[0], 
      5 -> RGBColor[0.67, 0.8, 1.], 6 -> GrayLevel[0], 
      7 -> RGBColor[0.67, 0.8, 1.], 8 -> GrayLevel[0]}
     }
   ]},
 Frame -> True]

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract