# intermediate steps of a Mathematica operation

How to make a multiplication or division, the intermediate steps. The numbers can be rational - decimals?

it seems the OP merely wants Mathematica to show him how to multiply and divide the way a kid in primary school would do it. That's a whole lot of digit carrying

This is the idea, for integers and decimals.

edit

• @Oleksandr, it seems the OP merely wants Mathematica to show him how to multiply and divide the way a kid in primary school would do it. That's a whole lot of digit carrying… :o – J. M.'s ennui Aug 2 '15 at 3:21
• "it seems the OP merely wants Mathematica to show him how to multiply and divide the way a kid in primary school would do it. That's a whole lot of digit carrying" this is the idea, for integers and decimals – wally Aug 2 '15 at 3:48
• @wally. Mathematica doesn't perform any intermediate steps such as you show when it does arithmetic. It could be programed to demonstrate the steps of school arithmetic, but would not be a trivial project. You might challenge followers of this site to produce such code. However, you will have to reword your question to make it clear that's what you want. Can't say whether or not you will get any takers. – m_goldberg Aug 2 '15 at 3:52
• Related: Showing steps for TrigExpand. But I think this question is not related to an actual issue encountered while programming in Mathematica. Perhaps you should show what you've already tried. – Jens Aug 2 '15 at 3:56
• Mathematica doesn't have this built in. You would have to program it from scratch. – Szabolcs Aug 2 '15 at 7:14

## 2 Answers

I feel like I should be prefacing this answer with three confessions, considering that this is an question. First, I had a hard time with the multiplication tables until I was nine years old. Second, even after I finally got the hang of multiplication, I was never a fan of multiplying from right-to-left; I preferred going left-to-right. (Arthur Benjamin seems to approve.) Finally, I confess I actually spent five six minutes writing this:

kidTimes[p_Integer?Positive, q_Integer?Positive] := Module[{cv, d, m, n},
{m, n} = Through[{Max, Min}[{p, q}]]; d = IntegerLength[n] - 1;
cv = ListConvolve[IntegerDigits[m], IntegerDigits[n], {1, -1}, 0,
Times, Composition[Reverse, List]];
Grid[ReplacePart[PadLeft[Append[{IntegerDigits[m], IntegerDigits[n]} ~Join~
Table[ArrayPad[IntegerDigits[FromDigits[Diagonal[cv, k - d]]], {0, k}, ""],
{k, 0, d}], IntegerDigits[m n]], Automatic, ""], {2, 1} -> "×"],
Alignment -> {Right, Baseline},
Dividers -> {False, {3 -> True, -2 -> True}}]]


(Writing this answer took longer than writing the routine from scratch.)

• From scratch ... +1 – user9660 Aug 2 '15 at 15:58
• just what I wanted, the case fails, the result runs right kidTimes[12345, 8945697] You can change the algorithm for division ":" – wally Aug 2 '15 at 23:29
• I don't quite understand; are you saying kidTimes[12345, 8945697] does not give correct output? – J. M.'s ennui Aug 3 '15 at 0:27
• yes, not out aligned, look edition – wally Aug 3 '15 at 1:17
• I won't be able to add in a fix for now, sorry. If you don't mind waiting… – J. M.'s ennui Aug 3 '15 at 3:28

The following is too long for a comment and rather describes a strategy of searching for answers than giving an answer. It is certainly not a direct response to the question in favor of the question.

But it is also not a marketing response in favor of Wolfram Alpha.

Anyway, next https://mathematica.stackexchange.com/ and the Internet, I recommend the following pages for searches;

http://search.wolfram.com/ with the querry basic arithmetic,there are yet some good links, Results

http://demonstrations.wolfram.com/ with the querry multiplication,there are yet some good links, Results, in particular look at Long Multiplication

http://www.wolframalpha.com/pro/problem-generator/ from the Media:

Our online math practice problems offer hints and integrated Step-by-step solutions. Prefer pen and paper? Generate a printable worksheet for study sessions and quizzes.

And a really nice article Solving Basic Arithmetic Step by Step with Wolfram|Alpha

Have Fun!