## Top new questions this week:

### How can I evaluate untrusted Mathematica code in a sandbox?

Is there any way to build a sandbox to evaluate untrusted Mathematica expressions in order to prevent them from having (malicious or accidental) harmful side effects? Context: I'm developing a system ...

kernel contexts security

### How to detect loops in a vector field?

Given a vector field and I'd like to detect if there are streamlines in closed patterns. For example, if the input is a vector field like this: image = ColorConvert[Rasterize[\[Infinity], ImageSize ...

image-processing pattern-matching vector machine-learning peak-detection

### Distributing function arguments with function compositions. How to compute $(f + g^2)(x) = f(x) + g(x)^2$?

Suppose I have two functions f and g. To compute $f + g$ evaluated at a point $x$, I know that one can use Through to compute, Through[(f+g)[x]] to get f[x] + g[x]. Question: Suppose I want to ...

functions function-construction

### Partition a list into sublists of different lengths

I have the list {a, b, c, d, e, f, g, h, i} and I want to make a sub-list of the form {{{a, b}, c}, {{d, e}, f}, {{g, h}, i}} I've tried using Partition, but I can't see how to use it here.

list-manipulation

### Form of citation for data via Wolfram Mathematica

What citation or reference should I adhere to if I'm using curated data obtained via Mathematica? I'm talking about data, or eg. plots thereof, obtained using functions such as SatelliteData, ...

curated-data

### Which symbol gets DownValues or OwnValues when using SetDelayed?

I have been looking at various usages of Pattern objects. Here's a number of ways to define the same thing: mod[x_] := {x} which gives mod DownValues. Nothing unexpected. e : mod[_] := ReleaseHold ...

reference-request downvalues

### How to speed up the evaluation of a function with a large LeafCount but many repeated sub-functions for use in NIntegrate

General Context Apparently, the memory leak in NIntegrate is unavoidable pre-MMA-10.2. I have some (two-dimensional) numerical integration to do on a complicated function (LeafCount[g] is ...

performance-tuning numerical-integration memory memoization

## Greatest hits from previous weeks:

### How to calculate contour integrals with Mathematica?

How to calculate the integral of $\frac{1}{\sqrt{4 z^2 + 4 z + 3}}$ over the unit circle counterclockwise for each branch of the integrand?

calculus-and-analysis complex

### How to create word clouds?

Word clouds are rather useless fancy and visually appealing plots, where words are plotted with different sizes according to their frequency in a corpus. Many applications exist out there (Wordle, ...

graphics computational-geometry generative-art packing word-cloud

### Memory usage of compiled function: C vs WVM

Why does generating an array in "C"-compiled function uses 50% more memory than doing same thing in "WVM"-compiled function? Does this depend on OS or used C compiler? Simple example: ...

compile memory

### How to export to NetCDF format

Consider I have a scalar field on a grid f(x,y), where x and y can take values x={1,2} y={1,2,3} so the grid points are {{1,1},{1,2},{1,3},{2,1},{2,2},{2,3}} and the value of f on these grid ...

export data
My integral has the following form: $$\int \sin(\theta) d\theta d\phi\left| \int d^3p_1 d^3p_2d^3p_3 \frac{f(p,\theta,\phi)}{g(p,\theta,\phi)}e^{-\frac{1}{2}(p^\mathrm{T} .A.p)}\right |^2,$$ where ...