# All Questions

2k views

### Fixed color scale in multiple density plots

I think there should be a simple solution for my current problem, but neither StackOverflow (or the help of Mathematica) or Google have it. I have to plot multiple density plots with a color ...
219 views

### 2D grid as a 2D polygonal or smooth domain

I have a series of points, as a list of pairs of real numbers, each multiple of a base value. So they represent a subset of a grid. Given that this list, when represented with ...
287 views

### Page breaks appearing as thick line on actual print-out

I'm using Insert->Page Break to do just that, but thick black lines are appearing on the actual printed copy wherever I indicated a break. Can this be turned off?
428 views

### (Efficiently) Generating graphs with vertex degree 3 for all vertices

I'm working on a graph theory problem, and given $n$ vertices, I would like to be able to generate all non-isomorphic connected graphs (not necessarily simple) with $n$ vertices, each having degree 3. ...
2k views

### Calculate mean and standard deviation from ImageHistogram

I am doing my PhD in Clinical Neuropsychology; I had someone helping me analyse images (.jpg pictures) in Mathematica, but it turns out this person made some really bad decisions, and well, now I have ...
1k views

### How to generate random directed connected graph?

How to generate random directed connected graph? I need to create graph which will pass: ConnectedGraphQ[^]
306 views

### Notebook formatting - easier descriptions for equations and results?

When I do computations in mathematica, I generally try to make it readable for myself-in-the-future. This can be a cumbersome task in mathematica, where it often requires me to switch betwee a text ...
257 views

### Cluster a signal into areas of equal intensity

Introduction I have a greyscale photograph that I want to partition into areas of equal intensity. This means, that the integral over each partition should be (roughly) equal. There is no unique ...
816 views

### How often does Mathematica contact its license server?

I know that Mathematica checks the validity of its license every time the program is launched. Say, however, that I have a valid license (which I do) and that I am running some code which takes a ...
279 views

### How to build a grid of integrand points and numerically integrate?

If I have some function I know numerically only, say f(x) and each point $x$ takes significant time to compute so I have them all stored in some file as f(1)=0.232423, f(1.1)=0.3243432,....Then is it ...
1k views

### Stategies to avoid NIntegrate::slwcon error

