# All Questions

13,433 questions
25k views

### How to remove redundant {} from a nested list of lists?

There are numerous examples here, whose end result is the removal of empty brackets {} and empty lists. I still can't find an example of simply removing redundant ...
4k views

### Plot a piecewise function with black and white disks marking discontinuities

Let's say I'd like to plot Sign[x + 0.5]: Plot[Sign[x + 0.5], {x, -1, 1}] Mathematica will give this: This plot does not ...
2k views

### Can a Trie be implemented efficiently?

What is the most space and time efficient way to implement a Trie in Mathematica? Will it be practically faster than what is natively available in appropriate cases?
3k 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-...
971 views

### What can I use as the second argument to Return in my own functions?

Having found out about the second argument to Return I played a bit with it, and the following tests all resulted in ...
5k views

### Finding all elements within a certain range in a sorted list

Suppose we have a sorted list of values. Let's use list = Sort@RandomReal[1, 1000000]; for this example. I need a fast function ...
1k views

### Customizing syntax highlighting for private cell styles

Is there any way to set up a cell style with a particular syntax highlighting? For example, I'd like to have a CProgram cell to write in blue the C special words. I have done it by setting ...
735 views

### Constructing symbol definitions for With

I would like to be able to define two arrays, one containing symbol names and one containing the values of those symbols, for use in constructs such as With. For ...
5k views

### How to pass a symbol name to a function with any of the Hold attributes?

Given a function with the attribute HoldFirst, HoldAll or similar, and a variable, list, how ...
794 views

### How to interpret the FullForm of a SparseArray?

SparseArrays are atomic objects, but they do have a FullForm which reveals information about them. What is the meaning of the ...
27k views

### How can I transpose x and y axis on a Plot?

This question has appeared in various forms online, but I have not yet seen a complete answer, so I am posting it here. More specifically, suppose I have a function ...
1k views

### How can the behavior of InterpolationOrder->0 be controlled?

In ListPlot and Interpolation, the option InterpolationOrder->0 uses two different ...
3k views

### Export Plot3D in Mathematica 10.1 is Rasterized by default

When I use Export to export Plot3D to PDF format, I get different behaviour in Mathematica 10.1 compared to 10.0. In particular, ...
883 views

### Button action monitored with progress bar

Let's say you have a palette with a button that has to do some time-consuming task when clicked: ...
5k views

### Plotting piecewise function with distinct colors in each section

I have a piecewise function that I would like to plot but I was wondering if it is possible that each part of the function that is plotted when its corresponding condition is true be plotted with a ...
1k views

### Problem with ParametricPlot

I'm plotting gear curves, and I observe that for some parameter values ParametricPlot[] does not plot all the teeth: ...
1k views

If I evaluate this expression: Module[{}, 1/0;0^0]; msg = $MessageList I get: ... 2answers 10k views ### Plot 4D data with color as 4th dimension I have a list of 4D data (x position, y position, amplitude, wavelength). I want to plot x, y, and amplitude on a 3D plot and have the color of the points correspond to the wavelength. I have seen ... 3answers 2k views ### How to distribute Mathematica packages as paclets? Mathematica does have a nice package manager. Packages are called paclets, and they can be managed using the functions from the PacletManager` context. How can I ... 5answers 9k views ### How can I extract data points from a black and white image? Consider the following graph (source): Is there any way to extract the data points from this image in a semi-automatic way? I have seen, and tried the methods suggested in this question, but they did ... 6answers 5k views ### How to avoid collision between optional arguments and options Is it possible to create a function with optional arguments that also takes options? Here is a simple example. I have a function f with option "g". It also has ... 6answers 3k views ### V10's Operator Forms - what are they good for? V10 introduces an operator form for several functions perhaps primarily due to their role in queries as part of introducing data science functionality. At first pass it seems a lot of effort to add ... 4answers 5k views ### How can I make an X-Y scatter plot with histograms next to the X-Y axes? I just saw a nice plot there: How could I implement that in Mathematica — by which I mean the plot structure, not so much the styling. 5answers 5k views ### Are there any cases when For[] loops are reasonable? To my mind the only reason for the existence of For[] loops in Mathematica is to allow new users with some experience in procedural programming languages to write ... 7answers 8k views ### Intersecting graphics Does the Mathematica graphics system have any concept of intersecting graphics? I've not found much in the documents so far. For example, if I want to show the intersection of two shapes: ... 6answers 3k views ### Partition a set into subsets of size$k$Given a set$\{a_1,a_2,\dots,a_{lk}\}$and a positive integer$l$, how can I find all the partitions which includes subsets of size$l$in Mathematica? For instance, given ... 4answers 1k views ### Resource management in Mathematica I am using a library that has functions like createSomeObject[] and deleteSomeObject[obj]. It is an interface to a C language ... 3answers 1k views ### Prepend Information to Warning Messages I have a function running within a Do loop that sometimes issues a warning. I'd like to prepend the warning with the loop ctr so that I can go back and debug that instance later. Basically, I would ... 7answers 6k views ### Efficient way to generate random points with a predefined lower bound on their pairwise Euclidean distance Using Mathematica what is an efficient way to generate a list of$n$random two dimensional points$\{x_i,y_i\}$where$i=1,...,n$so that no two points$p_1$and$p_2$in the list has an Euclidean ... 2answers 2k views ### How can I conveniently call igraph from Mathematica? Mathematica has lots of functions for working with graphs and networks, but there are still some functionality holes that are provided by other packages. Also, due to the nature of graph theory, ... 3answers 3k views ### Reading periodic elements from a large file I have a large binary data file (big endian) with 100+ million "rows" of 11 elements, combination of floats and integers. This is the format: ... 2answers 822 views ### Copying one symbol into another I would like to know how can I completely copy one Symbol to another. When I say copy, a refer to UpValues, DownValues, ... 2answers 2k views ### How does Plot work? I considered the following function: sin[x_] := Module[{}, Print["x=", x]; Sin[x] ] in Mathematica. Next, I tried to plot it using: ... 5answers 902 views ### Reassign values to symbols I've got a situation where I have, say 4 symbols, a, b, c and ... 3answers 4k views ### Using D to find a symbolic derivative I need to do the following: Define a function Take the derivative of this function and have a look at the symoblic representation Substitute in some values With the bonus that I want to use the ... 1answer 1k views ### Using Evaluate and Evaluated -> True in Plot A few use cases: (1) This, as expected, returns (almost) immediately: f[x_?NumericQ] := Evaluate[(Pause[1]; x)] Plot[f[x], {x, 0, 1}] (2) This takes ... 1answer 424 views ### Workarounds for a possible bug in the linearity of FourierTransform This is somewhat similar to this question, except the problem I am encountering is to do with Fourier transforms of scalar multiples of functions and their derivatives. I wish to input ... 10answers 5k views ### Fibonacci Sequence Generator I'm trying to write a function in Workbench which will generate a Fibonacci sequence starting with F0 = 0 and F1 = 1. So far I ... 9answers 10k views ### General strategies to write big code in Mathematica? I think after six months of exposure to Mathematica and the Wolfram Language I am fairly OK with writing short codes and snippets. However, what are some general strategies to use in order to write ... 3answers 8k views ### Metaprogramming in Mathematica Being functional, and having no "quotation", i.e. essentially treating data and programs semantically same, Mathematica seems naturally capable of doing metaprogramming. But could anyone construct a ... 5answers 11k views ### How can I generate this “domain coloring” plot? I found this plot on Wikipedia: Domain coloring of$\sin(z)$over$(-\pi,\pi)$on$x$and$y$axes. Brightness indicates absolute magnitude, saturation represents imaginary and real magnitude. ... 2answers 7k views ### How to access new colour schemes in version 10? Many colour schemes and colour functions can be accessed using ColorData. Version 10 introduced new default colour schemes, and a new customization option using <... 7answers 14k views ### Saving data inside a notebook so that I don't have to run it again? Piggybacking on this, I am somehow not fully convinced that I can't save data generated by a calculation in a mathematica file so that when I re-launch said file, I wouldn't have to run my ... 6answers 16k views ### How to perform a multi-peak fitting? I am wondering how to implement the multi-peak detecting and fitting in Mathematica. Following is an example of fitting the data using three peaks (such that the data ~ peak1 + peak2 + peak3). The ... 3answers 23k views ### How to use$\LaTeX\$ for typesetting labels and titles in Mathematica

I need to typeset large number of equations to be used for PlotLabel and Titles and such. These have to look nice. Hence I use <...
6k views

### How to find out which method Mathematica selected?

There are commands like NonlinearModelFit[] or NDSolve[] that have the option Method it ...
4k views

### Changing Values in an Association using Map

I am trying to change the value of one key in an association based on the value of another key in that association. So if my association starts as: ...
1k views

### How to create expanding summary boxes like the ones displayed for InterpolatingFunction, NearestFunction, etc.?

The display forms for objects like ClassifierFunction are nice clickable summary boxes I like this, and now I'm trying to create my a custom version of this for my ...