# All Questions

73,521 questions
Filter by
Sorted by
Tagged with
118 views

### Error with String patterns producing Removed[“Failure”]

While working on How to capitalize the first letter of each word in a string and trying to understand why certain characters were not considered letters I tried this: ...
3k views

### How to capitalize the first letter of each word in a string

The following examples only work for the first character of the whole string, but not of words. ...
311 views

### Can't simplify Abs[a*Cos[x]]^2

Why doesn't FullSimplify[ Abs[a*Cos[x]]^2, Assumptions -> {{a, x} ∈ Reals}] simplify to (a*Cos[x])^2 but this query <...
445 views

### NDSolve: Reinitialize fails with If condition

I have found a weird problem using If conditions containing an state inequality of the form state<=. First consider the simple ODE with an If condition ...
344 views

### Possible bug with second argument of Dynamic

Bug introduced in V9 or earlier and fixed in V10 According to the documentation, Dynamic Details & Options section, especially: For interactive mouse operations ...
2k views

### How can I convert colors to grayscale?

I want to change the above colored plot into a grayscale plot. I have tried this: CCGray[pic_?ImageQ] := Module[{}, ColorConvert[pic, "GrayScale"]]; but it doesn'...
531 views

### Parallelize matrix operations

I'm trying to reduce to a minimum the time of some matrix operations. When I don't parallelize and write the code in the most compact form I get the operation done in around 1sec (is this good? the ...
126 views

### How to add a condition to a formula so that it will not appear at the result? [duplicate]

Sometimes I have very long and complicated equations, when I evaulate the equations for example taking derivative or integral there will be several conditions with the answer. My question is that; is ...
9k views

### Measuring execution time of code

How one can measure the execution time (time that is spent for code to finish) of a program in Mathematica? I understand that there are general timing functions (Timing, AbsoluteTiming, TimeUsed, etc....
516 views

### Controlling page breaks

I'm writing a bunch of cells to a new notebook nb and am trying to control the pagebreaks. That is, I want a pagebreak after each Length[listOef] number of cells. ...
217 views

### Locator with Integer value coordinates [duplicate]

I want to get the Pixel value of an image.and here is my code ...
2k views

### Relational joining of tables

A common thing to want to do with data is to combine it (at least I thought this was a common thing). In SQL there is the idea of table joins "select id,v1,v2 from A,B where A.id=B.id" kind of thing. ...
593 views

### Using NMinimize Properly

I'd like to find the point on a Bezier curve that's closest to some other point. The tricky thing is that because Bezier curves can loop around, the distance function can have multiple local minima ...
77 views

### Delete x,y,z occurrence (or any permutation of it) from parent data set (dynamically)?

Simple question: I would like to dynamically specify a list of 3 elements, {x,y,z}. Then I'd like to find that list, or any of its permutations, in a parent data ...
1k views

I am trying to solve a (Sequence) Quadratic Programming (SQP) problem in Mathematica. Here’s the problem setup: ...
208 views

### DirectAgglomerate not working for Large Matrices

I am trying to graphically display a distance matrix with similar elements visually clustered into groups. My original matrix has the elements in a random order so the first thing I do is to change ...
601 views

### The dangers of SaveDefinitions — should this really happen?

I have been bitten hard by SaveDefinitions -> True. I'll describe in detail what happened below. My questions are: Is this a bug? What is the most convenient ...
4k views

### Image segmentation and object separation in 3D using Mathematica

I currently work on an image segmentation scenario to detect cell nuclei in 3D using Mathematica. The data I have are image stacks in the TIFF file format. I would like to keep the sequence of image ...
1k views

### Poor quality Rasterize output when Background -> None

I am attempting to generate partially transparent images for PNG Export, but seem to run to the following issue. If I Rasterize ...
12k views

### Turn expression into function

I'm new to Mathematica and I spent the last hour trying to make the expression ...
359 views

### Wrapping grid with dynamic

I'm trying to build a sortable grid: ...
454 views

### How to prevent simplification of hypergeometric functions resulting from integrations?

Definite integrals from 0 to Infinity over a product of two hypergeometric (including exponential, trigonometric, hyperbolic, ...
65 views

### Simplify symbolic expression in terms of constants [duplicate]

Say I have an expression $a+b+a\times b$ and I define $c:= a\times b$. How do I get Mathematica to write $a+b+a\times b$ in terms of $c$, i.e. $a+b+c$?
652 views

### Print indexed (by subscript) variable name systematically

I have some variables : Subscript[S, 1], Subscript[S, 2]...etc. But they are defined in a for loop like For[g = 1, g < 4, g++, Subscript[S, g] = g]; Later, I ...
1k views

### Efficient priority queues?

I'm trying to figure out how to transfer the concept of a priority queue to the functional world. Searches have turned up some implementations that use Append and other expense list copying techniques....
296 views

### fit recursive function to data

I have a function $g(x, n)$, which is a recursive expression: $x$ is a variable and $n$ the number of iterations. In my case $n=3$ for all $x$. An example is the following: ...
997 views

### How to make dynamic input fields work with drag & drop

I have an application using InputField to allow a user to dynamically update a data structure. In some cases the user will want to remove a string from one field ...
879 views

### How can I highlight and individually color the connected components of a graph?

I have a graph G, and I wish to individually highlight and color the different connected components of a graph. It is simple enough to do this for one component: <...
134 views

### Append CellTag to list of Cells

As suggested in this earlier post, I restate my question here about appending CellTags option to existing list of Cells. What I ...
218 views

The solution and plot of the Differential equation is $\frac{d^2S(r)}{dr^2}+\frac{1}{r}\frac{dS(r)}{dr}-S(r)+3S^3(r)=0$ ...
160 views

### SetOptions and Cell

I'm trying to change the CellLabel of Cells using SetOptions[Cell, CellLabel -> "test"] or ...
4k views

### Show density plot on a geographic map

I have a bunch of data points in the form of {latitude, longitude}. How can I plot their density on a US map? Single points on the map do not clearly show their ...
169 views

### Why the EuclideanDistance of these 2 exact points generates the warning N::meprec?

The two points are: pts = {{1/4 (-1 - Sqrt), Sqrt[5/8 - Sqrt/8]}, {1/4 (-1 - Sqrt), -Sqrt[5/8 - Sqrt/8]}}; EuclideanDistance @@ pts N::...
156 views

### How can I execute a sequence of statements interactively?

I'm fairly new to Mathematica. Suppose I have the following function: f[x_Integer] := Module[{y, z, r}, y = 5; z = 10; r = x + y + z; r ]; and I ...
866 views

### WaveletScalogram in polar coordinates

For given dataset data = Re[Zeta[1/2 + I Range[0, 100, 0.01]]]; It is nice that Mathematica can plot data in both Cartesian and Polar coordinates. ...
283 views

### Change values in string under condition

how to change the width and height in the HTML code into some other values decided by ratio and a fixed width? The background is that you can adjust a image in ...
116 views

### HoldForm and RandomChoice

I'm trying to get random expressions displaying. For that, I'm starting with addition, multiplication, substraction and division. When trying out this code ...
7k views

### Implementing a dictionary data structure

As one learns from a course on data structures, hash maps or dictionaries can be efficient when applied to appropriate tasks. I need a hash map in Mathematica and I've never found it. I'm scratching ...
292 views

### Need better font control [duplicate]

Generally many programs have a menu item to raise/lower current font size. This is much more convenient than trying to root around in in internal mathematica options. I need to change ALL default ...
954 views

### Do Mathematica notebooks include personal metadata?

I am about to send a Mathematica notebook to someone and I would like to make sure it does not contain any information that could personally identify me. I would also like to produce pdf files from ...
819 views

### Clearing memory of a subkernel in a Do loop

I have a Do loop, which saves data directly to a .txt file. However when I leave it running for long periods of time the RAM ...
394 views

### LogPlot of the calculated data in For Loop in Mathematica

I have the following loop, for calculating a data for different values of inputs. How I can plot the result at the end of For loop? Its not matter if the plot is inside or outside the loop, I just ...
3k views

### plotting the solutions of system of differential equations [duplicate]

The following code include the system of differential equations: ...
140 views

### Strange response with dynamic texture and MousePosition

I built a cubic, then use MousePosition together with GUIScreenShot to take a floating region with fixed size (200*200) on the ...
130 views

### How to make a function work on symbols in a specific context

Let us say we have two sets of symbols $(x, y, z)$ with the same names that live in two different contexts: ...
1k views

### SparseArray row operations

Given a large (very) sparse matrix, A, how can I efficiently "operate" on only the nonzeros in a given row? For example: For each row in A, generate a list of column indices that have a magnitude (...
481 views

### Sort a list of coordinates by frequency from first component of each coordinate

The situation is that I have a List like this: ...
162 views

### Indicating the axes [closed]

I want to scale the $x$ axis of the plot by $x^0$ and the $y$ axis by $\tan x$. Is this possible ? Plot[Tan[x], {x, 0, 10}, PlotRange -> Automatic] EDIT: ...