I am trying to numerically evaluate an integral whose integrand depends on two parameters, say $(a,b)$ and when $b\gg 1$ I suspect (although it's not guaranteed) that the integrand is very small. Thus ...
269 views

### Integrating over data points from an external source (wolfram|alpha and weather)

I moved to another city and the weather sucks. Sometimes I feel like getting sad and so I go to wolfram|alpha and check for example ${}$ ...
508 views

### 'not a valid variable' error when trying to solve 13 equations with 13 variables

I want to solve 13 variables by 13 equations. And here is my program: ...
1k views

### How can I save and recall my own function?

In MATLAB, I can save and recall my own function using an M-File(function or script) How can I do something similar in Mathematica? I already searched and know how to define functions and modules ...
83 views

### Editing preset schemes [duplicate]

Mathematica has many preset schemes, for example "DarkRainbow" and "FadingRectangle": ...
160 views

### Adjust spacing between a section title and the first contained cell

In my day-to-day work with Mathematica I use a stylesheet I have derived from Mathematica's default stylesheet. One modification I would like to make to my stylesheet is to reduce the spacing between ...
1k views

### Randomly packing spheres of fixed radius within a cube

How can I have Mathematica randomly place spheres in a cube so they won't overlap? The cube is $20 \times 20 \times 20$, and the spheres have a radius of $0.7$.
901 views

### Vectors with a certain magnitude in Mathematica

For a user specified magnitude, is there a way to have Mathematica produce any 3D vector that fits that magnitude?
173 views

### Differentiate the product of some terms

How can I compute the following derivative, $$\frac{\partial}{\partial \lambda_j} \prod_{i=1}^k (1+\lambda_i)e^{\lambda_i} \quad \text{for }\; 1\le j \le k$$ for some positive integer $k$ which is ...
291 views

### How to sum up large number of elements in a table quickly?

I have been using Mathematica for some time now but I have a feeling that I am not using it as efficiently as it could be. I have the following problem which I am unable to figure out and it would be ...
2k views

### NDSolve with Euler method

I want to solve this equation with NDSolve[] using the Euler method: x'[t] == 0.5*x[t]-0.04*(x[t])^2 with initial condition ...
126 views

### How to make certain mathematical characters be written as bold by default

In a notebook, when writing \[RightVector] over a variable I always end up bolding it to make it more visible. But it'd be easier if it could be set up to bold that ...
184 views

### Fighting Less::nord at the root: Any unintended consequences?

After being plagued too much by Less::nord and companions, I've decided to try to fight it at the root: The comparison operators. I noticed that typically, the bad ...
78 views

I am working on some code, and have found it easier to use a Mathematica package because it is easier to run via command-line (lightweight) it allows for easier source versioning (Git), and it ...
892 views

### How to add more levels to Outline notebooks

The Outline stylesheet only seems to cover 6 levels of depth. Is there any way to increase that? Here's an example. Hitting tab on the last level just indents its content, but doesn't add another ...
77 views

### Sometimes notation gets auto-converted from traditional to raw input and won't convert back

For example, I'm typing this: When upon hitting the last character it gets converted to: And trying to Convert To TraditionalForm has no effect. This glitch has happened a few times and on ...
216 views

### Change associativity of the @ operator

The @ operator in Mathematica is right-associative by default, i.e. f@g@h evaluates as f@(g@h) Is it possible to make the ...
320 views

### Find all permutations with reversals / cyclic permutations removed

I have a list of all non-cyclic permutations of n labels. How can I get rid of all elements which are redundant in the sense that they are the inverse of another one. For instance if n=4, the ...
2k views

### How to calculate the mode of a probability distribution

I was wondering if there is any command to get the mode of the probability distributions. Calculating manually, the mode is (alpha-1)/(alpha+beta-2) While the mean, median or variance of the beta ...
131 views

### Substituting confidential tagged cells by a “content removed” cell

When producing a notebook with both code and text, I often end up with pieces of code, or even entire chapters, that I don't want to be shown on the final output. I generally hide or close them by ...
145 views

### Is the System Information that Mathematica displays not completely correct?

Or maybe I did not understand the meaning of Resolution. This is the code I used - SystemInformation["Devices", "ScreenInformation"] I get 120 as my system ...
277 views

### Colours in BarChart[]

This question is a follow up from this one. I want to be able to specify a list of colours for my bars in BarChart. In responses to the question I linked to, ...
97 views

### “automated” image embedding app

Based on the following image attach procedure, can a Dynamic app be developed that: at start, only shows a small import button once clicked, opens a choose image ...
461 views

### Attaching a file to a notebook

Is there a way to attach a file into a notebook and open it later with, for instance, a double click (or another action button)? In Mathematica windows version, the insert menu has the "object..." ...
112 views

### PowersRepresentations Algorithm

I'm trying to understand the mathematics behind counting the number of representations of a positive integer by $n$ distinct $k$th powers, i.e. I would really like to know how to do the Mathematica ...
204 views

### The same range on each plot in a grid

Suppose I have a bunch of graphics that I want to display in a grid: ...
183 views

### Function to select a row whose kth element is closest to a given number

I'm trying to write a function that picks out the row of a Matrix whose kth element is closest to some given number that will be given to me. So for example, ...
2k views

### Animating mathematica.se logo

As we all know our site's logo was completely generated by Mathematica. I suppose it is quite natural to make the next step -- to generate the animated version of this logo. There's a lot of space for ...
276 views

### Interactive Graph Editing with Animation

I want to make a simple interactive user interface like this: Such that when the user clicks on the "Add Edge" button, the edge specified by from and to fiels is added to the graph. The new graph ...
245 views

### Printing Block Matrices

I have a 2D matrix, such as: d=2; M=Array[a, {d^2,d^2}]; and I would like to print it in a way which emphasizes its dxd block matrix structure. If ...
5k views

### Why I get the “Set::write: ”Tag Times in is Protected." error?

Why I get the error below with this code: ...
369 views

### Communication between parallel kernels

Greetings. This is my first post here, also, I am not a seasoned programmer, so any advice pertaining to coding that is not directly related to the problem (stated below) is welcome. I am having ...
867 views

### How can I make a heatmap of a days in year?

I know Mathematica has a ListPlot for time series but does it have a function for visualizing a list of dates as a heat map like this: This idea is from D3, check it out here.
308 views

### Probability: proportion of 1000 random lists for x that contain the same nrs

Give a function which calculates for each x a random list of birthdays (which can be x=1 to x=365) birthdays[x_] := RandomInteger[{1, 365}, x] is my answer. ...
340 views

### Solving trig identities in specific terms

How would you solve a problem like "write csc(x) in terms of sec(x)" in Mathematica? The best I can get is "True." http://math.stackexchange.com/questions/167935/write-cscx-in-terms-of-secx I'm ...
196 views

### How to find the variance under the assumption that x follows some probability distribution

I am aware that we can find the expectation under the assumption that x follows some probability distribution, something like this: ...
595 views

### Creating a weighted, directed graph from ordered triples

I have a relatively large set of data that I am trying to turn into a weighted, directed graph. The data concerns the inflow of migrants based on country of origin. I currently have three columns of ...
336 views

### Multi-column table layout the right way

How do I create book-like multi-column table formatting for a long, narrow tables in a preferably elegant way? Should I be thinking of stylesheets, instead of formatting? I guess this is a solved ...