# Tagged Questions

Questions on correct (or improved) formulation of Mathematica code to achieve particular results. Use this tag (not "symbol") for questions about all those odd @@ /@ # & and ~ characters.

322 views

### Where did I go wrong with my implementation of the trapezoidal rule?

One method for doing quadrature, called the trapezoidal rule, improves accuracy by connecting the points on the curve corresponding to the points of subdivision with line segments, forming trapezoidal ...
175 views

### Shortcut for Range[]?

I use Range a lot. Is there any syntactic shortcut for it, or do you always have to spell it out?
117 views

### Passing f[x][[1]] to FindRoot [duplicate]

FindRoot seems to fail for most examples of the form f[x_?NumericQ] := {x - 3 , x^3}; FindRoot[f[x][[1]], {x, 3}] ...
90 views

### Syntax for FrontEndSelectionSetStyle

I know FrontEndSelectionSetStyle is undocumented, but its name suggests it does what I need. What is its syntax? I have already tried several variations of the ...
101 views

### Is it possible to use a mathematical expression as function name?

This might seem as a silly question, but is it feasible to use a mathematical expression as the name of a function? For example, I'm studying the cross section of Compton scattering and there is a ...
118 views

### Help with writing a polynomial series [duplicate]

I want to write and evaluate an expression something like Sum[x[i] Product[y[j], {j(!=i), 1, n}], {i, 1, n}] but with correct syntax, where n is a any number ...
98 views

### Where does Documentation Center introduce the basics?

While helping a user who mistakenly thought that log rather than Log was the correct built-in function name, I included a ...
191 views

### Levels and slots

I am struggling with levels and #, if I understand this I think I will be able to grasp the entire concept. ...
292 views

### Manipulate, Import external table, save as CDF, mail presentation

For my work I do data analysis. Most of these analysis are done on big databases with milions of records. I would like to make a manipulate (or animate) using a external dataset and create a CDF ...
259 views

### HoldForm[Operator ##] on some list

Recently in response to this question Mr.Wizard suggested an unusual way to summing numbers. This doesn't seem to be documented. ...
3k views

### Guidelines on giving readable names to variables [closed]

I know that one cannot use underscore to a variable name, like degree_of_The_First_Polynomial. But for a long variable name, it ...
150 views

### The /. syntax in numerical methods [duplicate]

I have an analytical approximation method for solving an ODE and want to compare this to an NDSolve solution, but the syntax is confusing me. To get the solution from NDSolve, I define the ODE as eqn ...
926 views

### How is + as an infix operator associated with Plus?

How is + associated with Plus? Suppose I want to define a head FooBar and have it ...
353 views

### Can someone explain this code for joining two lists by the first element of each sublist?

Background (which may be skipped, unless context is needed) I've recently begun learning Mathematica (and only up to chapter 3 of Wellin), but wanted to write some code to get a better feel for ...
204 views

### Constraint syntax compaction

