# All Questions

127 views

### Why LinearModelFit is slower than NonlinearModelFit?

Why LinearModelFit is slower than NonlinearModelFit? ...
204 views

### Solving stochastic master equation

Can someone help please me in solving the following stochastic master equation for the density matrix $\rho$? where $\rho$ is the density matrix, $\sigma_i$ are the pauli matrices, $dt$ is the ...
273 views

### How to find monotonically increasing intervals of a function

I tried this code, but not working Clear[f]; f[x_] := x^3 - 3 x + 2; ForAll[{x1, x2}, x1 < x2, f[x1] < f[x2]] Reduce[%, {x1, x2}, Reals] I expected the ...
184 views

### How to reduce the number of operations needed to evaluate an expression? [duplicate]

For some numerical calculations in C++ I have, for example, this complicated expression to evaluate. Given as Mathematica input, in its original form it is ...
288 views

### ListPlot with PlotRange -> Automatic giving unexpected results in V.9

There seem to be a problem with ListPlot auto ranging in Mathematica 9. Here's my code: ...
271 views

### Add blank line before end of file with export

I have a list of points (e.g. {1.2,0.4}) which I export to a file using ...
113 views

### ParallelTable of ParametricNDSolve objects fail

There seems to be a problem with ParametricNDSolveValue togeteher with ParallelTable First we create a ParametricNDSolveValue object ...
90 views

### how to extract a subinterval from a previous element in a list (in condition) [closed]

question: i need to use mathematica to write an intermediate value theorem's algorithm, but i don't know how to write in a module form... i have a function and then, we need to set up a range and ...
136 views

### ParametricNDSolve: Fails to differentiate an matrix differential equation

It seems like there is a problem with differentiating a ParametricNDSolve object when the underlying system contains an matrix differential equation. Create a simple ParametricNDSolveValue object ...
417 views

### Sum[expr,{i,0,Infinity}] for power series of cumulative normal distribution gives exponential function?

The Taylor series (about 0) for the cumulative normal distribution has coefficients: ...
2k views

### Labeling points of intersection between plots

There are several answers where Mathematica used mesh points to show graphically where curve intersections exist. For example: Marking points of intersection between two curves or Is there a better ...
107 views

### How to copy groups of cells with NotebookWrite?

I'm trying to use: NotebookWrite[nb, NotebookRead[EvaluationNotebook[]]; to copy cells from the EvaluationNotebook[] to a new ...
137 views

### Import audio in uLaw format?

How do I import a uLaw-format audio file into Mathematica? Here's an example: hello-world.ulaw For reference, here's the same file in wav format: hello-world.wav As I understand it, the uLaw ...
132 views

### Show Simplified Directives [closed]

Is there a way to force Mathematica to convert an already rendered Graphic to the simplified Directive form of that Graphic. Background: I am currently editing Graphics using Drawing Tools and then ...
167 views

### Protecting function definitions only for particular inputs

I would like to be able to define the values of a particular function for new inputs. f[x1]=f1; f[x2]=f2; I would also like to be able redefine the values for ...
102 views

### How to suppress automatically generated header in packages?

At the top of the .m file which is automatically generated from initialization cells in a notebook there appears a header: ...
968 views

### Convolution of two distribution functions

I have two functions; f[x_] = (1/k) Exp[-x/k] ; g[x_] = (1/p) Exp[-x/p] ; How I can convolve them? In Mathematica for convolving two functions we have this ...
177 views

### OpenSQLConnection problem - password visible

Prerequisites some database (here, it's called sakila (mysql standard test db I think)) a user (with password) that has access to that db (I'll use u:testuser/p:testpass) Setup - minimal (?) ...
227 views

...
296 views

### How can I find English words among the names of the characters in the Mathematica character set?

I want to find some single meaningful words in the "ASCII/Unicode" form characters. For example, I want to get alpha from ...
68 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: ...
474 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. ...
244 views

### Apply a function to a matrix of vectors [closed]

I have a matrix containing on each position a pair of numbers $(a,b)$. I would like to compute the norm of each vector $(a,b)$ and keep the result in form of a matrix. So basically, I need to apply ...
184 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 ...
167 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 ...
254 views

### Possible bug with second argument of Dynamic

According to the documentation, Dynamic Details & Options section, especially: For interactive mouse operations Dynamic[expr,{f_start, f, f_end}] typically ...
651 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 ...
100 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 ...
92 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 ...
1k 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, ...
174 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. ...
95 views

### Locator with Integer value coordinates [closed]

I want to get the Pixel value of an image.and here is my code ...
524 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. ...
168 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 ...
57 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 ...
564 views

I am trying to solve a (Sequence) Quadratic Programming (SQP) problem in Mathematica. Here’s the problem setup: ...
118 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 ...
331 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 ...
2k 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 ...
371 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 ...
125 views

### Solve differential equation with undetermined constants making the assumption that the constants are positive

I want to solve: eqn = D[f[w], {w,2}] + (3/2 c^2 k Exp[c w] - 9/4 c^2 k^2 Exp[2 c w]) f[w] + m^2 f[w] sol = DSolve[eqn == 0, f[w], w] with the assumption ...
726 views

### Turn expression into function

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

### Importing a stack of images [closed]

I have a stack of images with the file names C0001996_0000 , C0001996_0001 etc. In total I have $600$ images. I would like to ...
169 views

### Wrapping grid with dynamic

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

### Defining extra boundary conditions for NDSolve?

I have a second order reaction / diffusion type ODE of the form $\frac{D_{o}}{r^2} \frac{d}{dr}\left(r^2 \frac{dC}{dr} \right) - \frac{aC}{C+k} = 0$ where $a, k$ and $D_{o}$ are constants and $C$ is ...
142 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, ...
50 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$?
197 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 ...
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: ...