intermediate steps of a Mathematica operation

1

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

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

enter image description here

wally

Posted 2015-08-02T02:55:32.237

Reputation: 395

1@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 – 2015-08-02T03:21:30.673

2"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 – 2015-08-02T03:48:27.760

2@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 – 2015-08-02T03:52:34.450

2

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 – 2015-08-02T03:56:20.727

Mathematica doesn't have this built in. You would have to program it from scratch. – Szabolcs – 2015-08-02T07:14:01.070

Answers

6

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}}]]

how I NEVER did multiplication

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

J. M.'s ennui

Posted 2015-08-02T02:55:32.237

Reputation: 115 520

From scratch ... +1 – None – 2015-08-02T15:58:44.543

just what I wanted, the case fails, the result runs right kidTimes[12345, 8945697]

You can change the algorithm for division ":" – wally – 2015-08-02T23:29:02.380

I don't quite understand; are you saying kidTimes[12345, 8945697] does not give correct output? – J. M.'s ennui – 2015-08-03T00:27:56.470

yes, not out aligned, look edition – wally – 2015-08-03T01:17:57.140

I won't be able to add in a fix for now, sorry. If you don't mind waiting… – J. M.'s ennui – 2015-08-03T03:28:08.150

I can wait,no problem – wally – 2015-08-03T22:00:28.593

@wally, hopefully it should now give the correct alignment. – J. M.'s ennui – 2015-08-16T22:12:07.083

0

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!

user9660

Posted 2015-08-02T02:55:32.237

Reputation: