All Questions

Filter by
Sorted by
Tagged with
23 votes
2 answers
812 views

Context unique to each group at a specified level

Are there any new tools in v10 that might be applicable to this problem? Recent versions of Mathematica provide the option of having a unique $Context for each ...
user avatar
  • 265k
28 votes
1 answer
955 views

Convenient string manipulation

With Mathematica I always feel that strings are "second class citizens." Compared to a language such as PERL one must juggle a lot of code to accomplish the same task. The available functionality is ...
user avatar
  • 265k
16 votes
3 answers
2k views

On coloring the faces of a surface differently with parameter-dependent colors

Old versions of Mathematica ($VersionNumber < 6) supported a particular syntax of ParametricPlot3D[] that allowed for ...
user avatar
30 votes
4 answers
12k views

Implementing discrete and continuous Hilbert transforms

What is an efficient and accurate Mathematica implementation of the Hilbert transform, for both continuous and especially discretely sampled functions? This transform relates phase and amplitude in ...
user avatar
  • 265k
10 votes
1 answer
1k views

Prenex and Skolem normal forms

In Mathematica version 7, there was a big advance in logic support ("Boolean computations" is the official name). This was not further developed in version 8.0. So now we have a fairly robust support ...
user avatar
  • 5,210
17 votes
3 answers
453 views

How can I set Grid alignments using numbers?

There is an example in the Alignment documentation (it also appears in the Grid documentation): ...
user avatar
63 votes
4 answers
5k views

How do I evaluate only one step of an expression?

I am looking for a simple, robust way to evaluate an expression only one step, and return the result in a held form. The definition of a single step is ambiguous, and this itself is probably worthy ...
user avatar
  • 265k
17 votes
1 answer
4k views

Combined numerical minimization and maximization

I want to numerically calculate the maximum of a function defined by the minimization of another function, like the following: ...
user avatar
  • 18.9k
25 votes
5 answers
1k views

How can I work out which functions work with SetOptions?

Not all functions seem to work with SetOptions. e.g. ...
user avatar
3 votes
2 answers
508 views

what is the command to make Mathematica beep each time there is an error even for the same command?

sorry for a basic question, but does any one know what is the trick to make the front end beep at me each time I issue the same command (which contain an error)? It now only beeps the first time, ...
user avatar
  • 112k
18 votes
7 answers
949 views

Elegantly pairing up mismatched lists

HistogramList returns a list of bin boundaries and a list of counts. There is one more boundary than counts, and I'd like to pair them up so I can feed it into <...
user avatar
4 votes
3 answers
1k views

Drawing graphics part by part

What I want to do is to draw graphics part by part, because I made a function that generates coordinates according to which I will draw graphics. The problem is that MMA does not operate as I expected....
user avatar
  • 683
16 votes
2 answers
2k views

Constructing functions with variable number of output arguments

In Mathematica, you can construct a function f to have different definitions based on its input arguments. For example, ...
user avatar
  • 87.1k
36 votes
4 answers
3k views

How to collect result continuously (interruptible calculation) when running parallel calculations?

