Hot answers tagged

5

You may be going to too much trouble here. Consider that Position works on a matrix just as well as a vector. You did not include values for your parameters, so I can't use your code, but take a look at the following example. I have a matrix selector that contains $0$ or $1$ entries, and I want to grab the elements of another matrix target that correspond ...


4

If you have access to the graphical interface, try looking up the help page for CompilationTarget and open "Neat Examples". Run the commands there and you'll get a nice interactive Mandelbrot set explorer in which you can zoom using a slider and move using mouse drag. You can make this arbitrarily hard by changing the constant 99 to, say, 5000 in the first ...


3

What you are seeing can be traced back to the behavior of DistributeDefinitions which is used internally by ParallelTable. DistributeDefinitions seems to have some way to determine which of its argument should in fact be distributed [1]. If the value of a variable is unchanged, it will do nothing. Consider the following snippet, for example: a1 = ...


2

The simplest and cleanest solution is to use a printing function which evaluates on the main kernel. SetSharedFunction causes a function to always evaluate on the main kernel (despite the somewhat confusing documentation). Example (run in a terminal): Mathematica 10.4.1 for Mac OS X x86 (64-bit) Copyright 1988-2016 Wolfram Research, Inc. In[1]:= print[...


2

The reason for this behaviour is that Table and ParallelTable generate the range from 1 to 10 by steps of 0.3 in slightly different ways. You are working with inexact (floating point) numbers. This means that even the slightest change in the order of arithmetic operations may change the result. (a+b) + c may give a different result from a + (b+c). ...


1

Try using htop in the terminal to confirm that given Mathematica task is using multiple cores. I use htop all the time to monitor CPU and memory usage.


1

From the link in the comment above I have devised a solution included here for ParallelSubmit specific searches. Monitor can not be used so I make a progress function that will assist with the visual status update. progress[current_, total_] := Column[{StringRiffle[ToString /@ {current, total}, " of "], ProgressIndicator[current, {0, total}]}, ...



Only top voted, non community-wiki answers of a minimum length are eligible