11
votes
6answers
443 views

Reshaping associations, generalization of GroupBy

Let's say we have a set a\of associations: ...
11
votes
3answers
4k views

Does Mathematica get Pi wrong?

I happened to watch a Youtube video on Pi. According to the video, the 1 millionth digit of Pi is 1. And here is another page of the first 1 million digits of Pi. You can get the same answer from ...
11
votes
1answer
149 views

Adding Trace produces error messages

This is very strange. As I was trying to debug this problem, I noticed when I add Trace then I get lots of internal errors generated. This also happens the first ...
11
votes
2answers
647 views

Why is ParallelMap way slower than Map

I recently tried to use ParallelMap instead of Map and to my surprise encountered that ...
11
votes
3answers
219 views

How to collect expressions from cells created by Print?

I have a notebook where evaluation of a certain cell produced hundreds of adjacent output cells using Print. I need to create a list containing all expressions from ...
11
votes
1answer
139 views

How can I route edges manually for a Graph?

Most graph layouts supported by Mathematica use straight lines for edges; or at least something that only depends on the coordinates of the two adjacent vertices of the edge and nothing else. A ...
11
votes
1answer
437 views

How to merge Datasets representing matrices with named rows/columns?

I am working with square (non-symmetric) matrices with named rows and columns. The data I receive is sometimes messy and rows/columns may come in various permutations. I usually need to semi-...
11
votes
3answers
192 views

Emulating Sequence with my own function

I just considered if/how one could implement Sequence in Mathematica if it were not predefined. It turned out that the following simple definition has in all my ...
10
votes
2answers
250 views

Analytic determinant of a sparse 25x25 matrix?

I would like to compute the analytic determinant of the following sparse matrix ...
10
votes
2answers
262 views

Is there a method to enumerate the keys/values of System`Utilities`HashTable

Lacking from the simple API of System`Utilities`HashTable is a method to enumerate the keys/values. ...
10
votes
1answer
483 views

Symbolic Integration along contour: branch cut problem?

Context Following this question on path integrals in the complex plane, having defined again a numerical and symbolic integrator along a path as ...
10
votes
2answers
332 views

Why can I not replace a Dataset using a rule?

Simple replacement of a Dataset object does not seem to follow the expected behavior... Dataset[{}] /. _Dataset->1 Returns the empty Dataset not 1 as I would ...
10
votes
2answers
434 views

Impact Crater Simulation

I have been trying to model crater formation on a given planetary surface - $500\,\textrm{km}^2$. The locations of impacts are random, however, if an impact is within $30\,\textrm{km}$ of another, the ...
10
votes
1answer
687 views

How to import date (YYYY-MM-DD) data from a file?

I have a file with data in form {date, value}: 2010-05-19 17 2010-05-20 20 ...
10
votes
1answer
374 views

error when defining a compiled function with ReplacePart

I always have difficulty in writing a non-trivial compiled function. I'm using Mathematica 9. Please see the following code ...
10
votes
3answers
292 views

Mathematica equivalent to Python long raw strings? handling escape characters in packages

I'd like to write the following in plain text .m file in Mathematica, without having to double escape all the Latex commands: ...
10
votes
1answer
501 views

Creating custom notation

How does one generate custom symbols? For example, the physicist notation for the rotation is "nabla cross function". In this case however, Mathematica complains that the ...
10
votes
4answers
371 views

Efficient way of identifying the indices of first occurrences

It seems to me like identifying the first occurrence of unique elements should take about the same amount of time as it takes to delete duplicates. My data sets are much larger than this (...
10
votes
4answers
966 views

Plotting a complex valued function over a circular region

I would like to apply some complex valued function to some region in the plane, say, a circle of radius $R$ centred at $k$. How can I do this?
10
votes
2answers
445 views

Recursive Integral for Volume of $n$-Ball

The volume of an $n$-ball (the $(n+1)$-dimensional analogue of a disk) of radius $r$ can be found by the following integral recurrence: $$V_0(r)=2r$$ $$V_n(r)=\int_{-r}^rV_{n-1}\left(\sqrt{r^2-x^2}\...
10
votes
2answers
90 views

How to use `Except[]` inside of `Pick[]` [duplicate]

Pick[{1, 2}, {0, 1}, Except[0]] returns {1, 2}, the first element of which I did expect to be excluded. What is the thing I ...
10
votes
1answer
142 views

What are the scoping rules for function parameters shadowing System` symbols?

Here are some very contrived code snippets, highly unlikely to appear in real code, but still I am curious why they behave like this: ...
10
votes
2answers
191 views

Subtle difference in conditional rules placement

I had gotten used to thinking of the placement of a condition in a rule definition as logically immaterial. In my specific example, namely ...
10
votes
3answers
6k views

Connect to SQLite database

I am trying to connect to a SQLite database and since there is no officially supported driver; I decided to use the sqlite-jdbc driver and port the respective code into Mathematica. However, the ...
10
votes
2answers
121 views

A subtlety in Query

Let us consider a simple Dataset: ds=Dataset[{<|"a"->12,"b"->4|>,<|"a"->7,"b"->8|>,<|"b"->3|>}] Column "b" is easy to find: <...
10
votes
3answers
2k views

Programming Mathematica in plaintext, i.e. no formatting, non-notebook

I'm new to Mathematica and I've just begun reading Paul Wellin's Programming in Mathematica. The book, like many other books and online tutorials, revolves around using the notebook, with all its ...
10
votes
2answers
201 views

ParallelTable behaves differently when it is run inside a package

I've been butting my head against some very weird behaviour by ParallelTable, and its interaction with packages, over the past few weeks, and making relatively ...
10
votes
1answer
325 views

How to work around incorrect tooltips in plots exported to HTML

This is an issue that I always wanted to investigate but haven't gotten around to solving yet: The tooltips for contour lines in a plot like this can be very useful in the Notebook interface: ...
10
votes
2answers
360 views

Get rational and irrational parts

Consider an expression of the form $a + b \sqrt{2}$, where $a,b \in \mathbb{Q}$. How can I extract $b$ (or equivalently $a$) from this expression?
10
votes
1answer
1k views

Changing default ImageSize in the frontend?

I would like graphs to appear somewhat larger in my notebooks (running v8.0.4 on OSX 10.8.2). Naturally I can specify ImageSize in each individual plot, or drag ...
10
votes
1answer
446 views

How to make a volume CUDA rendering isometric?

I just realized that the output of CUDAVolumetricRender[] uses (quite marked) perspective, which I do not want (for scientific data representation, it can be very ...
10
votes
1answer
378 views
10
votes
4answers
879 views

Efficiently Visualising Very Large Data Sets (without running out of memory)

I have put a few really hard problems in combinatorics up against Mathematica 8. I'd have to say that it works really well, until you want to view the data. If you look at my question Advanced ...
10
votes
4answers
365 views

Panning with Mouse

This is related to the question i just asked here but not the same. How could i create a manipulate that lets me move the graph to any position i want by clicking and dragging anywhere. Here is an ...
10
votes
2answers
327 views

Asymptotics of $\frac{\sum _{i=0}^{\lfloor n/2 \rfloor} {2(n-2i) \choose n-2i} {n \choose 2i} {4i \choose 2i}}{2^{3n - 1}}$

I am fairly sure that asymptotically $$\frac{\sum _{i=0}^{\lfloor n/2 \rfloor} {2(n-2i) \choose n-2i} {n \choose 2i} {4i \choose 2i}}{2^{3n - 1}} \sim \frac{2}{\pi n}.$$ I tried Limit[n*Sum[...
10
votes
1answer
404 views

How to visualize pattern matching process?

I want a function that does the same job like ReplaceRepeated, and can make the matching process visible. I searched the Internet but didn't find any existing code ...
10
votes
1answer
222 views

Why do DateList, DateString, and AstronomicalData ignore $TimeZone?

My reading of the documentation for DateList and DateString lead me to believe that both functions use ...
10
votes
2answers
2k views

How to calculate mix of 4 colors defined in CIELAB L*a*b* model?

I have 4 colors that I converted from RGB to CIELAB L*a*b* model. How can I calculate mix of these 4 colors when I have (L,a,b) for each such color? How can I ...
9
votes
2answers
207 views

How to define UpValues in a different context from within a package

I'm trying to create a function (in a package) to import a lot of data and create a symbol with UpValues to return specific results about the data. I've got it working fine in a regular notebook, but ...
9
votes
1answer
243 views

in v9, backspace causes cell to become section style

In the front end of v9, in any given cell that contains content, if I hit backspace to clear the content until there is nothing left, and then hit backspace one more time, the cell becomes a 'section'....
9
votes
3answers
367 views

Operate over list of pure functions

I have list of pure functions (All functions are InterpolatingFunction) i.e {{a, b}, {c, d}, {e, f}, ...} and I would like ...
9
votes
2answers
218 views

Checking from a preemptive evaluation whether a main evaluation is ongoing

How can I programmatically check from a preemptive evaluation whether a main evaluation is currently ongoing? I need a function mainEvaluationOngoingQ[] so that <...
9
votes
0answers
126 views

Esc-esc for special characters and autocomplete in Mathematica 9 [duplicate]

I recently upgraded to Mathematica 9 and have noticed a slightly annoying behavior that I was looking to remedy. In the past I would type special characters, e.g. ...
9
votes
1answer
400 views

FEM: how to choose FEM element type

I am asking myself if there is any simple option for choosing the element type for the mesh generation WITHOUT explicitly creating coordinates and then the mesh. Minimal example: here I would like ...
9
votes
1answer
908 views

How to calculate the $H_2$ and $H_\infty$ norms of TransferFunctionModels or StateSpaceModels?

Lets assume we have a system model: ...
9
votes
3answers
1k views

How to typeset a system of equations

Is it possible to typeset systems of equations in Mathematica, and if so, how can I do it using a big left bracket as one could in LaTeX with \left\{ ... \.? I ...
9
votes
1answer
563 views

Generating high quality charts in Mathematica for use in LaTeX and Word

I frequently have a probelem using my charts in reports because the text (axes labels and tick marks) look low resolution (fuzzy). When I export my charts, i export them as PNG files. Unless I'm ...
9
votes
1answer
84 views

How to put Magnification control in docked cell

I have made a handy toolbar that provides access to menu items that are not visible when I F12 a workbook. I would like to add the following function to a button in the toolbar: ...
9
votes
2answers
380 views

Any packages for vertex enumeration on Mathematica?

My work requires me to enumerate all vertices of a polytope defined by linear inequalities from time to time. And I'm mainly working with _Mathematica 9.0 on Mac OS X 10.9. So I wonder are there any ...
9
votes
1answer
431 views

Laplacian and DiracDelta

It is known that: $\nabla^2 \dfrac{1}{|r-r'|} = - 4 \pi \delta^3(\vec{r}-\vec{r}')$. If I do that with Mathematica, I find: ...

15 30 50 per page