# Tagged Questions

Questions about the use of built-in Mathematica functions, including pure functions.

7k views

### What are the use cases for different scoping constructs?

Mathematica includes three functions that I know of which can be used to effectively (if not actually) define a variable and give it a value within a local scope: ...
11k views

### List of compilable functions

Is there somewhere a list on the functions that Compile can compile, or the cases in which a particular function can be compiled that I haven't found? I'd be glad ...
6k views

### What are some useful, undocumented Mathematica functions?

There have already been some questions about some undocumented functionality in Mathematica. Such as (please add to these lists!) How can one find undocumented options or option values in ...
3k views

### Flatten command: matrix as second argument

One thing I could never wrap my head around is how Flatten works when provided with a matrix as the second argument, and the Mathematica help isn't particularly ...
2k views

### Automatically generating a dependency graph of an arbitrary Mathematica function?

Has anyone written a function to pull the function dependencies of a function? That is, it would be nice to have a function that returns a list of function dependencies as a set of rules, terminating ...
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 ...
8k views

### What is the difference between Reduce and Solve?

Solve and Reduce both can be used for solving equations. Just by working with them, I know there are some differences between ...
3k views

### Using a PatternTest versus a Condition for pattern matching

My last question to the site resulted in several answers that involve using pattern matching in Mathematica, a feature I wasn't very familiar with at the time. I am currently reading Mathematica ...
4k views

### What is so special about Prime?

When we try to evaluate Prime on big numbers (e.g. 10^13) we encounter the following issue: ...
588 views

### What bug fixes can be implemented in init.m?

In comments on this question, Mr. Wizard suggested a community wiki to share the bug fixes/workarounds (or possibly other tricks) people load in their init.m. I ...
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

### Why is the new PositionIndex horribly slow?

This issue has largely been mitigated in 10.0.1. New timings for the final test below are: ...
930 views

### Enforcing correct variable bindings and avoiding renamings for conflicting variables in nested scoping constructs

Using global variables the following turns an "expression" into a Function: expr = 2 x; Function[x, Evaluate[expr]] Of course ...
1k views

### Variable naming changes everything

Bug fixed in 10.0.0 I am having a rather unusual problem I do not understand with Mathematica where renaming one of the variables of my function causes the function to stop "working". Here is the ...
2k views

### Scan vs. Map vs. Apply

I cannot understand the difference between Apply, Scan, and Map. I have tried to play with ...
934 views

### Is there a name for #1@#2&?

Why does the pure function # @ #2 & have no name? I'm asking because sometimes I find inelegant to write expressions like ...
726 views

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

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

### Implementing continuous phase/Arg function

In MATLAB there's a function called phase that is just like our Listable friend Arg, but ...
394 views

### What does InternalInheritedBlock do?

What does the function InternalInheritedBlock do? How is it different from the regular Block?
2k views

### Are there “All” and “Any” functions in Mathematica?

In Python, there is a function all which returns true if all of its arguments are true, and any which returns true if at least ...
778 views

### Parentheses in pure functions: # & vs. ( # &)

I've been using Mathematica for years, and over time I have developed the habit of using: Select[data, (# == 1 &)] instead of ...
994 views

### DeleteDuplicatesBy is not performing as I'd hoped. Am I missing something?

Déjà vu: a new-in-v10 function should provide a better solution to an old problem, but my enthusiasm is curbed when I run timings. This time the function is ...
621 views

### What are SparseArray Properties? How and when should they be used?

A strange undocumented form of SparseArray is increasingly used in answers on this site: ...
399 views

### How to create a dynamic expanding DisplayForm's styled like the ones in v10?

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

### Strange ::usage behavior in v9

Bug fixed in 9.0.1 Something has gone wrong with usage in Mathematica 9. Would someone tell me how to fix it? I define a function ...
2k views

### How to load a package without naming conflicts?

This question applies to any package, but I encountered this problem while working with graphs. There are symbols in the Combinatorica package (such as ...
626 views

### Why is Query so much slower than Part?

Time for another of these(1),(2) as yet another new-in-10 function appears to have poor performance compared to older alternatives. This time: Query appears to be ...
873 views

### Block attributes of Equal

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

### In 10.1.0 BenchmarkPlot doesn't work?

Bug introduced in 10.1 This bug was resolved in 10.2.0, but another bug was introduced in 10.3.0 persisting through 10.3.1 and finally resolved in 10.4 In Mathematica 10.1.0 and 10.3.0 ...
31k views

### How to express trigonometric equation in terms of of given trigonometric function?

How can I express a trigonometric equation / identity in terms of a given trigonometric function? using following trigonometric identities ...
336 views

### Is FullGraphics an abandoned function? Is there an alternative?

FullGraphics hasn't worked entirely for a long time and the situation appears to be getting worse instead of better. In Mathematica 10.0 and 10.1 a simple usage ...
573 views

### Performance problems in new Sequence functions

The new-in-10.1 Sequence* family of functions should provide newly optimized methods for handling sequence problems. Happily in some cases they do! For example ...
510 views

### Why does list assignment with a packed array result in unpacked values?

Bug introduced in 5.2 or earlier and fixed in 10.1.0 This is another question on the design choices in Mathematica. I understand that without direct reply from the developers it may not be ...
1k views

### Visualisation of a recursive function

Is there a way to nicely visualize recursive functions? (diagrams/plots) More specifically I'm looking for a way to make contrast (visually) between e.g. the cosine function which if continuously ...
535 views

### Is there a bug in Pick?

I wanted to use the Pick function with a condition. But there seems to be an issue here. Take a look at this: ...
585 views

### Is the renaming mechanism of With flawed?

I'm confused about the renaming mechanism of With: ...
327 views

### Default behaviour of Hash[expr] and hashing in different versions of Mathematica

In different versions of Mathematica, Wolfram silently changed the behaviour of Hash when the algorithm is not specified explicitly ...
636 views

### Shorter syntax for Fold and FoldList?

I find it tedious to write out the following: a = {1, 2, 3, 4}; Fold[f, First @ a, Rest @ a] f[f[f[1, 2], 3], 4] It ...
400 views

### What is PointForm?

I stumbled across a function called PointForm but the only documentation I can find is the pop-up line offered by autocomplete, which contains the same information ...
812 views

### Applying And to lists of Booleans

I'd like to take {True,True,False} and {True,False,False} and apply And to get ...
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 ...
6k views

### How can I differentiate numerically?

Mathematica has two ways to integrate: Integrate and NIntegrate. But what about D? ...
4k views

### How to modify function argument?

Usually in programming languages, function arguments are normal local variables, which can be modified. Is this not true in Mathematica? ...
265 views

Observe: ...
223 views

### Strange behavior with Cases and Position with SetDelayed

I feel like I must be missing something simple and obvious here, but this has me scratching my head. This works as expected: ...
824 views

### Can someone explain this snippet: (#[#] &)[#[#][#] &]

A friend showed me this snippet of code today: (#[#] &)[#[#][#] &] I can sort of see that we're constructing an anonymous function that takes a function ...
1k views

### Accessing list elements by name

First, a bit of a long introduction to my problem: I only have a few weeks of Mathematica experience. I am creating a mathematica application that calculates some material properties of steel based ...
7k views

### Is there an equivalent to MATLAB's linspace? [duplicate]

Does Mathematica have an equivalent to Matlab's linspace? I want to make a list with "start", "stop" and "number of points". What is the neatest way of doing this?