# All Questions

381 views

### Why doesn't PatternTest work with Composition?

While playing around with the solutions to this question, I've found some very strange behaviour: ...
4k views

### Finding unit tangent, normal, and binormal vectors for a given r(t)

For my Calc III class, I need to find $T(t), N(t)$, and $B(t)$ for $t=1, 2$, and $-1$, given $r(t)=\{t,t^2,t^3\}$. I've got Mathematica, but I've never used it before and I'm not sure how to coerce ...
1k views

### How to “Copy as Unicode” from a Notebook?

I spent some time manually editing a post replacing Mathematica ASCII \[Alpha] with Unicode α. I did this by laboriously ...
4k views

### ListPlot with each point a different color and a legend bar

I would like to generate a ListPlot with the color for each point in the plot corresponding to a particular value (not associated with the position in the plot). I'd then like to add a legend ...
7k views

### How do I clear all user defined symbols?

Is there some way to do this other than going to Evaluation -> Quit kernel and firing a new one up?
879 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 ...
643 views

### Define parameterized function

I would like to be able to define the gain function of a system from its parameters. Specifically, I'd like to define a function that accepts two inputs, call them $b$ and $w$, and returns a function ...
3k 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 : ...
3k views

### How to specify assumptions before evaluation?

If I request mathematica evaluate an integral for me, I'll often get a more general ConditionalExpression than I want. Example : ...
1k 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

### Performance tuning in Mathematica?

What performance tuning tricks do you use to make a Mathematica application faster? MATLAB has an amazing profiler, but from what I can tell, Mathematica has no similar functionality.
1k views

### Mathematica Destructuring

Context I'm writing a function that look something like: ...
1k views

### How to abort on any message generated?

Mathematica is a bit unusual as a programming language because it never stops on messages, regardless of whether the message is an error, a warning or just an informative message. It simply prints the ...
723 views

### Transferring a large amount of data in parallel calculations

This question is inspired by one of @whuber's answers Consider the following code: ...
618 views

### Using pure functions in Table

I need a table with the elements made of pure functions and list elements. This is a simplified example: I need a list as: ...
2k views

### How can one find undocumented options or option values in Mathematica?

Mathematica has a lot of undocumented or poorly documented options. How does one go about working out if there is an undocumented option that might solve a particular problem? How does one work out ...
3k 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 ...
2k views

### InternalBag inside Compile

Since InternalBag, InternalStuffBag and InternalBagPart can be compiled down, it is a ...
6k views

### How can this confetti code be improved to include shadows and gravity?

Here's some confetti: ...
1k views

### Functions vs. patterns

Every time I define a new function, I wonder which construct I should use: true functions obtained by using Function, or rule-based syntax. For example, these are ...
6k views

### How to find all the local minima/maxima in a range

I want to find : all local maxima in range all local minima in range From those points I can interpolate and combine functions upper and lower boundary. What I am really interested in, is the ...
1k views

### How can I implement dynamic programming for a function with more than one argument?

Dynamic programming is a technique for avoiding the repeated computation of the same values in a recursive program. Each value computed is immediately stored. If the value is needed again, it is ...
1k 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 ...
442 views

### Replace inside Held expression

I wish to make functional replacement inside Held expression like this: ...
1k 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 ...
493 views

### How to inject an evaluated expression into a held expression? [duplicate]

I know that there are methods to structurally manipulate held expressions (discussed e.g. here), but I failed to apply those for this particular problem: ...
3k views

### How do you convert a string containing a number in C scientific notation to a Mathematica number?

Suppose I have a string containing the C-representation of a floating point number, for example s = "1.23e-5" and I want to convert this to a Mathematica number. ...
2k views

### How to avoid returning a Null if there is no “else” condition in an If contruct

I need to use If but with only one option that is if "a" then do "b", else do nothing. So I wrote If[a,b] but the problem is ...
488 views

### How are parameters evaluated for a Plot in Manipulate

I am trying to get my head around how Manipulate evaluates functions in a Plot. I have read the introduction to Manipulate, and introduction to Dynamic, but I still ...
620 views

### Using a list of tuples in a pure function

I want to use a list of tuples within a function to make assignments. Say I want to make assignments of the form value[i,j] = val What I have is a list of ...
2k views

### Functional style using lazy lists?

Let's say I want to answer the question "what are the first 400 palindromic prime numbers?" The first approach that comes to my mind from the set of languages that I know is to use some sort of lazy ...
1k 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 ...
842 views

### Automating Esc [[ Esc formatting?

Is it possible to program the Front End to automatically format double square brackets without having to type Esc[[Esc each time? It's awful to have to type Esc ...
1k 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 ...
368 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 ...
742 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 ...
1k views

### Does Mathematica support variable frame rate for any video format, in analogue of GIF-style “DisplayDurations”?

The good old GIF animation format allows us to set the duration of each individual frame in the animation separately. This is especially useful if some frames in ...
467 views

### Common subexpression from two expressions

I am working with some unpleasantly tedious polynomials, which need to be manipulated in various ways (integrate with respect to some variable, differentiate with respect to another). Since these ...
2k views

### Replacing composite variables by a single variable

To replace a single variable by another variable, one can simply use the the replace all (/.) operator (e.g., ...
3k 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 ...
1k views

### Open-source IntelliJIDEA plugin to support Mathematica development

Although we already had a question asking for development alternatives to Wolfram Workbench, I want to ask a more specific question: One of the most advanced IDE's especially for Java programming ...
3k 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 ...
626 views

### How to avoid nested With[]?

With[ {v1 = #}, With[ {v2 = f[v1]}, g[v1, v2] ] ] How to avoid nested With[] like the above? I'd like to use ...
10k views

### Labeling individual curves in Mathematica

I need to create a plot for export and inclusion in a report. Is there a better way to label curves than PlotLegends? From what I've read and my personal ...
1k views

### Once more on object orientation in Mathematica: does it have to be so hard?

Recently I came across a set of problems which would be solved most easily within an object-oriented approach. I first attempted to solve them by other means, but found the complexity of the code ...
2k views

### Creating Mathematica packages

I'm building a package to help me write packages and their documentation. In this post I explained how to make a package and its documentation. In the answer I provided I describe how to build a very ...
2k views

### Filling a polygon with a pattern of insets

I am trying to fill a shape with diagonal lines. I am aware of Texture, but it rasterizes the fill pattern, which is not desirable. Here was my crack at it: ...
1k views

### How to efficiently find positions of duplicates?

Is there an efficient way to find the positions of the duplicates in a list? I would like the positions grouped according to duplicated elements. For instance, given ...