This is the most common pattern to compute a table of results: Table[function[p], {p, parameters}] (regardless of how it's implemented, it could be a ...
user avatar
  • 227k
14 votes
4 answers
2k views

Strategies for avoiding and handling shadowing

When dealing with namespaces in Mathematica (BeginPackage, $ContextPath ...) one is unavoidably confronted with the problem of ...
user avatar
  • 23.1k
15 votes
2 answers
330 views

How do you determine the optimal autocompilation length on your system

When you pack lists there is an overhead therefore packing a list with, say, 2 elements is likely to cost more than you get back in efficiency. Mathematica has default list lengths for which functions ...
user avatar
23 votes
2 answers
711 views

SetAttributes[f,Flat]: Why the order dependence?

I'm experiencing a strange phenomenon. Here's a (quite artificial) test case: The following definition work just fine: ...
user avatar
  • 18.9k
33 votes
0 answers
3k views

Custom package development: Basic steps [duplicate]

Every once in a while, I write a generic function that I use quite often for months to come. However, package development in Mathematica is not very well documented from what I can tell, and I was not ...
user avatar
  • 14.7k
16 votes
2 answers
5k views

How to represent and manipulate abstract indexed vector (or tensor) expressions?

I have a couple abstract indexed quantities, both differential elements $dx = dx^\mu e_\mu + x^\mu de_\mu$ $du = du^\mu e_\mu + u^\mu de_\mu$ I can compute the expression $(dx + du) \cdot (dx + du) ...
user avatar
  • 6,228
33 votes
3 answers
12k views

How to export large graphics?

I'm using Raster to create large graphics (1000 by 1666), which I want to Export as a JPEG or TIFF in a resolution that can be printed in a large size, 3' by 5'. I'...
user avatar
  • 1,170
33 votes
2 answers
2k views

What are recommended guidelines for developing packages?

This might be of general interest – I have different questions regarding naming conventions, contexts, subcontexts, shadowing, etc., but I do feel that they are closely related, thus I don't really ...
user avatar
21 votes
1 answer
2k views

How do you use ssh-keys instead of a password to run a remote-kernel over ssh?

On all of the servers that I regularly interact with, I have ssh-keys setup for passwordless access via ssh. Yet, every time I attempt to start a remote-kernel over ssh, I get asked for a password ...
user avatar
  • 33.3k
23 votes
5 answers
1k views

Reassign values to symbols

I've got a situation where I have, say 4 symbols, a, b, c and ...
user avatar
17 votes
4 answers
4k views

How to get actual triangles from DelaunayTriangulation[]?

The ComputationalGeometry package has a DelaunayTriangulation[] function. It returns a list of points connected to each point, ...
user avatar
  • 227k
20 votes
3 answers
2k views

Efficient way to combine SparseArray objects?

I have several SparseArray objects, say sa11, sa12, sa21, sa22, which I would like to combine into the equivalent of {{sa11, sa12}, {sa21, sa22}}. As an example, I ...
user avatar
82 votes
9 answers
6k views

Updating Wagon's FindAllCrossings2D[] function

Stan Wagon's Mathematica in Action (second edition; I haven't read the third edition and I'm hoping to eventually see it), demonstrates a nifty function called ...
user avatar
11 votes
2 answers
818 views

Move the cursor in a notebook using the keyboard

How can I move through a notebook using only the keyboard? If one tries to use the arrow keys, the cursor tends to get "trapped" in comments and error messages.
user avatar
  • 755
14 votes
5 answers
520 views

Is it possible to cause a notebook to be hidden when pressing the close button?

Is it possible to cause a notebook to be hidden (Visible -> False) instead of closing it when pressing the close button in the title bar? The ...
user avatar
  • 227k
6 votes
1 answer
429 views

Implementing local complements of graphs

I'm trying to write a routine which generates the local complement of a graph at a vertex. For those who don't know, the local complement for a singly-connected, undirected graph is defined as the ...
user avatar
  • 18.9k
8 votes
1 answer
1k views

Easiest Way to Use ShowGroupOpener in Mathematica

I currently edit manually the cell contents of a notebook (Ctrl+Shift+A or Cmd+Shift+A) to "recycle" cells containing the ShowGroupOpener option. Is there an easier way to create documents hiding ...
user avatar
7 votes
1 answer
316 views

Setting up TextStyle with initialization cells in Mathematica 6+

It used to be quite straightforward to change the default settings of a notebook in terms of inputs, outputs, text styles and font sizes in previous versions of Mathematica using initialization cells ...
user avatar
6 votes
1 answer
495 views

How to simplify expression and use HoldForm at the same time?

Hopefully a simple problem for the experts here. I have a need many times to build a symbolic expression for an equation (say a PDE) to use for plot labels in a low level function inside ...
user avatar
  • 112k
45 votes
2 answers
1k views

What is the most effective way to setup a Notebook with transparent background but solid contents?

I know there is a Notebook option WindowOpacity can be used to adjust the opacity of a whole notebook. But what I want is keeping the text and graphics and so on ...
user avatar
  • 26.6k
14 votes
2 answers
325 views

Tuning ParallelMap when IO and computationally bound

I'm currently doing work on processing a number of images taken frame-by-frame from a video. As a result, I have a directory of around 16K PNG images that at most ~300K. That said, I have a routine, ...
user avatar
  • 469
22 votes
2 answers
4k views

How to combine images with the same dimensions in a grid?

I have the following images, both 480 x 270 pixels: I'd like to stitch them side by side in a 960 x 270 pixel image like so (scaled down): So far, I've been using ...
user avatar
  • 469
31 votes
4 answers
2k views

Asynchronous evaluation: Is it possible?

Currently we have a limited number of ways to perform asynchronous evaluation. The most common is through Dynamic and Manipulate...
user avatar
  • 1,905
30 votes
2 answers
841 views

How can I ensure that I am constructing patterns in the most efficient way possible?

Inspired by this answer, I am interested to know if there are best practices or rules of thumb for constructing patterns, for example for use in function definitions (...
user avatar
  • 33.7k
19 votes
2 answers
2k views

How to export and import Graphs with additional data?

I'm trying to export and then later import graphs with additional data added such as VertexLabels and EdgeLabels. When I export ...
user avatar
  • 405
15 votes
4 answers
5k views

How can I extract the maximum value from a Histogram?

In Mathematica 8.04 I've created a histogram of returns on a stock using: ...
user avatar
  • 1,399
54 votes
2 answers
3k views

Adaptive sampling for slow to compute functions in 2D

EDIT: Although I have posted an answer based on my current progress, this in incomplete. Please see the "open issues" section in the answer. Most plotting functions in Mathematica adjust the ...
user avatar
  • 227k
20 votes
1 answer
1k views

How to work with characters from CJK Unified Ideographs Extension B correctly?

Background: Recently I'm trying to deal with some Chinese characters which belongs to the CJK Unified Ideographs Extension B block. The motive comes from some further interest following a former ...
user avatar
  • 26.6k
9 votes
1 answer
292 views

Why is the Locator snapping back to the original coordinates? How can I prevent this?

Take the following code: p = {3, 3}; Graphics[Circle[{5, 5}, 5], Epilog -> Dynamic@Locator[Dynamic[p]], Axes -> True, GridLines -> {{3}, {3}}] Whenever ...
user avatar
  • 227k
15 votes
3 answers
1k views

Image levels: how to alter 'exposure' of dark and light areas?

I was working with some less than ideal photographs, and wanted to adjust them before continuing. I wanted to raise the levels of the very dark areas and lower the levels of the very light areas. I ...
user avatar
  • 23.9k
40 votes
3 answers
4k views

Antialiasing in 3D

Is it possible? Is it platform specific? Does it rely on the graphics hardware? Why does the antialiasing slider under Preferences > Appearance > Graphics do nothing? I remember seeing some post-...
user avatar
18 votes
3 answers
435 views

How can I test properties of a symbol from the string name without the symbol completely evaluating

Suppose I have a few symbols, one of which has a value: {abc1, abc2 = 5, abc3}; I can use Names to get the list of names, as ...
user avatar
24 votes
1 answer
778 views

Is there an NDSolve`ProcessEquations analog for NIntegrate?

NDSolve has an interface for repeatedly solving an equation with different initial conditions without having to analyze the equation and set up the solving ...
user avatar
  • 4,941
43 votes
5 answers
22k views

What is the most efficient way to add rows and columns to a matrix?

Say I have a matrix m and a vector v. ...
user avatar
  • 19k
21 votes
1 answer
1k views

Transparent textures don't show

EDIT For now, I'm going to accept Brett's answer. It's a way to get transparency back by having 3D calculations done in software instead of hardware. It addresses the symptoms but not the causes. ...
user avatar
7 votes
3 answers
283 views

How to avoid spaces between numbers when displaying TagBox(es)

The instruction : DisplayForm[RowBox[List[0,1,Superscript[2,3],Superscript[1,2],a]]] displays a gap between the first two items of the list but if one is careful ...
user avatar
  • 937
72 votes
9 answers
62k views

How to find the position of elements in a list satisfying criteria

Say I have a list x={2,4,6,8,10} and I want to find out the positions of the elements that are greater than 7. ...
user avatar
  • 1,393

15 30 50 per page