WOLFRAM

Mathematica Q&A

Products

Mathematica Q&A: Four Ways to Sum Integer Digit Blocks

Got questions about Mathematica? The Wolfram Blog has answers! We'll regularly answer selected questions from users around the web. You can submit your question directly to the Q&A Team using this form. This week's question comes from Craig, a hobbyist: For each six-digit number in a list, how can I check whether the sums of the first and last three digits are equal? For example, the sums of the first and last three digits of the number 123,222 are equal because 1 + 2 + 3 == 2 + 2 + 2. There are several different ways of solving this straightforward programming problem in Mathematica, and it's instructive to compare them. In this post you'll see four methods demonstrating various combinations of built-in Mathematica functions for working with lists and digits of integers.
Products

Mathematica Q&A: Sow, Reap, and Parallel Programming

Got questions about Mathematica? The Wolfram Blog has answers! We'll regularly answer selected questions from users around the web. You can submit your question directly to the Q&A Team using this form. This week's question comes from Patrick, a student: How can I use Sow & Reap across parallel kernels? Before we answer this question, a review of the useful functions Sow and Reap is in order. Sow and Reap are used together to build up a list of results during a computation. Sow[expr] puts expr aside to be collected later. Reap collects these and returns a list: The first part of the list is the regular result of the computation. The second part is everything that was “sown”. Sow and Reap are ideally suited to situations in which you don't know in advance how many results you will get. For example, suppose that you want to find simple initial conditions that lead to "interesting" results in Conway's game of life, the famous two-dimensional cellular automaton:
Best of Blog

Mathematica Q&A: Plotting Trig Functions in Degrees

Got a question about Mathematica? The Wolfram Blog has answers! We'll regularly answer selected questions from users around the web. You can submit your question directly to the Q&A Team using this form. This week's question comes from Brian, who is a part-time math teacher: How do you plot trigonometric functions in degrees instead of radians? Trigonometric functions in Mathematica such as Sin[x] and Cos[x] take x to be given in radians:
Products

Mathematica Q&A: Excluding Points from Plots

Got questions about Mathematica? The Wolfram Blog has answers! Each week, we'll answer a selected question from users around the web. You can submit your question directly to the Q&A Team. For our first post in this new series of Mathematica Q&A articles, we're going to address a very frequently asked question about plotting in Mathematica. How can I control the appearance of discontinuities in a plot? The short answer is, use the options Exclusions and ExclusionsStyle! Let's see how they work. By default, Plot shows the function 1 ⁄ sin(x) with lines joining its discontinuities: