# All Questions

2k views

### Mathematica won't give eigenvectors but Wolfram Alpha will? What am I doing wrong?

If I ask Mathematica to find the eigenvectors and eigenvalues of the matrix: ...
692 views

### Applying And to lists of Booleans

I'd like to take {True,True,False} and {True,False,False} and apply And to get ...
1k views

### ParallelTable and Table do not give same result

I have a question regarding the use of Parallelize. In the help one can read that “Parallelize[Table[expr,iter, …]] (which is ...
2k views

### The difference between 0. and 0

I have a function for which 0 is a special case: f[A___, 0, B___] := 0 But since I am doing numerics, sometimes in the course ...
768 views

### Evaluating an If condition to yield True/False

I would like to decide whether an option passed to my custom function has the value Automatic or something else. This is my attempt: ...
538 views

### Help on evaluation control?

I want to plot series of slopes: x, 2x, 3x, 4x, 5x, 6x... I'm trying to do this: ...
276 views

I don't understand the following: f[a_, b_] := a + b ls = {1, 2, 3}; MapThread[f, {ls, {10, 20, 30}}] This yields ( as expected ) {11,22,33} If I change ...
5k 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. ...
2k views

### Levels: how do they work?

I cannot understand how Mathematica manages levels, and so it's always a painful try-and-fail to use Flatten. Can someone please give me a very clear definition? ...
2k views

### What best practices or performance considerations are there for choosing between Cases, Position, Pick and Select?

Cases, Select,Pick and Position each have different ...
4k views

### Torn edge paper effect for images

In my answers to Plotting Error Bars on a Log Scale I used a so called "torn edge" effect from on one of the images. @SjoerdC.deVries commented: "BTW I liked the ripped-out look of your InputForm ...
5k views

### How to find circular objects in an image?

How could I use morphological processing to find circular objects in an image? More specifically, I need to detect road signs. I need to get the "80 speed limit" sign from this image:
1k views

### The clearest way to represent Mathematica's evaluation sequence

WReach has presented here a nice way to represent the Mathematica's evaluation sequence using OpenerView. It is much more clear way to go than using the standard ...
1k views

### Items known by CurrentValue

CurrentValue can be used to poll the state of numerous system values such as the mouse position. Its help page doesn't list all possible items, though. An item like ...
4k views

### K-means clustering

In MATLAB, there is a command kmeans() that divides an array into $k$ clusters and calculates the centroid of each cluster. Is there any command in Mathematica to ...
763 views

### Are there guidelines for avoiding the unpacking of a packed array?

Packed arrays are very useful because they save memory and generally allow speedier and more efficient calculation times. If a list of data currently stored as a packed array is unpacked, it can slow ...
3k 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 ...
2k views

### Extruding along a path

I'm trying to render a 3D image of a path by extruding a circular cross-section along the path, creating a "snake-like" path. Here is an image I found to illustrate: I can't seem to figure out if ...
2k views

### How to select minimal subsets?

I am a newbie, so please point me in the right direction if you feel this question has been answered somewhere else before. Here goes: Suppose I have a list like this: ...
2k views

### Generating graphs interactively (GUI)

I want to create graphs interactively using a GUI. I thought of using a ClickPane[] environment. The code I have (in part borrowed from the Documentation) works ...
750 views

### How to program a F::argx message?

How useful is it to program a user-built function in a package to produce a red warning message F::argx if you give the wrong number of arguments to that function? ...
1k views

### Why is there no PositionFunction in Mathematica?

Too often I have seen the programs of inexperienced users greatly slowed by using Position in an iterative fashion, when far faster would have been to compute a ...
1k views

### Local variables in Module leak into the Global context

From the Mathematica documentation on Module: Module allows you to set up local variables with names that are local to the module. But after using ...
1k views

### What tools can help in realizing tail recursion?

I had nice discussions with Leonid and Rojo that got me interested in tail recursion. Tail recursion is not always easy to realize with Mathematica, so it would be nice to have some tools to help with ...
3k views

### How to get intersection values from a parametric graph?

I have this graphed: ParametricPlot[{2.4*Cos[t] + 1.6*Cos[3 t/2], 2.4*Sin[t] - 1.6 Sin[3 t/2]}, {t, 0, 4*Pi}] It is a star, and the lines cross each other ...
3k views

### Real Size Image Printing

I am generating a complicated graphics with Mathematica, but with objects of given sizes (e.g. a line of length 1 inch, between two points). I want to make sure that when I export the graphics, e.g. ...
1k 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 ...
12k views

### Is it possible to export the equations from Mathematica to MATLAB?

Is it possible to export the output expressions from Mathematica computations (e.g., equations) in valid MATLAB syntax?
1k views

### “Covering up” text in Graphics

Consider the following code: ...
10k views

819 views

### Block attributes of Equal

I answered “Equating matrices (or higher order tensors) element-wise” with: ...
584 views

### Custom functions by delegating options in a specific way and using core functions

I'd like to create a custom function that does essentially the same as a core function of mathematica but uses different default settings. Example: I want a Plot function that uses Mathematica's core ...
3k views

### Is it possible to prerender animation in Wolfram Mathematica?

I have a DensityPlot which is evaluated for a long time. I wish to use it with animation, but it is absolutely inapropriate. Is it possible to render animation ...
370 views

### MatchQ-ing Associations (MMA 10)

Consider {x->1} which has FullForm List[Rule[x, 1]] and, therefore, ...
1k views

### How do I obtain the enclosed area of this particular parametric plot?

I'm trying to find a way to obtain the enclosed area of this particular plot. Can someone show me how? ...
4k views

### Plot, extract data to a file

I need to save data that Mathematica uses inside the Plot command. The format that I would like to have is: x1 y1 x2 y2 ..... ...
3k views

### Way to improve “show me this decimal number to M places, don't use scientific notation”?

The best way I can come up with to say "show me this fraction as a decimal number to M places, don't use scientific notation" is: ...
3k 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 ...
4k views

...
2k views

### First positive root

Simple question but problem with NSolve. I need help how to extract first positive root? For example: ...
1k views

### How to extract the numerical value of a dynamical variable

I want to inspect interactively an image by selecting points by the mouse pointer. This is easily done by LocatorPane - here is a simplified example: ...
298 views

In the ideas shared in my answer to this post Struct equivalent in Mathematica? at the end I propose a solution that changes the way Set works in a particular case that can be expressed in plain words ...
2k views

### RevolutionPlot3D: but NOT revolving about the z axis

I want to demonstrate generating a solid of revolution by revolving a planar region about, say, a horizontal axis. However, RevolutionPlot3D doesn't seem to have an ...
2k 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: ...
1k views

### Automatically load packages at startup

I'm a physics student and I try to simplify my day with Mathematica. Every time I use Mathematica I need Div[], Grad[], ...

15 30 50 per page