# Formatting results of a polynomial long division

I am teaching polynomial long division to my high school students. Not a pleasant topic to have to cover. I went to use Wolfram|Alpha and obviously, internally, they have a really elegant way to express the results of long divisions.

I don't suspect there is any easy way to directly ask Alpha (from Mathematica) to do that division for me? Has anyone implemented anything like this? Would it involve using a table or matrix? Everything is nicely lined up and typeset; it would be helpful to see how such a structure was created.

Tom

• there is a demo demonstrations.wolfram.com/PolynomialLongDivision Commented Nov 6, 2013 at 6:12
• thanks, yes, I had seen that. The math is great but the formatting is nothing like what we use at the high school level. The Alpha output is very elegant... just like they would see in their textbooks... Commented Nov 6, 2013 at 6:33

You could perhaps try to use the WolframAlpha function with the pods?

Column@{WolframAlpha[
"polynomial long division (y^3-6y+20)/(y-3)", \
{{"QuotientAndRemainder", 1}, "Content"},
PodStates -> {"QuotientAndRemainder__Step-by-step solution"}],
WolframAlpha[
"polynomial long division (y^3-6y+20)/(y-3)", \
{{"QuotientAndRemainder", 2}, "Content"},
PodStates -> {"QuotientAndRemainder__Step-by-step solution"}]}


Use == to start a session with Wolfram Alpha and then type your equation

Then choose the show steps in the equation solved windows

Now select the plus button to the right and select Formatted pod or Subpod (I chose now formatted which even looks better. This will generate the 'complex' expression and start a Wolfram session to only show this part of the content.

And here is the formatted Pod output

WolframAlpha["polynomial long division (y^3-6y+20)/(y-3)",
IncludePods -> "QuotientAndRemainder",
AppearanceElements -> {"Pods"},
TimeConstraint -> {30, Automatic, Automatic, Automatic},
PodStates -> {"QuotientAndRemainder__Step-by-step solution"}]


So with that you play around!

• Wow.... exactly what I was looking for (aside from an actual "long division function". How does a person figure out that syntax exactly? I really appreciate the answer since it does provide a pattern and hopefully I can do similar things with it. As always, the answers and support of this community are invaluable, and are extending to the work I do with my students. thank you! Commented Nov 6, 2013 at 13:36
• I hesitate to ask for more... but I know with Alpha you can specific output size, background color, things like that. If it's not a huge change, could someone add how to modify that input to do some of those sorts of things. It would help be to learn more about the connection between Mathematica and Alpha and how to use them... Commented Nov 6, 2013 at 13:50
• @TomDeVries Hi Tom, actually its very simple. I'll edit the answer to show you how.
– Lou
Commented Nov 6, 2013 at 13:53
• @TomDeVries Hi Tom, At the end the output is build with frames and boxes etc which is documented very well. If you use the output as input with //FullForm you can see how the output is constructed. Then you can also modify it but this does generate a second processing layer. I don't know the syntax to do it within the wolfram alpha command.
– Lou
Commented Nov 6, 2013 at 14:33
• Thanks again for the extra comments, that will help me to be able to explore further. Commented Nov 6, 2013 at 17:29

I have implemented polynomial long division in finite fields as a ruby-script, see Formatting results of a polynomial long division (Extension for finite fields)

It produces shell and Latex output.