# All Questions

3answers
791 views

### Collapse a section of a huge function

Is there an elegant way of hiding/collapsing/folding only a portion of a function? If functions could span multiple cells, this would have been straight-forward!
2answers
194 views

### Prevent text from wrapping in a notebook

By default in the Notebook interface the text wraps. Is it possible to prevent this wrapping?
5answers
2k views

### Styling ticks in a plot

I managed to turn the ticks inside-out but the ticks go now through the numbers. In fact I would like to have it like in the picture attached (ticks pointing outside the plot and no additional ticks ...
2answers
1k views

### Creating Lists From Loops

Consider the following: lists = Import["G:/Notebooks/Lists.csv"]; col7 = lists [[All, 7]]; For[i=0,i<101,i++,Print[Count[col7,i]]] This will get a 100 cells ...
2answers
2k views

### Plot does not plot over the specified range

Suppose I have these two sets of data: ...
5answers
216 views

### Fill out blanks with a upcoming number in a list?

I have a bunch of arrays looking like this: {"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ...
1answer
233 views

### n-fold symbolic integral in Mathematica

I am trying to compute symbolically a n-fold integral (n is a parameter of a function) over, say, the cube [0,a]^n. My code looks like this ...
1answer
290 views

### Boosting the performance of expensive NIntegrate by feeding in a cheap approximation of the integrand

I need to integrate an expensive likelihood L[x] over its n-dimensional domain. I know that L[x] is decently approximated by a ...
2answers
226 views

### Dealing with numbers too large for machine precision in Graphics

Graphics only supports machine precision numbers (i.e. number that can be converted to machine precision). Take for example ...
1answer
1k views

### Why is my plot cut off?

I am trying to use Show to combine two plots so I do the following: ...
3answers
962 views

### Sort per column

I have some data: data={{"a", 1, 1}, {"a", 1, 2}, {"a", 1, 3}, {"c", 2, 1}, {"b", 2, 2}, {"b", 2, 3}, {"c", 3, 1}, {"a", 3, 2}, {"a", 3, 3}} When I ...
4answers
4k views

### Creating a table/Matrix during a For loop

I have a For loop (with i as a counter), which calculates different values (y1, ...
2answers
828 views

### InterpolationOrder for ContourPlot

How do I acheive something like InterpolationOrder in ListContourPlot for ContourPlot? My ...
3answers
188 views

### MapThread gives different results from ToExpression when trying to assign variables from a list

I have the following data set: data = {{"Jakarta","Surabaya","Bandung"},{1,2,3}} and I'd actually like to assign the numerical values to the categorical data so ...
2answers
687 views

### plot function against composite variable

How can one plot $f(x,y)$ as a pseudo-univariate function of $x/y$ (or some other composition of these variables) over the domain $a<\frac{x}{y}<b$. ...
2answers
512 views

### simplify assuming a variable equals zero

How can one simplify an expression by assuming that one of the variables is equal to zero? For instance, while Simplify[%,a>0] gives the desired output, ...
1answer
1k views

### How to generally match, unify and merge patterns?

This question was split from this one. While that question is now about how to match two particular patterns (mostly using Verbatim or ...
2answers
653 views

### Meaning of backtick in floating-point literal

If I compute, say, 1/3//N, Mathematica displays 0.333333 as the result. When I copy that output to use elsewhere, the paste ...
3answers
979 views

### Basic questions about running Mathematica

Is there a command window and an editor in Mathematica 8 similar to those in Matlab? In Mathematica GUI mode, all I saw is write code and run it in the same notebook. In my Ubuntu terminal, I ...
2answers
204 views

### How do I speed up Plot when the independent variable is in the Numerical expression

In the following HH = H /. {μ -> 1, Δ -> .3, L -> 11, ky -> 0}; Plot[Re[Sort[Eigenvalues[HH]]], {kx, -2 π/11, 2 π/11}, PlotPoints -> 10] where ...
3answers
230 views

### Find variable name from DumpSave on a scoped variable

I saved an InterpolationFunction in a ".mx" files using DumpSave on a variable that was scoped by a ...
2answers
744 views

### How to find regions that satisfy this inequality?

I am new to Mathematica and would like to find the set $$\{ (x,y) \in \mathbb{R}^2: (3x+y\exp(xy))(x-a) + (6y + x \exp(xy))(y-b) < 0 \}$$ for some constants $a$ and $b$. How can I do ...
2answers
198 views

### Update only one element in a dynamic grid?

I've got a grid of buttons that each display an image from an array. When a button is clicked, its image changes. ...
1answer
242 views

### RandomVariate with a Discrete Distribution

Nature has provided me with a random variable $Z$ taking on the values $0, 1, 2, \ldots$, with probabilities $z_0, z_1, \cdots$. I can sample from the distribution of $Z$ reasonably efficiently (I ...
1answer
328 views

### Graph stories, 3-d volumes

I saw a lesson plan that had students filling different shaped bottles at a constant rate. The idea was to graph height vs. time to show the students how different shapes would produce different ...
1answer
601 views

### Transferring a large amount of data in parallel calculations

This question is inspired by one of @whuber's answers Consider the following code: ...
3answers
801 views

### Problem with Compile Function

I am attempting to Compile this function which is used to calculate a elastic collision in two dimensions. The two first coordinates of each list are the position ...
1answer
158 views

### GroebnerBasis without specifying variables

All the examples in the Mathematica documentation specify that the syntax for the GroebnerBasis command is ...
1answer
288 views

### Computing Many Slow I/O Operations

In working on a custom stock screener, I often need to run mathematica code like this: ...
1answer
399 views

### Speeding up a slow indefinite integral

I have found an alternative way to express an old solution: ...
1answer
315 views

### Importing Zip files

Mathematica can import zipped files automatically, but when the content of the zip file it's another zipped file, I just get the list of files in the second zip: ...
3answers
238 views

### How can I compare a dynamic variable with a literal in Mathematica?

I'm doing a Mathematica Notebook and I want to make an alarm clock. Something like this: ...
1answer
184 views

### What's the most intelligent way to store the information of a selfmade graph?

I have a very long list of element, say $a1,a2, a3$,..., and they are all connected in that each is the child of many parents. E.g. $a74$ is associated with $a2,a55,a71$, and also contains ...
2answers
297 views

### Detecting double click events

Is there a way to detect double click events? I did not find anything on the doc page of EventHandler. Use case: I want to re-implement the ...
3answers
277 views

### Plot on command within DynamicModule?

Suppose I have a DynamicModule with all sorts of controls to set some parameters for a graphics object. ...
2answers
474 views

### How to use subscript in pattern names?

For example I want to define a function with parameters σx and σy, that is, the function will be declared as: f[σx_,σy_] := . . ...
2answers
238 views

### WordData for other languages

Mathematica already includes dictionaries for a lot of languages. What I am looking for is a handy semantic/grammatic database for Hungarian, just like WordData for ...
2answers
418 views

### Most efficient way to obtain samples from high-dimensional multivariate distributions?

Is MultinormalDistribution[] efficient and easy to use for high dimensions? I have a variable $n$ representing the dimension of a Monte Carlo integration I do on a ...
1answer
328 views

### Making a “cached” version of Manipulate[]?

I have a function that is a bit too slow for Manipulate[]. Right now I plan to cache outputs outside the manipulation and just have the manipulator select among ...
1answer
261 views

### Mathematica Import functions fails for data download from website

I am trying to download some data from a website that uses "java enabling" to tell me that I cannot download the data. Using Import[ "website...", "Data"] I get ...
1answer
99 views

3answers
370 views

### Composition of functions

I have a number of rotations computed by rot = RotationTransform[theta, point], and I would like to compose them to produce one function that is the composition of ...
1answer
212 views

### Defining a string based sort function

I'm having a bit of trouble figuring out the right Sort syntax to use on a list of lists. Consider the following list: ...
3answers
536 views

### NIntegrating within an Ellipsoid

I need to numerically integrate an expensive positive-definite function over a 2D domain. I know by other ways that the function is basically zero for values outside the following ellipse: ...
2answers
279 views

### Can SetDelayed (:=) be compiled?

Is it possible to put an If statement as below within a compile (see below)? I received a warning about SetDelayed. ...
6answers
2k views

### Does Mathematica have advanced indexing?

I have two $M \times K$ arrays $L, T$ where I would like to set all the elements in $L$ to zero whenever the corresponding element of $T$ is greater than 15. The ...
4answers
2k views

### How can I multiply matrix and vector element wise like Numpy?

I have an $M \times K$ matrix $C$ and a length $K$ vector $v$. I want to form the $M \times K$ matrix $S$ where $s_{ij} = C_{ij}/v_j$. To do this in numpy I simply divide the two objects like this ...
2answers
179 views

### Indeterminate expression. Where?

Consider the following: ...
1answer
2k views

### Programmatic formatting for Mathematica code - possible?

It seems to be both an interesting programming challenge and a very useful practical application to have a Mathematica program which would allow one to pretty-print Mathematica code, so that it is ...
1answer
116 views

### Copy TraditionalForm output to TraditionalForm input while keeping formatting

When I want to copy a scientific notated number from a TraditionalForm output to an input it formats it in a weird way: Another thing I want to do is only copy a few number of decimals, and remove ...

15 30 50 per page