Is there a more compact way to represent these constraints: NMaximize[{a+b+c,...
270 views

### Infix form of PutAppend ( >>> ) does not work with variable

I'm new to Mathematica, so I suspect this question involves either a misunderstanding involving variables or the usage of >>>. On a webMathematica page ...
308 views

### Writing a function that returns a (usable) function

I am trying to create a function that returns Arnold's Cat Map of size n iterated k times. I can get something out of the Function command, but I can't figure out ...
762 views

### What is the right way to construct DynamicModule

When I'm creating DynamicModules for CDF purposes I'm usualy basing on my experience with that, particular goal and content rather than on deep insight. I want to ...
76 views

### Why do two codes give different output?

I have tried the following to get the eigenvalues of several matrices of the type: ...
79 views

### Constructing an Array from typed expression

I want to produce an array from expressions given by test[one][1] = 3; . . test[one][5] = 7; etc. Normally would use ...
114 views

### How to make InverseFunction work on function defined with restriction on arguments

This example works to define InverseFunction on the first argument of a function ...
261 views

### Overlapping pure functions

Let say I need and option for Plot: RegionFunction -> (-6 < #2 < 6 &) But I also want those ...
384 views

### Split dataset based on the first column [duplicate]

I have a dataset which I want to split based on the first column. The data looks like this ...
160 views

### Equation values into list

Suppose I have a function say $f=x^2$. What I would like is a list (or even better, a list with a grid) which resembles {{1,1},{2,4},{3,9}, ...}. Ideally one should ...
881 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 ...
175 views

### DeleteCases vs. DeleteDuplicates for removing points within a critical Euclidean distance

I'm attempting to remove all points in an array which are within a Euclidean distance "ThresDist" of one-another. Using the command: ...
590 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 ...
379 views

### How to get 'exact' expression for result

I have a result from Mathematica for which want to have the exact expression, i.e. all of the arguments of type # replaced. It is given by: ...
201 views

### Correct usage of GeoPosition

My goal is to trace a ray down to the ground. I have done: ...
185 views

### Shortening the syntax {var1, var2} /. # & /@ list

I noticed that I often turn out to have a list of substitutions in the form ...
171 views

### Extracting counts of contiguous zeros and ones from a binary array

I'm a novice with Mathematica, but you guys have been very helpful to me in the past. I have a binary array [100, J repetitions] consisting of zeroes and ones. I'd like to extract a histogram of the ...
233 views

### Bincounting a list

I'm a Mathematica novice here. I'm trying to execute the following code to add random 1's into a zero matrix, repeat this many times, and then bin/histogram the number of nearest neighbor 1s. Can ...
105 views

### Export file with semicolon at the end of line

Is there a rule that tells Mathematica to set a semicolon at the end of each line (except of the last one)? My MWE is: ...
1k views

### What do the hashtags represent in the result of Solve, and how should I use them? [duplicate]

There is a function that I'm trying to get the inverse of. My function is a simple polynomial: Tn[T_] := 4/9 T^3/Tc^2 + 5/9 T Now I tried to find ...
327 views

### How to convert an image to a compressed string representation equivalent to one copied to clipboard by CopyToClipboard[image]?

In my recent question I asked How to embed an image into a string? The suggested solution was ...
648 views

### How to create custom Graphics primitive?

How to create custom Graphics primitive? It should have the following properties, resembling properties of built-in geometric figures, like ...
539 views

### How to embed an image into a string?

Note: The bug described in the post is in Mathematica 9, and has been fixed in 10.0. The documentation for String contains the following statements: Strings ...
417 views

### Is it possible to define custom compound assignment operators like ⊕= similar to built-ins +=, *= etc?

I would like to do something like this: ...
622 views

### What does  symbol in ClearAll[“Global*”] mean?

I have found an example for clearing all symbol definition by: ClearAll["Global*"] But what does the symbol  mean? It isn't the apostrophe ', yet it is not ...
425 views

### NonLinearModelFit with Two Dimensional List of Weights

I'm currently trying to fit Planck's law (B[λ, T]) to measurements, thereby determining Planck's constant. I have a list of triplets containing wavelength, ...
213 views

### Pattern match with Table for matrix dimension check

In Mathematica, often an expression involving matrices will encounter dimension mismatch errors, like we are multiplying a 3x2 matrix to a 3x4 matrix. Below we define a new symbol Dim, which can be ...
436 views

### What kind of hypergeometric function is it?

I found a formula for an integral of a product of three Bessel functions at The Wolfram Functions Site: I cannot understand what kind of hypergeometric function it is. The Mathematica code given ...
137 views

### Filtering the elements of an array to split them into two categories

So, I am new to Mathematica, and I am trying to write something that involves taking values from one array and separating them into two different arrays. My code for doing this is: ...
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 ...
672 views

### What is wrong with this Cobweb plot [closed]

Something is wrong with my cobweb plot code but I couldn't figure out where do the mistakes come from. So basically we have the iterative map $x_n == x_{n-1}^{2} - 3 \mu$. I would like to draw a ...
166 views

### Different behaviours of Default Argument

I don't really understand the behaviour of Default Argument. If I execute this command in Mathematica: In: {f[a], f[a + b]} /. f[x_ + y_.] -> p[x, y] ...
249 views

### Using single replacement rule to convert algebraic expression

I have been trying this problems for hours and cannot find any helpful clues. How can I convert $Sinh[3\theta]+Sinh[\theta]$ to a rational function of x given $2Sinh[\theta] = x-x^{-1}$ by using only ...
261 views

### Solve this equation symbolically

I am trying to solve the equation for the quantity r = y/x symbolically: 3/y^4 == 3/x^4 + a/(x + 2 y)^4 with the requirement that we need to perform the ...
Say I want to integrate 1/(x^2+a^2) and I want Mathematica to know that $a>0$. What would be the command? Something like: ...