title: Why are PlotLegends not combined with Plots?

text: I'm using `PlotLegends` in v9. It seems that in the documentation examples, plots and legends are combined into one graphic: Here's an example from `LineLegend` in the documentation:               Plot[{Sin[x], Cos[x]}, {x, 0, 5}, PlotLegends -> LineLegend["Expressions"]]      Which outputs this (notice how the legend is selected within the graph): ![enter image description here](http://i.stack.imgur.com/FHJK6.jpg) However, if this same line is evaluated by me, it becomes this: ![enter image description here](http://i.stack.imgur.com/qHYSu.jpg) Is this default behavior? Did Wolfram put graphics in place of output for their documentation? If this is default behavior, can they be combined without creating a rasterized image? **UPDATE:** It turns out that _Mathematica_ documentation sometimes contain rasterized images for output which was causing the initial confusion. The main point of the question is the behavior of the `Legended` (and related) function and exporting images with it included. The context menu and `Export` command treat this different.


title: How can I convert colors to grayscale?

text: ![](http://i.stack.imgur.com/wtlqF.jpg) 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't give me the degree of differentiation I would like.


title: Know the degree of the equation with the radicals expanded

text: I have an equation with radicals. I would like to know what would be the degree of the polynomials if I'd move the terms and square the equation a number of times sufficient to remove all the radicals. How could I achieve this in Mathematica? Practically, in the following equation nu12==0 I would like to know the degree of t once all the radicals are removed               C1 := c1*Cos[phi + xi1] - b*Cos[psi1] - ox1     D1 := c1*Sin[phi + xi1] - b*Sin[psi1] - oy1     oneToTwo := {c1 -> c2, xi1 -> xi2, psi1 -> psi2, ox1 -> ox2, oy1 -> oy2}     C2 := C1 /. oneToTwo     D2 := D1 /. oneToTwo     hcd = (C2^2 - C1^2 - D1^2 + D2^2)/(2*(D1 - D2))     numcd = TrigExpand[     Numerator[Together[Simplify[C1^2 + (hcd + D1)^2 - a^2]]]]     cogamma = c2*Sin[psi1]*Cos[phi + xi2] - c1*Sin[psi1 - phi - xi1]     sigamma = c2*Sin[phi + xi2]*Sin[psi1]     Weier := {Sin[phi] -> (2 t)/(1 + t^2), Cos[phi] -> (1 - t^2)/(1 + t^2)}     nu12 = TrigExpand[Numerator[Together[      numcd /. {Sin[psi2] -> sigamma/Sqrt[sigamma^2 + cogamma^2],         Cos[psi2] -> cogamma/Sqrt[sigamma^2 + cogamma^2]}]]] /. Weier


title: Solving an equation involving a determinant

text: I have a matrix which doesn't include numerical values. There are four variables in it. It is defined by               M1 = ({           {κ0  BesselJ[m, κ0 R],            q BesselI[m, q*R],             q1 BesselK[m, q1*R],            q2 BesselK[m, q2*R]},           {((F1 /. L -> L1) - E1 + N1*κ0^2)*BesselJ[(m + 1), κ0*R],            ((F1 /. L -> L1) - E1 - N1*q^2)*BesselI[(m + 1), q*R],            -((F1 /. L -> L2) - E1 - N1*q1^2)*BesselK[(m + 1), q1*R],            -((F1 /. L -> L2) - E1 - N1*q2^2)*BesselK[(m + 1), q2*R]},           {κ0^2 BesselJ[(m + 1),            κ0*R], -q^2 BesselI[m + 1, q*R],            q1^2 BesselK[(m + 1),            q1*R], q2^2 BesselK[(m + 1), q2*R]},           {((F1 /. L -> L1) - E1 + N1*κ0^2) κ0*BesselJ[m, κ0*R],            ((F1 /. L -> L1) - E1 - N1*q^2) q*BesselI[m, q*R],            ((F1 /. L -> L2) - E1 - N1*q1^2) q1*BesselK[m, q1*R],            ((F1 /. L -> L2) - E1 - N1*q2^2) q2*BesselK[m, q2*R]}          });          Det[M1] = 0      I want to get the formula for E1 in terms of the other variables and constants. I used `Solve`, but it didn't work. Can anyone please help me? Really appreciated.


title: Linear equation with complex numbers

text: I have to solve an equation of the type $$a z+b \overline{z}=c$$ with $a,b,c\in\mathbb{C}$. My approach is to set $F(z)=a z+b \overline{z}-c$ transform $z$ to $x+i y$ and then get a real linear system by assuming $x,y\in\mathbb{R}$ and solve $$\frac{F(x+i y)+\overline{F(x+i y)}}{2}=0$$ $$\frac{F(x+i y)-\overline{F(x+i y)}}{2i}=0.$$ My problem is that this has to happen a lot for a program that I am writing and I was wondering if there is a faster way to do that. It would be ideal if mathematica can solve these linear systems directly.


title: octopress plugin for CDF reader?

text: I am looking for a way to embed CDFs in octopress blogs. Looks like there are a lot of moving parts such as Jekyll, Liquid, and Pygments. I'd be grateful for a native trailguide through the jungle.


title: What's a non-trivial Mathematica program involving conscious choice of stack vs. queue data structure?

text: In a typical computer science algorithms course, much attention is given to the discussion of queues vs. stacks as a data structure programmers need to consciously choose from to achieve algorithmic performance. What's a good Mathematica program example that also involves (explicitly) choosing data structures? Most of these "implementation details" or algorithmic design tactics is automated in a black box fashion by Mathematica's Automatic idiosyncrasy.


title: RowReduce: Solving for the resource vector (a, b, c) in Augmented Matrix

text: Here are two examples:               RowReduce[{{3, 1, a}, {2, 1, b}}]      evaluates to               {{1, 0, a - b}, {0, 1, -2 a + 3 b}}      but               RowReduce[{{1, 2, 3, a}, {4, 5, 6, b}, {7, 8, 9, c}}]      evaluates to               {{1, 0, -1, 0}, {0, 1, 2, 0}, {0, 0, 0, 1}}      The result is independent of `a`, `b` and `c`. Since I want to know the steps of reduction, I add `a`, `b` and `c` for bookkeeping. But it does not work in the second example. Is anything wrong or is any way to keep track of the steps of reduction?


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

text: Why doesn't               FullSimplify[ Abs[a*Cos[x]]^2, Assumptions -> {{a, x} ∈ Reals}]      simplify to               (a*Cos[x])^2      but this query               Simplify[ (a*Cos[x])^2 == Abs[a*Cos[x]]^2, Assumptions -> {{a, x} ∈ Reals}]      yields True? I'm using _Mathematica 8.0_.


title: Non-descending Tuples

text: I want to get all the non-descending tuples of a list with given length, for example:               f[{1,2,3,4},{3}]      > > > {{1,1,1},{1,1,2},{1,1,3},{1,1,4},{1,2,2},{1,2,3},{1,2,4},{1,3,3},{1,3,4},{1,4,4}, >      {2,2,2},……,{4,4,4}} >   A function lies between `Tuples` and `Subsets` to some degree. Is the an efficient way to achieve this? (It should be general for all kind of elements, like `Tuples`, not specifically for `Integers`.)


title: Interactively Manipulate SparseArrays or Lists

text: I'd love to use `SparseArray`or `List` to group a set of parameters together in a function.               params[a] = 5;     params[b] = 6;          AFunction[p_] := p[a] * p[b]      If I however want to create a manipulatable entry in the array, it doesn't work:               Manipulate[params[c], {params[c], 0, 50}]     Manipulate::vsform: "Manipulate argument {params[c],0,50} does not have the correct form for a variable specification."      The same thing for a "normal" value works as intended:               Manipulate[c, {c, 0, 50}]      The Mathematica 10.0 documentation states, that Manipulate should be able to interactively transform any expression. I also tried it with `With`, which leads to the same error. Is this straight not possible, or am I doing something wrong. How do you handle big manipulatable parameter sets?


title: Computing the minimum number of terms required in a Fourier series to achieve a particular upper bound on the error

text: In a Fourier series, the maximum error bound is the difference of the function and the partial sum of its Fourier series. Within an interval, as we increase the number of terms of partial sums, the error decreases. $$e(x) = \left|f(x) − s(x)\right|$$ How can I determine the number of terms needed to calculate the partial sum so as to have a specific maximum error bound? For e.g $|e(x)| ≤ 0.01$ or $|e(x)| ≤ 0.001$ For example in a typical question, $f(x)$ defined as $$f (x) = \begin{cases} 0 &−3 \leq x \leq 0\\\ x^2(3 − x) & 0 < x < 3 \end{cases}$$ is a periodic function with period $6$ i.e., $f (x + 6) = f (x)$   * Plot $|e(x)|$ versus $x$ for $0 ≤ x ≤ 3$ for several values of $m$.   * Find the smallest value of $m$ for which $|e(x)| ≤ 0.1$ for all $x$. Constructing the Fourier series for this periodic function and plotting $|e(x)|$ versus $x$ for several partial sums like $m = 5, 10, 20$ is easy. It can be accomplished by `DiscretePlot`. How can I find the smallest value of $m$ (i.e., the number of terms needed in the partial sum to achieve a specific error bound)? I use Mathematica 6 and 7.


title: Reduce/Solve an equation with symbols in powers

text: I am trying to solve the following equation with respect to `x`.               eqn = x^z + y == a;      But when I do               Reduce[eqn,x]      mathematica doesn't solve at all. I guess this is because of symbolic expression in powers. If I replace `z` into some numeric values, mathematica works immediately. I was wondering what I am missing with this.


title: When running Mathematica from a Linux terminal, how can I prevent a script from terminating upon logout?

text: I am running Mathematica on a remote Linux cluster, by the terminal, using the `math` command. (I do not have access to a terminal GUI. For example, when I type the command `mathematica`, I get this error message: `Can't open display ""`.) I write Mathematica code in a text file (e.g., `test.txt`) and pass it to `math` using either the command               math < test.txt      or the command               math -script test.txt      Both of these methods work fine for starting a Mathematica job. However, when I log out of the terminal -- or even when a brief loss of internet connection interrupts my connection to the remote cluster -- the Mathematica script is terminated. When I log back in the terminal, no Mathematica processes (i.e., `MathKernel`) are running. To prevent this termination upon logout, I have tried using the standard Linux program `nohup`, which is a command telling the terminal to ignore the `HUP` (hangup) signal; output is redirected to a file `nohup.out`. I use `nohup` with any of the following commands:               nohup math < test.txt      or               nohup math < test.txt &      or               nohup math -script test.txt      or               nohup math -script test.txt &      These commands **all** _start_ the Mathematica job fine, but when I logout and log back in to the terminal, no `MathKernel` or similar processes are running (as verified by `ps` and by `ps -u myusername`). The situation is the same regardless of whether my job is a single kernel job or a parallel, multikernel job. Since the jobs _start_ fine -- including those ending with the `&` symbol to force the job to the background -- I do not think that I am having the same "background job suspension" problem as in this question. Do you have any thoughts on how I can prevent the terminal from terminating jobs when I logout or my connection is briefly interrupted? The `nohup` method above works for me with other programs, but for some reason not with Mathematica. (A toy test example is `Table[Length[FactorInteger[10^50 + n]], {n, 50}]`, which takes about 30 seconds on the terminal.)


title: Custom mesh in ListPlot3D

text: I have the following data:               bData = {{0.05, 0, 3.0198054316361485}, {0.05, 0.55,       1.1092237487369552}, {0.05, 1., 0.835126287487935}, {0.05, 1.61,       0.3647962208597364}, {0.1, 0, 2.991741037155516}, {0.1, 0.55,       1.1270688044265789}, {0.1, 1., 0.8493688576645464}, {0.1, 1.61,       0.5932718812318991}, {0.15, 0, 2.8183386248853517}, {0.15, 0.55,       1.6096377385996246}, {0.15, 1., 1.1088595437185633}, {0.15, 1.61,       0.5368907021939747}}      I plot my data as follows:               p1 = ListPointPlot3D[bData, PlotStyle -> PointSize[Large]]     p2 = ListPlot3D[bData, MeshStyle -> Red, PlotStyle -> None,        Mesh -> All, InterpolationOrder -> 1(*,ClippingStyle\[Rule]None*),        PlotRange -> All]     Show[{p1, p2}]      What I want to achieve with this is to show the data points clearly and also connect them in the x and y direction with simple lines. I have done the following ![Output1](http://i.stack.imgur.com/sORYG.png) ![Output 2](http://i.stack.imgur.com/Xus1d.png) ![Output 3](http://i.stack.imgur.com/6auV6.png) I would like to remove all the diagonal lines and just connect the points in the x and y directions. If I do `Mesh->Full`, I get the following: ![Output 4](http://i.stack.imgur.com/D7C66.png) Is there also a way of marking the vertices, without having to superpose two different plots? That complicates the labelling and legending I also want.


title: How to catch an interrupt (Control-C) in a script?

text: If a user hits Control-C when a script is running, they get an `Interrupt>` prompt, where they have to type `exit` or `quit` to return to the shell. I'd like to have the interpreter exit immediately when Control-C is hit. To this end, I'd like to catch the interrupt and run `Exit`. Is there a way to do this? Or is there a better option?


title: LocatorPane, selecting multiple Locators

text: Consider the following snippet                 pts = RandomReal[1, {3, 2}]       g = Graphics[{Polygon[Dynamic[pts]]}, PlotRegion -> {{0, 0}, {2, 2}}];       Panel[LocatorPane[Dynamic[pts], g]]      I would like to be able to drag the triangle as a whole. I found none and assume this has to be added via code, i.e. `EventHandler` but found no examples of this. **Question: How can I select, and act upon multiple locators, i.e. drag, scale, apply a transformation to the points?**


title: Restrict Locator to a certain graphic inside Manipulate

text: I would like to restrict the Locator inside Manipulate to a certain graphic. For example if I display two graphs, I would like to be able to click on the right one and use this information in other places (for example in the title and the left graph). By design, `Manipulate` assigns the `Locator` to the **first** graphic object that it displays (see under Details and Options). How can this be overcome? Here is an example snippet:               Manipulate[      sin =       Plot[Sin[x], {x, -5, 5}, ImageSize -> Medium,         Epilog -> {Red, PointSize[Large], Point[p]}];      cos = Plot[Cos[x], {x, -5, 5},         PlotLabel -> "I would like to have the locator on this graph!",         ImageSize -> Medium, Epilog -> {Green, PointSize[Large], Point[p]}];      Column[{Style[StringForm["Title `1`", p], Large],        Row[{sin, cos}]}, Center],      {{p, {0, 0}}, {-5, -5}, {5, 5}, ControlType -> Locator}]      ![example output](http://i.stack.imgur.com/6lJCR.png) I know this can be done using `Dynamic`, but then I loose some features of manipulate, such as "Paste Snapshoot", "Make Bookmark" and `SaveDefinitions`


title: xkcdConvert routines perform slower in Mathematica 9

text: I am experiencing some rather large performance decreases in _Mathematica_ version 9.0 using the _xkcd-styled_ plotting routines. I had used the `xkcdConvert` code from Simon Woods as seen here (also described/annotated by Vitaliy Kaurov, as seen here) a few months back under version 8.0.4. This code worked great under version 8.0.4 and ran the following sample code in about **1.68 seconds** :               f1[x_] := 5 + 50 (1 + Erf[x - 5]);     f2[x_] := 20 + 30 (1 - Erf[x - 5]);     xkcdConvert[       Plot[{f1[x], f2[x]}, {x, 0, 10},         Epilog ->          xkcdLabel /@ {{"Label 1", {1, f1[1]}, {1, 30}}, {"Label 2", {8,              f2[8]}, {0, 30}}},         Ticks -> {{{3.5, "1st Event"}, {7, "2nd Event"}},           Automatic}]] // AbsoluteTiming      This code will produce a simple xkcd-styled plot as given by Simon Woods example. When I run the same code under version 9.0, the output takes **~17.0 seconds** to produce!? I'm not sure why the performance degradation is happening in version 9.0. I was hoping to produce a number of comic styled plots for a meeting. I have produced the desired plots, but all the plot-rendering took a really long time (one plot took ~8 minutes to render). I welcome insight on how to improve the rendering performance under version 9.0 for future rendering efforts!


title: Why do NDSolve and OutputResponse not evaluate non-analytic functions numerically?

text: test = OutputResponse[TransferFunctionModel[1/(1 + s), s], Exp[-(1/t)], {t, 0, 10}]      does not evaluate. If `Exp[-(1/t)]` is replaced by `Exp[-t]`, it's fine. Starting the numerical evaluation at `t>0` does not help, either. (v9.0.1.0 on Mac OS). Thanks. The same issue occurs with NDSolve:               NDSolve[{y'[t] + y[t] == Exp[-1/t], y[0] == 0}, y, {t, 0, 10}]      does not generate an interpolating function. Replacing `Exp[-(1/t)]` by `Exp[-t]` does.


title: Can some one explain perplexing behavior of arbitrary precision arithmetic?

text: I was exploring the problem presented by another question, when I ran into some behavior of _Mathematica_ 's arbitrary precision arithmetic engine that perplexes me. Here is what I was doing               poly = 64 x^7 - 112 x^5 - 8 x^4 + 56 x^3 + 8 x^2 - 7 x - 1;     solns = Solve[poly == 0, x, Reals]      > {{x -> -(1/2)}, {x -> 1},   >  {x -> Root[1 + 6 #1 - 12 #1^2 - 32 #1^3 + 16 #1^4 + 32 #1^5 &, 1]},   >  {x -> Root[1 + 6 #1 - 12 #1^2 - 32 #1^3 + 16 #1^4 + 32 #1^5 &, 2]},   >  {x -> Root[1 + 6 #1 - 12 #1^2 - 32 #1^3 + 16 #1^4 + 32 #1^5 &, 3]},   >  {x -> Root[1 + 6 #1 - 12 #1^2 - 32 #1^3 + 16 #1^4 + 32 #1^5 &, 4]},   >  {x -> Root[1 + 6 #1 - 12 #1^2 - 32 #1^3 + 16 #1^4 + 32 #1^5 &, 5]}}               root[n_] := Cos[2 n Pi/11];     poly == 0 /. x -> root[1]      > True               N[Root[1 + 6 #1 - 12 #1^2 - 32 #1^3 + 16 #1^4 + 32 #1^5 &, 5] == root[1], 20]      > True               N[Root[1 + 6 #1 - 12 #1^2 - 32 #1^3 + 16 #1^4 + 32 #1^5 &, 5] - root[1], 20]      > N::meprec: Internal precision limit $MaxExtraPrecision = 50.` reached while > evaluating -Cos[(2 [Pi])/11]+Root[1+6 #1-12 #1^2-32 #1^3+16 #1^4+32 > #1^5&,5,0]. > > 0.*10^-70               PossibleZeroQ[Root[1 + 6 #1 - 12 #1^2 - 32 #1^3 + 16 #1^4 + 32 #1^5 &, 5] -  root[1]]      > PossibleZeroQ::ztest1: "Unable to decide whether numeric quantity > -Cos[(2\\[Pi])/11]+Root[1+6\ #1-12\ #1^2-32\ #1^3+16\ #1^4+32\ #1^5&,5,0] is > equal to zero. Assuming it is." > > True It would appear that Mathematica can compare the values of `Root[1+6 #1+..+32 #1^5&,5]` and `root[1]` more easily than it can determine their difference. I realize differences lose precision very rapidly, but I still find this perplexing. Finally I tried raising the value of `$MaxExtraPrecision`, but still no joy.               Block[{$MaxExtraPrecision = 10000},        N[Root[1 + 6 #1 - 12 #1^2 - 32 #1^3 + 16 #1^4 + 32 #1^5 &, 5] - root[1], 20]]        > N::meprec: "Internal precision limit $MaxExtraPrecision = 10000.` reached > while evaluating -Cos[(2\\[Pi])/11]+Root[1+6\ #1-12\ #1^2-32\ #1^3+16\ > #1^4+32\ #1^5&,5,0]" > > 0.*10^-10020 Larger values of `$MaxExtraPrecision` only made the computation take longer before it failed. Could there be something wrong with the algorithm used to compute a difference to high precision in the case where the two terms are essentially the identical? ### Edit From the first answer posted, I realize I should ask my question more carefully. I am not sure how _Mathematica_ estimates the precision of very small numbers, which can be a tricky business. Perhaps, that's my problem. For a difference that is expected to be zero or very close, should I be asking for evaluation in terms of accuracy rather than precision? I note that               N[Root[1 + 6 #1 - 12 #1^2 - 32 #1^3 + 16 #1^4 + 32 #1^5 &, 5] - root[1], {∞, 1000}]        returns `0.*10^-1001` with no error message. For this return value, I get               Accuracy[0.*10^-1001]      > 1000.               Precision[0.*10^-1001]      > 0. This is consistent with the behavior that bothers me, but why is the precision zero? WRI defines precision and accuracy as follows: > Precision[x]: the total number of significant decimal digits in x > > Accuracy[x]: the number of significant decimal digits to the right of the > decimal point in x In my mind, these definitions are not consistent with the accuracy and precision values shown above. The definitions imply that accuracy will always be less than precision.


title: How to deploy a Manipulate object to the cloud that enables SynchronousUpdating?

text: Is it possible to deploy a Manipulate object in the cloud that enables the SynchronousUpdating, which response immediately ? For example, to make something like this in one of the Wolfram's blog ![enter image description here](http://i.stack.imgur.com/f1qQA.gif)


title: Hatched Filling for ListPlot

text: I am plotting to data curves using ListLinePlot. I like the look of Filling, but this is going to be printed, so I want something both black and white friendly, but giving more definition and separation than changing the opacity of the filling. Ideally, I would either have one hatched and the other filled solid gray, or both hatched in opposite directions or something such that they can be identified separately. This is what I have so far that I may just use if I can't find anything better:               data1 = exPDMIABSA[[1]];     data2 = exPDMIAwater[[1]];     ListLinePlot[{data1, data2},       PlotStyle -> {Black, Directive[Dashed, Black]},       Filling -> Axis,       FillingStyle -> Directive[Opacity[0.7], Gray]]      ![enter image description here](http://i.stack.imgur.com/bCvyV.png) Three related questions I've found are RegionPlot (or FillingStyle) using hash lines? and Filling a polygon with a pattern of insets and How can I make hatching filling of plot but none seems to address this situation. They seem to be dealing with shapes and (region)plots and not ListPlots. While it is entirely possible that they are very closely related, I'm not sure how to use any of those answers for my situation. Thanks


title: Incompatible Changes since Mathematica Version 7?

text: There is documentation of the incompatible changes made to _Mathematica_ with each major release:   * Incompatible Changes since Mathematica Version 1 Unfortunately that documentation simply stopped with version 7. Therefore I ask: ## What incompatible changes have been made since _Mathematica_ 7? There are other questions on the subject but I wish to make this an exhaustive index for easy reference.


title: Timeline plotting: horizontal bars of time intervals

text: This text file logs the time that a process (identified by a number) changes state ("Brown", "Blue" etc.")               2014-08-29 03:59:52 , 27273 , Brown     2014-08-29 03:59:53 , 27276 , Green     2014-08-29 03:59:55 , 27276 , Brown     2014-08-29 03:59:57 , 27303 , Red     2014-08-29 03:59:58 , 27303 , Green     2014-08-29 03:59:59 , 27303 , Brown     2014-08-29 04:00:04 , 27317 , Brown     2014-08-29 04:00:07 , 27331 , Blue     2014-08-29 04:00:07 , 27334 , Blue     2014-08-29 04:00:08 , 27331 , Red     2014-08-29 04:00:08 , 27334 , Cyan      What I try to do is to plot horizontal bars as time intervals, colored according to the third column, where x-axis is time, y-axis is process id number. One of the colors (probably Cyan) should not be displayed, as it marks the interval end. It is actually a timeline of many parallel events. DatePlot does not seem to help. Any suggestions?


title: Reduce Cannot Solve Complicated Function

text: As per the answer to this question: SolveAlways rejects inequality, I tried the following commands:               Clear[f, x]     D[Erf[x  f[x]], x]     Reduce[D[Erf[x  f[x]], x] <= 0, Reals]      Which gives the following output: > (2 E^(-x^2 f[x]^2) (f[x] + x f'[x]))/Sqrt[[Pi]] > > Reduce::nsmet: This system cannot be solved with the methods available to > Reduce. >> I would like to use the relation `D[Erf[x f[x]], x] <= 0` to find a relation between `f[x]` and `f'[x]` over the domain `x >= 0`. I know that `x` is positive and real, and that `f[x]` is a function from Reals to Reals, and that it is positive, continuous, and differentiable, but the exact form of the function is unknown. In this case, it is clear that the derivative will be less than or equal to zero whenever `f[x] <= -x f'[x]` but I can't get Mathematica to work with me. Any ideas on how I can use Mathematica to find the relation `f[x] <= -x f'[x]`?


title: Representing second derivatives with a double overdot

text: I would like to express a second derivative with two dots above the variable. You can do this with a first derivative by saying:               f[x_] := OverDot[x];     Print[HoldForm[f[x]], " == ", f[x]]      Is there a possible syntax to do this with the second derivative?


title: How does LocationTest choose its "AutomaticTest"?

text: Is there a way of determining how `LocationTest` chooses its `"AutomaticTest"`? Sometimes it's clear from the `VerifyTestAssumptions` option               sample = BlockRandom[SeedRandom[7];RandomVariate[SkewNormalDistribution@2, 10]];          {LocationTest[sample, Automatic, "AutomaticTest", VerifyTestAssumptions ->{"Normality"}],     LocationTest[sample, Automatic, "AutomaticTest", VerifyTestAssumptions -> "Normality" -> True]}      > {SignedRank, T} other times less so               {LocationTest[sample, Automatic, "AutomaticTest", SignificanceLevel -> 0.05],      LocationTest[sample, Automatic, "AutomaticTest", SignificanceLevel -> 0.0005]}      > {SignedRank, T} ( i.e. how can the level of the apriori-decided "burden of proof" affect the resulting sampling distribution? ) **Update 1:** Following on from the comments - Perhaps the setting for the significance level is somehow being inherited in checks for normality i.e.               {DistributionFitTest[sample, NormalDistribution[],"ShortTestConclusion", SignificanceLevel -> 0.05],      DistributionFitTest[sample, NormalDistribution[],"ShortTestConclusion", SignificanceLevel -> 0.0005],     DistributionFitTest[sample, NormalDistribution[], "PValue"]}      > {Reject,Do not reject,0.00836514} The critical point is not around the previous p-value instead appearing just after 0.03               Plot[If[LocationTest[sample, Automatic, "AutomaticTest", SignificanceLevel -> x] === "T", 1, 0], {x, 0.01, 0.05}]      ![enter image description here](http://i.stack.imgur.com/D9p5d.jpg) If so, perhaps some sort of Bonferroni correction is taking place? **Update 2:** From the answer from Andy Ross, the relevant test is not                DistributionFitTest[sample, NormalDistribution[]]          (*0.00836514*)      but rather                DistributionFitTest[sample]          (*0.0307822*)      indicating that indeed this significance level is being filtered down. This doesn't however, provide a systematic answer to determining _how_ this choice is made in general. In this case, the logic used by `LocationTest` can be deduced because it is a standard example but applying NHST can be a bit of an art that depends heavily on circumstance for its ultimate interpretation. Hence, having a black box for this logic seems limiting in perhaps a far more consequential way than say for other "more deterministic" and clear-cut algorithms. Also, what is the rationale behind this inheritance? - in NHST machinery, the significance level has a specific meaning in relation to Type 1/Type 2 errors, power, experimental context etc with the theory being predicated on a test's conditions being apriori satisfied _without_ concession to their own uncertainty (e.g. despite a p-value being returned, is an error message for a failed test of normality in say TTest invocations counted as a false negative/positive in defining a Type 1/Type2 error?).               sample2 = {6.1, -8.4, 1, 2, 0.75, 2.9, 3.5, 5.1, 1.8, 3.6, 7., 3, 9.4,         7.5, -6};     TTest@sample2          (* TTest::nortst: At least one of the p-values in {0.0903246}, resulting from a test for     normality, is below 0.05`. The tests in {T} require that the data is normally distributed. >> *)          (* 0.0498525 *)      The warning above doesn't seem to fit since 0.0903246 is not below 0.05 but explicitly set the significance level to the default 5% however, and the warning message disappears?               TTest[sample2, SignificanceLevel -> 0.05]          (* 0.0498525 *)      At any rate, in general it is quite conceivable that a different significance level for the overarching test might be needed in comparison with the significant level required for an apriori test checking the data's normality, symmetry, heterogeneity etc (n.b. also how are all these combined from the initial setting?) **Update 3:** To be a little more systematic: Define a function `ShowSignificanceLevelThresholds` to show those significant levels at which `LocationTest` changes its choice of `"AutomaticTest"` (the `"HighlightAutomaticTest"` option highlights this choice - both are defined at the post's end).               LocationTest[sample2, Automatic, {"TestDataTable", All},"HighlightAutomaticTest" -> True]     // ShowSignificanceLevelThresholds      ![enter image description here](http://i.stack.imgur.com/AhLwx.jpg) As deduced, the first transition appears due to the Koglomorov-Smirnof test of normality and its p-value of 0.09.               DistributionFitTest[sample2, Automatic, {"TestDataTable", All},      "HighlightAutomaticTest" -> True]      ![enter image description here](http://i.stack.imgur.com/F93E6.jpg) The second transition at a significance level 0.604 would appear to involve the violation of a symmetry assumption (observable by manual setting the `"Symmetry"` and `"Normality"` options to in the `"VerifyTestAssumption"` option) so that a related question becomes what Test is used by default to test for symmetry? While a high significance level of 0.604 is unlikely to have much practical significance in this particular case, this may not apply more generally. Again, the unknown effects of passing a significance level down to diagnostic tests is not straightforward and suggests caution in applying `LocationTest` and its ilk together with scope for further improvements (discussed in more detail here).               (*Needs to be evaluated twice*)     ALocationTest[sample_, x_, {tableType_, All}, y___ : OptionsPattern] /;     TrueQ@("HighlightAutomaticTest" /. {y}) :=      With[{\[ScriptCapitalH]2 =       LocationTest[sample, x, "HypothesisTestData",        FilterRules[{y}, Except["HighlightAutomaticTest"]]]},      Module[{AT = \[ScriptCapitalH]2["AutomaticTest"],       AllTests = \[ScriptCapitalH]2["AllTests"],       TableDataType = StringDrop[tableType, -5],(*Dropping "Table"*)      pos, Headers, grid, TableData},      TableData = \[ScriptCapitalH]2[{TableDataType, All}];     pos = 1 + Position[AllTests, AT][[1, 1]];     Headers =       Switch[TableDataType, "TestData", {"  ", "Statistic", "P-Value"},        "TestStatistic", {"  ", "Statistic"},        "PValue", {"  ", "P-Value"}];     Grid[{Headers,         Sequence @@          MapThread[          Flatten[Join[{#1}, {#2}]] &, {AllTests, TableData}]},        Alignment -> Left,        Background -> {Automatic, pos -> GrayLevel@0.9},        Dividers -> {2 -> True, 2 -> True},        FrameStyle -> Directive[GrayLevel@.7]] // Text]];          Unprotect@LocationTest;     PrependTo[DownValues@LocationTest,      DownValues[ALocationTest] /. ALocationTest -> LocationTest];     Protect@LocationTest;          AVarianceTest[sample_, x_, {tableType_, All}, y___ : OptionsPattern] /;     TrueQ@("HighlightAutomaticTest" /. {y}) :=      With[{\[ScriptCapitalH]2 =       VarianceTest[sample, x, "HypothesisTestData",        FilterRules[{y}, Except["HighlightAutomaticTest"]]]},      Module[{AT = \[ScriptCapitalH]2["AutomaticTest"],       AllTests = \[ScriptCapitalH]2["AllTests"],       TableDataType = StringDrop[tableType, -5],(*Dropping "Table"*)      pos, Headers, grid, TableData},      TableData = \[ScriptCapitalH]2[{TableDataType, All}];     pos = 1 + Position[AllTests, AT][[1, 1]];     Headers =       Switch[TableDataType, "TestData", {"  ", "Statistic", "P-Value"},        "TestStatistic", {"  ", "Statistic"},        "PValue", {"  ", "P-Value"}];     Grid[{Headers,         Sequence @@          MapThread[          Flatten[Join[{#1}, {#2}]] &, {AllTests, TableData}]},        Alignment -> Left,        Background -> {Automatic, pos -> GrayLevel@0.9},        Dividers -> {2 -> True, 2 -> True},        FrameStyle -> Directive[GrayLevel@.7]] // Text]];          Unprotect@VarianceTest;     PrependTo[DownValues@VarianceTest,      DownValues[AVarianceTest] /. AVarianceTest -> VarianceTest];     Protect@VarianceTest;          ADistributionFitTest[sample_, x_, {tableType_, All},      y___ : OptionsPattern] /;      TrueQ@("HighlightAutomaticTest" /. {y}) :=          With[{\[ScriptCapitalH]2 =       DistributionFitTest[sample, x, "HypothesisTestData",        FilterRules[{y}, Except["HighlightAutomaticTest"]]]},     Module[     {AT = \[ScriptCapitalH]2["AutomaticTest"],      AllTests = \[ScriptCapitalH]2["AllTests"],      TableDataType = StringDrop[tableType, -5],      (* Dropping "Table" *)      pos, Headers, grid, TableData      },     TableData = \[ScriptCapitalH]2[{TableDataType, All}];     pos = 1 + Position[AllTests, AT][[1, 1]];     Headers = Switch[TableDataType,       "TestData", {"  ", "Statistic", "P-Value"},       "TestStatistic", {"  ", "Statistic"},       "PValue", {"  ", "P-Value"}       ];     Grid[{        Headers,        Sequence @@          MapThread[Flatten[Join[{#1}, {#2}]] &, {AllTests, TableData}]        }, Alignment -> Left,        Background -> {Automatic, pos -> GrayLevel@0.9},        Dividers -> {2 -> True, 2 -> True},        FrameStyle -> Directive[GrayLevel@.7]] // Text     ]];          Unprotect@DistributionFitTest;     PrependTo[DownValues@DistributionFitTest,      DownValues[ADistributionFitTest] /.      ADistributionFitTest -> DistributionFitTest];     Protect@DistributionFitTest;               SetAttributes[SignificanceLevelThresholds, HoldFirst];     SetAttributes[ShowSignificanceLevelThresholds, HoldFirst];           SignificanceLevelThresholds[test_[A__]] :=       With[{firstTest = test[A, SignificanceLevel -> 0.0001]},       Last /@       Split[Table[{i, test[A, SignificanceLevel -> i]}, {i, 0.001, .999,         0.001}], Last@#1 === Last@#2 &]];          ShowSignificanceLevelThresholds[test_[A__]] :=      Module[{NForm},      NForm[n_] := If[MemberQ[{0, 1}, n], n, NumberForm[n, {4, 3}]];     With[{SLT = SignificanceLevelThresholds[test[A]]},      With[{intervals =        StringForm[          "`1` < \[FilledSquare] < `2`", #[[1]] // NForm, #[[2]] //            NForm] & /@         Partition[Prepend[SLT[[All, 1]] /. .999 -> 1, 0], 2, 1],       TestOutputs = SLT[[All, 2]]},      Grid[{{HoldForm@          test[A, SignificanceLevel -> \[SelectionPlaceholder]] //          Style[#, Bold] &,         Sequence @@ ConstantArray[SpanFromLeft, Length@SLT - 1]},        intervals, TestOutputs},       Spacings -> {2, {1 -> 2, 2 -> 2, 3 -> 1, 4 -> 1}},       Background -> {None, 2 -> LightBlue},       ItemStyle -> {None, 2 -> Directive[15]},       Dividers -> {{True, True, 3, 4}, {True, True, False, True}},       ItemSize -> 16, Frame -> True]]]]


title: How to define and use a linear function

text: I have the following equation $T = -800n + 12000$. I know that this is a linear function and that the two points $(0, 12000)$ and $(15,0)$ lie on the line. When I have 2 other values of n between 0 and 15, how is it possible to determine their corresponding T-values with Mathematica.


title: I failed to solve a set of one-dimension fluid mechanics PDEs with NDSolve

text: @DNA The fluid here has been assumed as single component perfect gas i.e. it obeys the equation P=ρRT, the thermal conductivity is assumed as a constant, so the equation is:               NDSolve[{D[ρg[t, x], t] + D[ρg[t, x] u[t, x], x] == 0,                   ρg[t, x] D[u[t, x], t] + ρg[t, x] u[t, x] D[u[t, x],x]                == -D[ρg[t, x] te[t, x], x],                   ρg[t, x] D[te[t, x], t] + ρg[t, x] u[t, x] D[te[t, x],x]               == -ρg[t, x] te[t, x] D[u[t, x], x] + D[te[t, x], x, x],                   te[0, x] == 298, te[t, -0.5] == 298, te[t, 0.5] == 298,                   ρg[0, x] == (1 - x^2),                   u[0, x] == 0, u[t, -0.5] == 0, u[t, 0.5] == 0},                  {ρg[t, x], te[t, x], u[t, x]}, {t, 0, 1}, {x, -0.5, 0.5}]      After I ran the code, I only got the warning message NDSolve::ndsz and NDSolve::eerr, I've checked the the equations for times and I think they are correct, and the initial and boundary conditions are also simple and seems to be reasonable (at least from the perspective of physics). So…What's wrong with it?…Well, to tell you the truth, what I really want to ask is, does NDSolve lack the ability to solve system of partial differential equations? Oh, someone may feel strange that there's no boundary condition for `ρg[t, x]`, that's because, I found that only four boundary conditions are necessary for the solving of the equations though I don't know the exact reason (I found it in times of trial when I set `ρg[0, x]` as a constant ).


title: Table in a Legend

text: Calculated data:               data= {{3.54216*10^6, 5.43391*10^6}, {3.5422*10^6,            5.43392*10^6}, {3.54224*10^6, 5.43393*10^6}, {3.54215*10^6,            5.43395*10^6}, {3.54219*10^6, 5.43396*10^6}, {3.54223*10^6,            5.43397*10^6}, {3.54214*10^6, 5.43399*10^6}, {3.54218*10^6,            5.434*10^6}, {3.54222*10^6, 5.43401*10^6}, {3.54213*10^6,            5.43403*10^6}, {3.54217*10^6, 5.43404*10^6}, {3.54221*10^6,            5.43405*10^6}, {3.54212*10^6, 5.43407*10^6}, {3.54216*10^6,            5.43408*10^6}, {3.5422*10^6, 5.43409*10^6}};      How can I present these data as an Table {i,x[i],y[i]} next to a graphic as a legend? I tried this finally with:               e = data &;     legends = AccountingForm /@ e[x];          legend = Overlay[{legendMaker[legends]}, Alignment -> {-.5, -.8},        ImageSize -> 400]      using the function legendMaker but I am not happy with my result. The best way would be to have it as an excel-like table. Thanks a lot.


title: Partitioning a list of numbers the Mathematica way

text: I have two sorted lists, one list will be called the "fences" and the other the "values" Fences could be: $\\{1, 5, 9, 14\\}$ Values could be $\\{-1, 1, 3, 4, 6, 9, 10, 13, 14, 15\\}$ I want to partition the values list using the equivalence relation that they are between the same fence values. ($f_i \leq v < f_{i+1})$ With the example above, I would get the partition: $$\\{\\{-1\\}, \\{1,3,4\\}, \\{6\\}, \\{9, 10, 13\\}, \\{14,15\\}\\}$$ This partitioning is quite easy using to implement using a for loop but I can't help but feel there is a better way to do it using some of the inbuilt Mathematica functions. I am not asking anyone to write the algorithm for me but to suggest which functions I should be aware of in order to do this elegantly.


title: How to avoid this kind of numerical error caused by extreme parameters when using NDSolve?

text: Here I use a one-dimensional heat conduction equation as the example. I found that when the thermal diffusion coefficient is small enough, Mathematica will give a result against the second law of thermodynamics:               fun[k_] := (a = NDSolve[{D[tes[t, x], t] == k D[tes[t, x], x, x],      　　　　　　　　　　    　　tes[t, 0] == t, tes[t, 1] == 0, tes[0, x] == 0},      　　　　　　　　　　   　　{tes[t, x]}, {t, 0, 1}, {x, 0, 1}];      　　　　　　Plot[(tes[t, x] /. a) /. t -> 1, {x, 0, 1}, PlotRange -> All]);     fun[1]     fun[10^-3]     fun[10^-6]      Here's the result: _Graph 1_ ![Graph 1](http://i.stack.imgur.com/NZ1w6.jpg) _Graph 2_ ![Graph 2](http://i.stack.imgur.com/J4Wkz.jpg) _Graph 3_ ![Graph 3](http://i.stack.imgur.com/c76JQ.jpg) The circled part in Graph 3 is the crux: this wave is unreasonable in the view of physics. So, how to avoid this if I have to use this kind of parameters?


title: How can I get the value of a at "t=2.4985352432136567" in the following expression?

text: By running the following code:               a = Sin[y[t]];     sol = NDSolve[{Derivative[2][y][t] + 0.1*Derivative[1][y][t] + Sin[y[t]] == 0,      Derivative[1][y][0] == 0, y[0] == 1}, y,      {t, 0, 10}, Method -> {"EventLocator", "Event" -> Derivative[1][y][t] - y[t]}]      we can obtain that the `"Event"` happens at `t = 2.4985352432136567` . The value of `y[2.4985352432136567]` can be obtained by using `y[2.4985352432136567] /. sol`, which appears to be `-0.589753`. However, when I apply this method to `a` for `a[2.4985352432136567] /. sol`, the results appear to be `{Sin[InterpolatingFunction[{{0., 2.49854}}, <>][t]][2.49854]}`, and no specific value is obtained. My question is, how can I get the specific value of `a` at `t = 2.4985352432136567`?


title: Suspend spacing between Repeated and number

text: The spacing of the first expression includes extra space before the `5`. I would like to have the same spacing as the second line.               HoldForm[4 .. 5]     HoldForm[a .. b]      Is there a way to suspend Mathematica's spacing, perhaps with a `StyleBox`?


title: Symbolic Integration of Special Functions

text: Sorry in advance if this formatting comes out strange, this is my first question! I can't find a way to integrate, e.g., a function of the Hermite polynomials for general (still integer) order. For example,               Integrate[E^-x^2 HermiteH[m,x] x HermiteH[n,x ], {x, -\[Infinity], \[Infinity]},          Assumptions->{m \[Element] Integers, n \[Element] Integers, m >= 0, n >= 0]      will not calculate. But if I give specific m and n,               Integrate[E^-x^2 HermiteH[m,x] x HermiteH[n,x ]/.{m->2,n->1}, {x, -\[Infinity], \[Infinity]}]      the answer comes right out. I know there is a general rule for certain classes of these integrals, and have often come across situations where I end up having to do them by hand. Does anyone know how to make Mathematica recognize/do these integrals? Thanks in advance.


title: Error message from NDSolve using WhenEvent

text: I am working with the following `NDSolve` expression:               sol =        NDSolve[{           (x[r] (0.9628102243099506` + (20 r^3 y''[r])/y[r]))/r^4 == (5 x''[r])/r,            1000 (2 (x'[r])^2 + 2 x[r] x''[r]) + 250 (2 (y'[r])^2 + 2 y[r] y''[r]) ==              -(17.65185212647424`/r),            x[1] == 0, y[1] == 0.25435588063893033`,            y'[1] == -0.011618552862714042`, x'[1] == 21/128,           WhenEvent[y[r] == 0, end = r; "StopIntegration"]},         {x, y}, {r, 1, 2.381047528519592`}]      I can plot `x[r]`, `y[r]`, but I get the message: > Power::infy: Infinite expression 1/0. encountered. >> If I delete the `WhenEvent` expression in the original code, I can numerically solve the equation without any error message. When I look at the plots with and without the `WhenEvent` expression, the two plots are exactly the same within the region that they share. Why am I getting the error message? can I ignore it, since the plot looks perfect.


title: Unexpected behaviour of Solve applied to two equations in two variables

text: I have a simple _Mathematica_ expression               Solve[{a(a-1)Sqrt[1+a^2+b^2] == b(a^3-1), b(b-1)Sqrt[1+a^2+b^2] == a(b^3-1)}]      which returns (on version 8.0, and also version 9.0) > >     {{b -> -(a/(1 + a))}, {a -> 1, b -> -I}, {a -> 1, b -> I}, {a -> 1, b -> > 1}, >      {b -> 0, a -> 0}, {b -> I, a -> I}, {b -> 1, a -> -I}, {b -> 1, a -> > I}} >   The first of these solutions does not seem correct. For example, putting `a=2, b=-2/3` does not satisfy either of the equations. On the other hand, if I add the `"VerifySolutions"` option to `Solve` I get the right answer:               Solve[{a(a-1)Sqrt[1+a^2+b^2] == b(a^3-1), b(b-1)Sqrt[1+a^2+b^2] == a(b^3-1)}           , VerifySolutions -> True]      returns > >     {{a -> 1, b -> -I}, {a -> 1, b -> I}, {a -> 1, b -> 1}, {b -> 0, a -> > 0}, >      {b -> I, a -> I}, {b -> 1, a -> -I}, {b -> 1, a -> I}} >   Is this the expected behaviour? It seems a bit odd to have to add an option to `Solve` to make it check that the solution returned actually satisfies the original equations.


Is wavelet a Nonlinear transform, or Not?   specifically, continuous wavelet transform with morlet function. I am studying behavior of a dynamic system, and it has nonlinear behaviour. can I employ wavelet transform?


title: numerical precision in output file

text: I want to write the numerical results of a computation to a file which is to be read in Fortran. The data looks like:               oswf0={1/(E^(25/2) \[Pi]^(1/4)), 1/(E^(81/8) \[Pi]^(1/4)), 1/( E^8 \[Pi]^(1/4)), 1/(E^(49/8) \[Pi]^(1/4)), 1/(E^(9/2) \[Pi]^(1/4))}      and I write it out with               Export["oscillatorwf_n0.dat", N[oswf0, 50]]      but the ouput file looks like               2.79918439290959673893721788332716676696872559106e-6     0.000030094068318430211211425128144825612558205505948023     0.00025197454903091461102445530088385078965019945670456     0.0016430804571573454314321054224416885379324057884235     0.008344251073246413703289360250294637268362678784284      All of them have clearly different precisions (>50). Why is mathematica not consistent here? What am I overlooking? How can I get 50 digits of precision consistently? Thanks a lot


title: Implementing a 100%-Mathematica http server

text: I would like to dedicate a small machine to exclusively running a Mathematica kernel and use that kernel to read http requests arriving on port 80, treat them and send http responses back **without any web server or extra software of any kind**. Requests are to be treated in sequence (only 1 connection shall be supported at a time). Clearly webMathematica is an overkill here. Any ideas?


title: Numerically solving systems of (first order) linear delay differential equations

text: I was wondering, how to solve such a system with mathematica? I found the NDsolve function, but in the reference is not mentioned if it is possible to solve a system of equations.


title: Automatically dealing with "disable dynamic updating"

text: I'm programmatically creating notebooks containing dynamic content. When a new notebook is being created, a window pops up: ![enter image description here](http://i.stack.imgur.com/LmUiP.png) I then manually click on "Continue" and it will create the notebook. The same steps happen for each notebook being created. How to automatically deal with this?


title: Plot Natural Log and Derivative Help

text: h[x_] := Log[2 x + xSin[x]]          h'[x_] := (2 + Sin[x] + xCos[x])/(2 x + xSin[x])          Plot[{h[x], h'[x]}, {x, 0, 10}]      Whenever I try to plot these two functions the plot turns up blank with two axes. Please halp.


title: How to color objects from a single .obj file?

text: How to paint the dolphin, shark and the box with different colors after loading the .obj file into Mathematica?               gr = Import["c:\\DolphinSharkBox.obj" ];     Graphics3D[gr[[1]]]      Link for the .obj file. ![enter image description here](http://i.stack.imgur.com/TBq4n.jpg)


title: Highlighting or coloring certain words / substrings appearing in a larger string

text: I have one longer string, `longString`, and a set $S$ of shorter strings `{ss1,ss2,ss3,...}`. I'd like to print out `longString` but where the positions of the shorter strings are indicated in some nice way. For example, perhaps we could color the characters in the longer string with a specific specified color for each shorter string. I.e. where would would have an array like `{{ss1,'Red'},{ss2,'Green'},{ss3,'Blue'},...}` and would then color words appearing in `longString` `Red` if the word is `ss1`, `Blue` if the word is `ss2`, and so forth. The idea would be to shade `Brown` / etc. overlap regions if they occur. Is this possible? One can use `StringPosition` to return the first and last character position for a set of substrings or words appearing in a larger string, for example:               StringPosition["TheBrownFox", {"Brown","Fox"}]          out: {{4, 8}, {9, 11}}      Now, one of the more interesting parts of this question, IMO, is how we handle overlaps between substrings / words (i.e. `ss1`, `ss2`, `ss3`, etc.). For example, if we add the nonsense word "wnFo" to the previous example, we have overlapping words:               testString = TheBrownFox;     StringPosition[testString, {"Brown","Fox","wnFo"}]          out: {{4, 8}, {7, 10}, {9, 11}}      So we need to do a kind of "surgery" on the output list for `StringPosition` s.t. there is never a situation where we have `{..., {integerOne, intTwo}, {intThree, intFour}, ...}` where it is NOT the case that `intOne < intTwo < intThree < intFour`. Update: Please see Kuba's very slick answer to my question concerning how one might do this: Identifying and isolating sections of overlap in a set of integer intervals * * * I am inspired by this example https://reference.wolfram.com/mathematica/example/HighlightWordsOfAGivenLength.html where words of a certain length are highlighted and bolded.


title: Returning lists of pixels connected through their Moore neighborhoods

text: I have a binarized image in Mathematica 9, and I would like to generate a list of coordinates for clusters of pixels connected through their Moore neighborhoods, e.g. $((c_{1,1},c_{1,2},...),(c_{2,1},c_{2,2},...),...)$ where some $c_{n,k}$ is the coordinate for the $k$th pixel in the $N$th set of pixels connected through their Moore neighborhoods. Is there a simple way to proceed with Mathematica 9's image analysis tool set?


title: Issue using the Cases function when forming a function of parameters

text: This is my code so far:               k = Import["all.txt.", "Table"]          Cases[k, {name_, G_, H_, S_, Cp_, V_, a1a_, a2b_, a3c_,a4d_, c1e_, c2f_, omegalan_, cT_}           /; name == "compoundname" -> {Cp, G, S}]      (The contents of `all.txt` can be found here.) This imports a table of 2000 different compounds, each having 12 different numerical values. Right now when I alter `"compoundname"` to for instance `"water"` the values I desire (here `Cp`, `G` and `S`) will appear for water. I am trying to alter this to make it so I can type the desired name into a simple function instead by attempting something like this:               HKFparameters[compoundname_] :=        Cases[k, {name_, G_, H_, S_, Cp_, V_, a1a_, a2b_, a3c_, a4d_, c1e_, c2f_, omegalan_, cT_} /;              name == "compoundname" -> {Cp, G, S}]      I have tried modifying this line in multiple ways but I cannot figure out how to do it.


title: Identifying and isolating sections of overlap in a set of integer intervals

text: I have a very large array like the following:               {{1,10},{8,9},{9,20},{34,40},{41,42},{43,50},{47,53},...};      Now, imagine that every element in the array corresponds to an integer interval. I'd like to delete elements in the array that fall within a larger interval, and whenever there is an interval-interval overlap, I'd like to shrink the intersecting intervals to eliminate the overlap and then add the former section where the overlap occurred as a new element to a separate array (here I'm calling this `overlapArray`). Perhaps this is best explained by example. Looking at the smaller case:               {{1,10},{8,9},{9,20},{34,40}...}      We notice that there is an overlap between the first three elements of the array, and that the element `{8,9}` falls entirely in this overlap section. So we this array becomes the following after our procedure:               {{1,7},{11,20},{34,40}...}          overlapArray = {{8,10}};      Now for the full example, this:               {{1,10},{8,9},{9,20},{34,40},{41,42},{43,50},{47,53},...};      Becomes:               {{1,7},{11,20},{34,40},{41,42},{43,46},{51,53}          overlapArray = {{8,10},{47,50}};      Is there an elegant way to do this with list operations in Mathematica v9?


title: Error message NDSolve::conarg: The arguments should be ordered consistently

text: Here is my code, i'm trying to make a simulation of the double pendulum               eq10 = 1.;     eq20 = 2.;     l1 = 5.;     l2 = 5.;     m1 = 5.;     m2 = 5.;     g = 9.81;     tMax = 10;          sol = NDSolve[{            l1 (m1 (g*Sin[P[t]] + l1*P''[t]) +               m2 (g*Sin[P[t]] + l1*P''[t] +               l2 (Sin[P[t] - Q[t]] Q'[t]^2 + cos[P[t] - Q[t]] Q''[t]))) == 0,             l2 m2 (g*Sin[P[t]] +               l1 (-Sin[P[t] - Q[t]] P'[t]^2 + Cos[Q[t] - Q[t]] P''[t]) +               l2 Q''[t]) == 0,             P[0] == eq10, Q [0] == eq20, P'[0] == 0., Q'[0] == 0.},             P[t], Q[t], {t, 0, tMax}]      > NDSolve::conarg: The arguments should be ordered consistently


title: How to fix the number and length of vectors when using ListVectorPLot

text: I want to plot only the vectors that I specify in my list of vectors, and no more. ListVectorPlot plots many of them, namely plots the field extrapolating from my four vectors.I would also like to have the length I give them, that is, if my list is the following: list = {{{-1, -1},{2, -2}}, {{1, -1},{2, 2}}, {{1, 1},{-2,2}}, {{-1, 1},{-2,-2}}}; I would like to have just four vectors at sites {-1,-1},{1,-1},{1,1} and {-1,1} of length Sqrt[2²+2²]. Does anybody know how to do this?


title: Collect pattern (Log's)

text: Is it possible to apply "Collect" command (to put Log's in particular combination) to factor out (pattern) a particular form from the full expression. For example, consider the following expression:               Log[a] + Log[b] - Log[c] + Log[d] - Log[f]      And I need to get a               Log[ab/c] - Log[f/d]      How one can do it?? Thanks in advance!! A. **EDIT** My concrete example is: Given this expression:               -(1/2) Log[(     \!\(\*SubscriptBox[\(s\), \({1, 2}\)]\)      \!\(\*SubscriptBox[\(s\), \({4, 5}\)]\))/(     \!\(\*SubscriptBox[\(s\), \({3, 4, 5}\)]\)      \!\(\*SubscriptBox[\(s\), \({4, 5, 6}\)]\))] (Log[(         Subscript[t, 1] Subscript[t, 3])/(     \!\(\*SubscriptBox[\(s\), \({4, 5}\)]\) μ^2)] - 1/ϵ)      and applying ExpanAll[PowerExpand[%]] leads to               Log[     \!\(\*SubscriptBox[\(s\), \({1, 2}\)]\)]/(2 ϵ) +       Log[μ] Log[     \!\(\*SubscriptBox[\(s\), \({1, 2}\)]\)] + Log[     \!\(\*SubscriptBox[\(s\), \({4, 5}\)]\)]/(2 ϵ) +       Log[μ] Log[     \!\(\*SubscriptBox[\(s\), \({4, 5}\)]\)] + 1/2 Log[     \!\(\*SubscriptBox[\(s\), \({1, 2}\)]\)] Log[     \!\(\*SubscriptBox[\(s\), \({4, 5}\)]\)] + 1/2 Log[     \!\(\*SubscriptBox[\(s\), \({4, 5}\)]\)]^2 - Log[     \!\(\*SubscriptBox[\(s\), \({3, 4, 5}\)]\)]/(2 ϵ) -       Log[μ] Log[     \!\(\*SubscriptBox[\(s\), \({3, 4, 5}\)]\)] - 1/2 Log[     \!\(\*SubscriptBox[\(s\), \({4, 5}\)]\)] Log[     \!\(\*SubscriptBox[\(s\), \({3, 4, 5}\)]\)] - Log[     \!\(\*SubscriptBox[\(s\), \({4, 5, 6}\)]\)]/(2 ϵ) -       Log[μ] Log[     \!\(\*SubscriptBox[\(s\), \({4, 5, 6}\)]\)] - 1/2 Log[     \!\(\*SubscriptBox[\(s\), \({4, 5}\)]\)] Log[     \!\(\*SubscriptBox[\(s\), \({4, 5, 6}\)]\)] - 1/2 Log[     \!\(\*SubscriptBox[\(s\), \({1, 2}\)]\)] Log[Subscript[t, 1]] -       1/2 Log[     \!\(\*SubscriptBox[\(s\), \({4, 5}\)]\)] Log[Subscript[t, 1]] +       1/2 Log[     \!\(\*SubscriptBox[\(s\), \({3, 4, 5}\)]\)] Log[Subscript[t, 1]] +       1/2 Log[     \!\(\*SubscriptBox[\(s\), \({4, 5, 6}\)]\)] Log[Subscript[t, 1]] -       1/2 Log[     \!\(\*SubscriptBox[\(s\), \({1, 2}\)]\)] Log[Subscript[t, 3]] -       1/2 Log[     \!\(\*SubscriptBox[\(s\), \({4, 5}\)]\)] Log[Subscript[t, 3]] +       1/2 Log[     \!\(\*SubscriptBox[\(s\), \({3, 4, 5}\)]\)] Log[Subscript[t, 3]] +       1/2 Log[     \!\(\*SubscriptBox[\(s\), \({4, 5, 6}\)]\)] Log[Subscript[t, 3]]      How to get from the last expression (a very long) the first (combined) one? I know, that I need to factor out this factor               Log[(     \!\(\*SubscriptBox[\(s\), \({1, 2}\)]\)      \!\(\*SubscriptBox[\(s\), \({4, 5}\)]\))/(     \!\(\*SubscriptBox[\(s\), \({3, 4, 5}\)]\)      \!\(\*SubscriptBox[\(s\), \({4, 5, 6}\)]\))]      Naively:               Collect[expression, Log[(         \!\(\*SubscriptBox[\(s\), \({1, 2}\)]\)          \!\(\*SubscriptBox[\(s\), \({4, 5}\)]\))/(         \!\(\*SubscriptBox[\(s\), \({3, 4, 5}\)]\)          \!\(\*SubscriptBox[\(s\), \({4, 5, 6}\)]\))] ]


title: simplifying equations

text: I have a question that seems easy but I can't solve it. I have an equation like:               eqgama = -8.33208*10^56 g1 + 8.18264*10^56 g1^2 == -1.42093*10^56      I use the following statements to find its discriminant:               poly = (eqgama[[1]] - eqgama[[2]]) // Simplify;     Discriminant[poly, g1];      The answer is: 2.29158*10^113 In another program mathematica itself simplifies eqgama to the following equation:               -1.97163*10^54 g1 + 1.93627*10^54 g1 ^2 == -3.36235*10^53      and so the discriminant becomes: 1.28315*10^108. I have a loop and I want to plot discriminants versus a definite parameter, but in this loop sometimes Mathematica simplifies equations and sometimes not. So the plot fluctuates. What should I do?


title: Why can I edit only one character of the output of a Dynamic expression?

text: Try this:               DynamicModule[{foo = \[Placeholder]}, foo]      Note how we're able to edit the placeholder in the output, _e.g._ replace it with 42:     ![enter image description here](http://i.stack.imgur.com/4BquZ.png) Now, try this:               DynamicModule[{foo = \[Placeholder]}, Dynamic@foo]      This time, I'm only able to edit _one_ character:     ![enter image description here](http://i.stack.imgur.com/1ZrG9.png) **What's going on internally, that explains this behavior?** At first, I thought maybe upon the first "touching" of a Dynamic portion of an output expression, the entire expression somehow "locks up." But, that can't be the case—I can edit that "4" as much as I'd like—I just can't remove or add any characters. Next, I compared the two expressions' `FullForm`s, keeping in mind that the very act of typing the first `/` in the output cell might have an effect on the expression:     ![enter image description here](http://i.stack.imgur.com/PXOMv.png) But I'm not sure what to make of the difference. Does it have something to do with `ImageSizeCache`? Still, why and how would something enforce the presence of a strictly one-character atom? I'm on $Mathematica$ 9.0.1.0.


title: Adding Lines to Sparklines (plots w/o frames, axes, etc.)

text: I have been working with Sparklines, thanks to some code found here. Here is what I am using:               sparkline[data_] :=      DateListPlot[data, {1997},        FrameTicks -> {{Automatic, Automatic}, {{{2007, 1, 15}, Red}},          None}, Axes -> False, Frame -> False, Joined -> True,        PlotRange -> All, Filling -> Bottom, AspectRatio -> 0.2,        ImageSize -> 120]      Here is my data:               data={{0, 0.00342768669164354`, 0.00503464769633257`, 0, 0.000187`, 0, 0,            0, 0, 0, 0, 0, 0, 0}, {0.0415627991238424`, 0.0545451018506565`,            0.0395873926886832`, 0.0284671754269643`, 0.0390903566779343`,            0.0344695110117644`, 0.0326128167712641`, 0.0380630684019641`,            0.0358499768032886`, 0.0241216221583061`, 0.0421644617338612`,            0.013010650199335`, 0.0249861212092993`, 0.0052690153372215`}};      I have been arranging them in charts, like so:               Grid[{{"Topic No.", "Sparkline"}, {"1", sparkline[data[[1]]]}, {"2",         sparkline[data[[2]]]}}, Frame -> All,       Background -> {None, {LightGray}}]      ![enter image description here](http://i.stack.imgur.com/Ov1CR.png) What I am trying to do, so far unsuccessful, is find options to put lines within the Sparkline to indicate a specific date. i.e. is there a way that I could add a line for the year '2005' in the example above? The beauty of the Sparkline lies in having no frame or printed axes, but most of the Mathematica commands that come to mind rely on those. My end goal would be to have something like this (where the line is at 2005, although this is just a mock up): ![enter image description here](http://i.stack.imgur.com/h1zlc.png)


title: Function that is a good fit to the plot made with SmoothHistogram

text: How can I find a function that fits the plot from the SmoothHistogram function? For instance if I have data like this and plot a Smooth Histogram, how can I get a function that fits the plot?               data = {4, 4, 4, 4, 1, 1, 4, 1, 5, 5, 5, 5, 5};     SmoothHistogram[data]      ![plot](http://i.stack.imgur.com/m1Kcg.png)


title: How to get the dimensions of a rectangle?

text: Suppose I create a Rectangle of dimensions 1 and 3. Is there any function in Mathematica that I can use to recover the dimensions of the original rectangle? If there is no such a function, is there a way of recovering the dimensions?


title: How to use and input audio wav file into a Wolfram demonstration

text: I am trying to send a Wolfram demo, which contains a sound wav file. `sound = Import["C:/myfile.wav", "Data"]; snd := sound[[1]]; or snd = sound[[1]];` Is it possible to convert the wav file into the data set,- and in this form to insert in the demonstration? Or is there a problem with my Internet connection when uploading the demo? In what form do you have to prepare audio *.wav files for use in Wolfram demonstrations? What kind of audio compression is needed for this purpose?


title: Changing the data indices for a large dataset plotted with ContourPlot

text: I have a large (square) dataset that I am plotting with ListContourPlot ... The data is 128x128 -- without coordinates for each point. I.e. - {{0,0,1,0,...,0},{0,2,1,1,...,1},...{3,1,1,1,...,2}} So the default contour plot uses the axis range 0->128 - for both x and y since there are 128 sets of 128 points. However, how can I remap the axis such that I plot this data with axis ranges of {-150,150}?? I realize that Rescale will give the formula to remap 128 points to the range -150,150 (e.g. - X/128 * 300 - 150), but how do I tell ListContourPlot to use those indices for the data (and hence those tick marks)? Thx, Rick


title: Generating Linear Extensions of a Partial Order

text: Given a set $S$ and a partial order $\prec$ over $S$, I'm looking for a way to "efficiently" generate a list of linear extensions of $\prec$. Suppose the partial order is given by a `List` of pairs $\\{x,y\\}$ such that $x,y\in S$. For example, if $S = \\{a,b,c\\}$, then $\\{\\{a,c\\},\\{b,c\\}\\}$ defines a partial order where $a \prec c$ and $b \prec c$. Essentially, given a list $S$ and a list of pairs $P$, I want to generate a list of permutations which respect the orders of the pairs in $P$.               linearExtensions[{a, b, c, d, e}, {{a, b}, {c, b}, {c, d}, {e, d}}]     (* {{a, c, b, e, d}, {a, c, e, b, d}, {a, c, e, d, b}, {a, e, c, b, d},         {a, e, c, d, b}, {c, a, b, e, d}, {c, a, e, b, d}, {c, a, e, d, b},         {c, e, a, b, d}, {c, e, a, d, b}, {c, e, d, a, b}, {e, a, c, b, d},         {e, a, c, d, b}, {e, c, a, b, d}, {e, c, a, d, b}, {e, c, d, a, b}} *)      Since $\\{a,b\\}$ is in $P$, the permutation $\\{b, c, a, d, e\\}$ is not a linear extension because $b$ comes before $a$. I've written two different functions which do the job, both using pattern matching, but I've been using Mathematica for less than a week and am still getting into the functional mindset. I'm interested to see how seasoned Mathematica users would tackle this problem. My first approach was to use `NestWhile` (edit: this is ugly! I did not know about the `Fold[]` function when I wrote this):               linearExtensions[set_, po_] :=          Module[{patterns},             patterns = {___, #[[1]], ___, #[[2]], ___}& /@ po;             First@NestWhile[{Cases[#[[1]], First[#[[2]]]], Rest[#[[2]]]}&,                 {Permutations[set], patterns}, Length[#[[2]]] > 0&]         ]      My second approach, which turned out to be significantly slower, was to expand a set of rules from the partial order and use `Select` on the list of permutations.               linearExtensions[set_, po_] :=         Module[{poQ},             poQ[rule_] := And @@ (MatchQ[rule, {___, #[[1]], ___, #[[2]], ___}]& /@ po);             Select[Permutations[set], poQ[#]&]         ]      Note that on a list of length $n$ there can be $\Omega(n!)$ linear extensions, so by "efficient," I don't mean polynomial-time.


title: Bad numerical approximations

text: I'm trying to do some calculations here, but for some reason Mathematica starts using numerical approximations that are no good for my work. Specifically:               T[t_] := {(-Sin[t])/(Sqrt[1 + Cos[t/2]^2]),      (Cos[t])/(Sqrt[1 + Cos[t/2]^2]), (Cos[t/2])/(Sqrt[1 + Cos[t/2]^2])}          B[t_] := {(-0.5 Cos[t] Sin[t/2] + Cos[t/2] Sin[t])/Sqrt[       1.625 + 0.375 Cos[t]], (- Cos[t/2] Cos[t] -         0.5 Sin[t/2] Sin[t])/Sqrt[1.625 + 0.375 Cos[t]], 1/Sqrt[       1.625 + 0.375 Cos[t]]}          Cross[B[t], T[t]]      After using `Simplify`, I get: > `{((1.4142135623730951 + 1.4142135623730951 Cos[t/2]^2) Cos[t] + > 0.3535533905932738 Sin[t]^2)/( Sqrt[1.625 + 0.375 Cos[t]] Sqrt[ 3 + > Cos[t]]), ((1 + Cos[t/2]^2 - 0.25 Cos[t]) Sin[t])/( Sqrt[0.8125 + 0.1875 > Cos[t]] Sqrt[3 + Cos[t]]), (0.7071067811865476 Sin[t/2])/(Sqrt[1.625 + 0.375 > Cos[t]] Sqrt[3 + Cos[t]])}` I know for a fact that: $$1.4142135623730951 \approx \sqrt{2} \\\ 0.7071067811865476 \approx \frac{\sqrt{2}}{2} \\\ 0.3535533905932738 \approx \frac{\sqrt{2}}{4}$$ When I write `Sqrt[2]`, `(Sqrt[2]/2)` and `(Sqrt[2]/4)` instead of these numbers, I am unable to proceed with these calculations, and I keep getting the warning: ![enter image description here](http://i.stack.imgur.com/cqolT.png) etc. Can someone tell me how to solve this? * * * I didn't know what tag or specific title to put here, so if you have a better idea, feel free to edit it.


title: A problem with Timing

text: With               M = Partition[Range@10000000, 1000];       V = Range[10000] - 1;      I got the following timings:               Table[Prepend[M, V]; // Timing // First, {10}]      > {0.358802, 0.561603, 0.546003, 0.546003, 0.577203, 0.592803, \ 0.561603, > 0.577203, 0.561603, 0.561603} I was irritated by the fact that the first timing (0.358802) was significantly faster than the others. This also happened with similar functions and other sizes of `M` and `V`. Later I found the timing function recommended here:               timeAvg =        Function[func,         Do[If[# > 0.3, Return[#/5^i]] & @@ Timing@Do[func, {5^i}], {i, 0,           15}], HoldFirst];      Using it I now get a much "better" result:               Table[Prepend[M, V]; // timeAvg, {10}]      > {0.574083, 0.514803, 0.577203, 0.561603, 0.546003, 0.546003, \ 0.561603, > 0.546003, 0.546003, 0.530403} Why the initial jump with the inbuilt `Timing`?   Should I always use `timeAvg`?


title: Creating complex contour plots

text: I would like to create a contour plot of $e^z-\dfrac{z-1}{z+1}$ that looks like the picture on the left, but can only manage the one on the right. I have tried incrreasing the number of contours, but this doesn't have any effect. Am I missing something fundamental? ![](http://i.stack.imgur.com/6Lgxa.gif) ![](http://i.stack.imgur.com/ulwmr.gif)               Show[Table[ContourPlot[{Im[E^(x + I y) - ((x + I y) - 1)/(x + I y) + 1] == k,      Re[E^(x + I y) - ((x + I y) - 1)/(x + I y) + 1] == k}, {x, -4, 4}, {y, -20, 20},      ContourStyle -> {Directive[{Red}], Directive[{Blue}]},      PlotPoints -> 100, Contours -> 20, AspectRatio -> Automatic], {k, -10, 10, 2}]]      The plot I am trying to recreate is from this website (specific PDF).


title: Proper EdgeForm setting so boundary appears entirely within shape

text: I have two neighboring (complicated) polygons that I want to be displayed with thick boundaries, however the two shapes border one another, and as EdgeForm places the line centered upon the polygon's boundary, the border of one shape overlaps the other. I would like the boundary lines to lie interior to the polygon's boundaries. Here's shape 1, shape 2, and then the two shapes shown together: ![enter image description here](http://i.stack.imgur.com/B81Zm.png) ![enter image description here](http://i.stack.imgur.com/Ls4vr.png) ![enter image description here](http://i.stack.imgur.com/NlojD.png) Obviously one could just shrink the shapes by a little bit, but this is not very exact. I was thinking a clever EdgeForm definition might be able to "offset" the boundary to the shape's interior.


title: FindFit with parameters which are simultaneously in initial conditions

text: I have RLC circuit. I would like to find R and L by using FindFit, but L is in initial condition and I have problem with it. Could you help me ?               c = 116*10^(-6); U = 16000. ;           data =      {        {0, 0}, {0.25*10^(-6), 132000}, {0.5*10^(-6), 330000}, {1*10^(-6), 462000},         {2*10^(-6), 600000}, {3*10^(-6), 462000}, {4*10^(-6), 330000}, {5*10^(-6), 66000},         {6*10^(-6), -198000}, {7*10^(-6), -264000}, {8*10^(-6), -198000}, {9*10^(-6), -132000}     };          lp = ListPlot[data, PlotRange -> All]          fit =        FindFit[data,         First[i /.            NDSolve[{i''[t] + R/L * i'[t] + 1/(c L)*i[t] == 0, i[0] == 0, i'[0] == U/L},              i, {t, 0, 9*10^(-6)}]],         {{R, 10*10^(-3)}, {L, 20*10^(-9)}},          i,          PrecisionGoal -> 4,          AccuracyGoal -> 4]


title: How to factorise a variable out of an indefinite sum?

text: (I should start by saying I'm a total beginner with Mathematica, so if the answer needs code I'll need it spelled out quite clearly, the learning curve for this is proving steep!) Basically what I am trying to so is manipulate a power series for an expression involving the function alpha(r) inside an indefinite sum, so that I can pick out coefficients from it (series solving an ODE, for context). The following code is used to produce alpha and then the sum of squares of its first derivative.               α[r_] := Sum[Subscript[α, i, j]*r^i, {i, 0, 5}]          η[r_] :=        Sum[D[α[r], r]^2, {j, 1, N}] /. Sum[x_, y_] :> (Sum[#, y] & /@ Expand @ x)      Without `/. Sum[x_, y_] :> (Sum[#, y] & /@ Expand@x)`, the output stays all collected into one sum over `j` even when `Expand` is applied, shown below: ![Fig 1](http://i.stack.imgur.com/fevwV.png) With that code, the sum splits up into a series of sums, each only one term long: ![Fig 2](http://i.stack.imgur.com/KQzRF.png) However, the variable `r` is still _inside_ the sum in each case, meaning that when I apply `Coefficient[,r,2]` (etc) to the output, it just spits out all of the output (i.e. doesn't do anything) rather than just identifying the terms of the correct power of `r`. What I really need is some code that pulls the 'r' factor out of each summation term, so that `Coefficient` will pick out the required terms.


title: Expression for evaluating multiple functions?

text: I am constructing 3D data points for a plot and corresponding to specific conditions "manually". I define the values of five parameters [these I always have to define myself]. From those, I evaluate the values of seven other parameters [some of which are also functions of each others, so I need to be careful with order of evaluation]. Currenly this is how I do it [parameters are functions of values and other parameters]:               par1cond1 = par1[val1, val2, val3];     par2cond1 = par2[val1, val2, par1cond1, val4];     ...     par7cond1 = par7[val1, par6cond1];        And I assign these as the parameters of a vector.               vector1[t_] := {vx[par1cond1, ..., t], vy[par1cond1, ...,t], vz[par1cond1, ..., t]};      In short --- how do I define a function that only takes as its variables the five original parameters, and evaluates the seven relevant expressions in a certain order, and returns the values it got? I would like to do it by calling one function, that would do the manual labour for me:               ConstructVectorFrom[val1, val2, val3, val4, val5]      Which would return the vector.


title: Problems with series of generalized hypergeometric functions

text: I have been trying to do the following series:               Series[HypergeometricPFQ[{1, 4, 4}, {4 - Sqrt[3], 4 + Sqrt[3]}, z],{z,1,0}]      Mathematica says that the result is infinite, without telling me precisely how it diverges with 1-z. I have tried FunctionExpand, FullSimplify and other commands, but so far, with no success. Any help would be most welcome. Best, Jorge


title: How can I invert the colors in a color bar

text: I have this _Mathematica_ code               Clear[colorbar]     colorbar[{min_, max_}, colorFunction_: Automatic, divs_: 150] :=        DensityPlot[y, {x, 0, 0.1}, {y, min, max}, AspectRatio -> 10,        PlotRangePadding -> 0, PlotPoints -> {2, divs}, MaxRecursion -> 0,        Frame -> True,        FrameLabel -> {{None, Subscript["R", "min"]}, {None, None}},        LabelStyle -> Directive[FontFamily -> "Helvetica", 17],        FrameTicks -> {{None, All}, {None, None}},        FrameTicksStyle -> Directive[FontFamily -> "Helvetica", 15, Plain],        ColorFunction -> colorFunction]          Mn = 250; cn = 0.25;     Md = 7000; b = 6; a = 3; h = 0.2;     υ0 = 20; β = 1.5; ch = 8.5;     Lz = 10;     E0 = 600;          Vn = -Mn/Sqrt[R^2 + z^2 + cn^2];     Vd = -Md/Sqrt[b^2 + R^2 + (a + Sqrt[h^2 + z^2])^2];     Vh = υ0^2/2 Log[R^2 + β*z^2 + ch^2];     Vt = Vn + Vd + Vh;     Veff = Vt + Lz^2/(2*R^2);          f[R_, pR_] := 1/2*pR^2 + Veff /. {z -> 0};          plrange = {{0, 13.5}, {0, 47}};     valrange = {0, 6};          C0 =        ContourPlot[Evaluate[f[R, pR]], {R, 0.001, 15}, {pR, 0, 50},          Contours -> {E0}, ContourStyle -> {{Black, Thickness[0.005]}},          AspectRatio -> 1, ContourShading -> False, PlotPoints -> 200,          PerformanceGoal -> "Speed", PlotRange -> plrange];          With[{opts = {ImageSize -> {Automatic, 550}}, cf = "Rainbow"},        Row[{Show[         ListPlot[List /@ data[[All, {1, 2}]],            PlotStyle -> ({PointSize[0.01], ColorData[cf][1 - #]} & /@              Rescale[data[[All, 3]], valrange]),           PlotRange -> plrange,            AspectRatio -> 1, Frame -> True, RotateLabel -> False,            Axes -> None, FrameTicks -> True,            FrameLabel -> {"R", OverDot["R"]},            LabelStyle -> Directive[FontFamily -> "Helvetica", 17],            ImagePadding -> {{60, 20}, {60, 20}}, opts],         C0],          Show[colorbar[valrange, cf],           ImagePadding -> {{20, 60}, {60, 20}}, opts]}]]      I inverted the "Rainbow" color scheme using               {..., ColorData[cf][1 - #]}&      and produced the following nice plot. ![enter image description here](http://i.stack.imgur.com/FPHJi.jpg) However, I can't find a way to invert the colors in the color bar. To be more specific, according to my data red should correspond to 0 of Rmin and deep purple to 6. I hope it is easy to invert the order of the colors in the color bar. Can someone tell me how?


title: Parallel numerically integrated function can't be plotted

text: I've been working on a problem where I need to integrate a function numerically. The function is quite complex and it takes almost an hour for _Mathematica_ to make a plot. To speed the process up I thought that I could implement a parallel NIntegrate function using _ParallelTable[]_. I believe I successfully accomplished that for single numerical values for the limits of the integration but there's something wrong since when I try to make a plot I got a bunch of errors. Here's my code, where instead of my horrible integrand I used the function $f(x)=x$               ParalellNIntegrate[imin_?NumericQ, imax_?NumericQ] :=       (step = (imax - imin)/4;        Total[         ParallelTable[          NIntegrate[u, {u, i, i+step}], {i, imin, imax - step, step}]         ]);     Plot[ParalellNIntegrate[0, x], {x, -1, 1}]          (kernel 2) NIntegrate::nlim: u = 0.25 x is not a valid limit of integration.          (kernel 1) NIntegrate::nlim: u = 0.75 x is not a valid limit of integration.          (kernel 2) NIntegrate::nlim: u = 0.5 x is not a valid limit of integration.          (kernel 1) NIntegrate::nlim: u = x is not a valid limit of integration.          (kernel 2) NIntegrate::nlim: u = i+0.25 x is not a valid limit of integration.          (kernel 1) NIntegrate::nlim: u = i+0.25 x is not a valid limit of integration.          (kernel 1) General::stop: Further output of NIntegrate::nlim will be suppressed during this calculation.          (kernel 2) General::stop: Further output of NIntegrate::nlim will be suppressed during this calculation.      Can somebody help me? PS: I also have this doubt about the step and I think I could use this post to clear it (I do realize that I shouldn't post more than one question per post but it's somehow related and it seems silly to open a post just for this). I divided the interval of integration in 4 regions since my cpu only works with 4 threads could somebody tell me if I'm thinking correctly?


title: How to zoom and pan a ListLinePlot?

text: I'm using `ListLinePlot` inside a `Manipulate` function to display some data. I've seen that _Mathematica_ allows zooming and panning but it's either only for 3D plots or it just doesn't work with `ListLinePlot`. I've also seen a thread here on Stackexchange for a custom function to zoom and pan but it doesn't seem to work when I apply it to `ListLinePlot` (error message "... is not a graphics primitive or directive"). So is there a solution I've missed to be able to zoom and pan a `ListLinePlot`?


title: Find patterns in a list

text: again, I have a list like this:               list={0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \     0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, \     0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, \     0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0}      I want to search for the pattern: **{1,0,0}** and mark all the numbers matching this sequence in Red with the Style option. I tried to use Cases to help me out, which does not work. Checked the help a few times, but no idea so far :/               Cases[list, {1,0,0}]


title: Backtrack function

text: I am using Mathematica 9. In the Help help file is the built-in function Backtrack. In order to use it the Help file says: To use Backtrack, you first need to load the Combinatorica Package using `Needs["Combinatorica`"]`. However, when I try to do this I get > General::compat: Combinatorica Graph and Permutations functionality has been > superseded by preloaded functionality. The package now being loaded may > conflict with this. Please see the Compatibility Guide for details. The "Compatibility Guide" doesn't seem to help. Can someone tell me exactly what is going on here?


title: Pattern matching not going over a list when using default values

text: if I execute the following command in Mathematica:               {a,a^2,a^3}/.a^(n_:1)->b^(2 n)      Mathematica returns:               {b^2,b^4,b^6}      but if I enter:               {a,a^2,a^3}/.a_^(n_:1)->b^(2 n)      Mathematica only returns:               b^2      Without the default value for n, Mathematica returns in both instances (a & a_):               {a,b^4,b^6}      Could someone explain why the different behavior?


title: Problem printing what appears in my notebook

text: I have created a dashboard that looks fine on my screen and fits onto my screen at 100% magnification on Mathematica. When I try printing it, no matter what printing environment I use, I can not get it to print what is on the screen on a single or two consecutive A4 pages. Depending on the printing environment selected, it prints out either some of the page but not all of it, or prints out the page magnified a few times so that it ends up taking up about 8 A4 pages. When I click on Page Setup, nothing happens. I have also tried exporting to PDF first but the export ends up looking exactly as the printed version did. Here is the code: \--Some functions               GraphHeading[GraphLabel_] :=        TextCell[GraphLabel, FontWeight -> Bold, FontFamily -> "Helvetica"];     DropDownBoxHeading[BoxHeading_] :=        TextCell[BoxHeading, FontWeight -> Bold, FontFamily -> "Helvetica"];      \--Some Definitions               Tab3DropDownOpUSelection = "Haul Trucks";     Tab3DropDownMetricSelection = "Fuel";     Tab3DropDownOperationalUnit =        PopupMenu[        Dynamic[Tab3DropDownOpUSelection], {"Haul Trucks", "Loaders",          "Haul Trucks and Loaders", ""}];     Tab3DropDownMetric =        PopupMenu[        Dynamic[Tab3DropDownMetricSelection], {"Fuel", "Costs",          "Consumption Index", "Cost per Tonne"}];     Tab3MetricList = {"Fuel", "Costs", "Consumption Index",         "Cost per Tonne"};      \--Some things to display               Tab3Graph :=       Dynamic[ListLinePlot[{{{1, 0.96`}, {2, 0.6900000000000001`}, {3,            1.11`}, {4, 1.`}, {5, 1.3900000000000001`}, {6,            1.1500000000000001`}, {7, 1.3800000000000001`}, {8, 1.51`}, {9,            1.1500000000000001`}, {10, 0.51`}}, {{1, 1.06`}, {2, 0.75`}, {3,            1.22`}, {4, 1.1`}, {5, 1.53`}, {6, 1.27`}, {7, 1.52`}, {8,            1.6600000000000001`}, {9, 1.27`}, {10, 0.56`}}},         PlotMarkers -> Automatic,         PlotRange -> {{1, 10}, {0, 1.8260000000000003`}},         AxesOrigin -> {1, Automatic},         Frame -> {{True, False}, {True, False}},         PlotLabel -> "Haul Truck Fuel",         FrameLabel -> {"Week", "Litres", "", ""}, AspectRatio -> 1/3.5,         ImageSize -> {800, 300}, PlotStyle -> {Black, Black}]]     Tab3Stats1Table :=       Grid[{{"Metric", "Unit", 1, 2, 3, 4, 5, 6, 7, 8, 9,          10}, {"Predicted Fuel", "Mlitres", 1.01`, 0.72`, 1.16`, 1.05`,          1.46`, 1.21`, 1.45`, 1.58`, 1.21`,          0.53`}, {"Upper Predicted Fuel", "Mlitres", 1.06`, 0.75`, 1.22`,          1.1`, 1.53`, 1.27`, 1.52`, 1.660000, 1.27`,          0.56`}, {"Lower Predicted Fuel", "Mlitres", 0.96, 0.6900000,          1.11`, 1.`, 1.3900, 1.1500, 1.38000, 1.51`, 1.15000,          0.51`}, {"Material Handled", "Mtonnes", 3.29`, 2.39`, 3.83`,          3.14`, 4.`, 3.2600000000000002`, 3.81`, 4.21`, 3.12`, 1.42`}},        Alignment -> Left,        Dividers -> {{Black, Black, Black, Gray, Gray, Gray, Gray, Gray,           Gray, Gray, Gray, Gray, Gray, Gray, Black}, {Black, Black, Gray,           Gray, Gray, Gray, Gray, Black}}]      \--Putting it all together               Tab3 := Column[{Row[{GraphHeading["Most Recent Update Week is Week "],            GraphHeading[10], " - ", GraphHeading[2013]}],          Column[{Grid[{{"Operational Unit",               "Metric"}, {Tab3DropDownOperationalUnit,               Tab3DropDownMetric,}}, Alignment -> Left], Tab3Graph,            Tab3Graph, Tab3Graph,            Grid[{{"         "}, {"Totals for Selected Week"}, {Dynamic[               Tab3Stats1Table]}, {"           "}},             Alignment -> {Left, Top}],            Column[{"Weekly Measures", Dynamic[Tab3Stats1Table]}]}]},         Alignment -> Center];      \--Use this to generate what is to be display and then hide the code and simply try to print the display.               Dynamic[Tab3]


title: Non-linear scaled X axis in DateListPlot

text: I have a lot of plots like this in Mathematica: ![enter image description here](http://i.stack.imgur.com/ZHnYe.png) And I would like to transform it in something like that: ![enter image description here](http://i.stack.imgur.com/S0HeI.png) Where the information between 0 and 7 hours and 18 and 00 hour is "compressed" in the chart. I know about `ScalingFunctions`, but it doesn't work for `DateListPlot`. Here is some toy code to reproduce the original version behavior:               dtIni={2013,1,1,0};     dtFim={2013,1,1,24};     data={#,RandomVariate[NormalDistribution[0,1]]}&/@RandomReal[{AbsoluteTime@dtIni,AbsoluteTime@dtFim},500];          DateListPlot[data         ,FrameTicks->{Automatic,{DateRange[dtIni, dtFim, "Hour"],None}}         ,GridLines -> {If[MemberQ[{0,7,12,18},Last@#],{#,Gray},{#,LightGray}]&/@DateRange[dtIni, dtFim, "Hour"],{#,LightGray}&/@{0.5,1,2,5,10,20}}         ,DateTicksFormat->{"Hour"}     ]      I don't know if the best idea is try to scale the X axis, or join 3 charts, one for each time period using something like this dismembered data:               dataP1 = Select[data, #[[1]] < AbsoluteTime@{2013, 1, 1, 7} &];     dataP3 = Select[data, #[[1]] > AbsoluteTime@{2013, 1, 1, 18} &];     dataP2 = Complement[data, dataP1, dataP3];      I think that the axis scale solution appear to be more elegant, but I don't know how to implement it. 3 Graphics join will be welcome too. Any Clue?


title: speed up for computing MatrixExp

text: My code use two method to computing `MatrixExp`, I expected the second snippet code will faster than the first one, but in fact it a bit slower than that. How can I imporve my code?               nnx = 100;     pp = RandomReal[{-1, 1}, 2 {nnx, nnx}];     {n, q, num} = {2, 3, 16};     (*-------------------------*)     t1 = AbsoluteTime[];     {nn, nn} = Dimensions[pp];     a = Sum[((2^-num)^i MatrixPower[pp, i])/i!, {i, n*q}];     res1 = IdentityMatrix[nn] + Nest[(2 # + #.#) &, a, num];     AbsoluteTime[] - t1     (*-------------------------*)     t1 = AbsoluteTime[];     {nn, nn} = Dimensions[pp];     pp1 = 2^-num*pp;     QQ = MatrixPower[pp1, #] & /@ Range[q];     NN = MatrixPower[pp1, q*(# - 1)] & /@ Range[n];     a = Sum[NN[[nn]].QQ[[qq]]/(qq + (nn - 1)*q)!, {nn, n}, {qq, q}];     res2 = IdentityMatrix[nn] + Nest[(2 # + #.#) &, a, num];     AbsoluteTime[] - t1     (*-------------------------*)     res1 - res2 // Chop // Flatten // Union     res1 - MatrixExp[pp] // Chop // Flatten // Union


title: What Cell Option Controls Group Indentation?

text: I am working on a stylesheet for a handout I am making and I want to make my own "definition" box format. So I use the "Format"->"Edit Stylesheet" menu option and get the stylesheet inspector. I then type in the name of my new stye name "DefinitionBox" and give it the style that I want. The problem is that when I apply this style it doesn't indent withing the group (ie Section or Subsection) it is in, instead it just spans the full window. For the life of me I can't figure out what option controls this. Any suggestions?


title: Function derivatives in arbitrary dimension

text: I have a higher dimensional function: $$f(x,t)=-\ln(t)-\ln(1-\left\|x\right\|^2-t^2)$$ where $x\in\mathbb{R}^n,~t\in\mathbb{R}$. I want to compute the derivatives with the commands               D[f, xi]     D[f, t]     D[f, xi, t]       and higher, to check my own computations which I do by hand. I dont know how to define the function $f$ to apply the commands. Im new _Mathematica_ user and I've not found a right solution Documentation Center.


title: Emacs key bind on Mathematica Linux

text: This might not be _Mathematica_ specific question but if there is anyone who can use Emacs keybind on Ubuntu Linux, would you share how you realize it? I'm using _Mathematica_ student edition both on Mac OS X (10.7.3) and Ubuntu (11.10), and Mac version allows basic Emacs keybind (`Ctrl`+`a`, `Ctrl`+`e`, `Ctrl`+`d`, `Ctrl`+`f`, `Ctrl`+`b`, etc.) In general, GUI programs on my Ubuntu doesn't allow Emacs keybind unless explicitly configured per program, so as I said I might have to look for general solution for Ubuntu/Linux. But I welcome whatever the solution to realise the keybind. * * * _Update:_ Thanks to @sebhofer's answer, I manage to comfortably use Emacs keybind on Ubuntu. I had to modify both `MenuSetup.tr` and `KeyEventTranslations.tr` to enable my preferred keybind. As a reference for other people who may want to enable Emacs keybind, I'm sharing those 2 files here: http://goo.gl/nJaXD and http://goo.gl/gZWS5, which allow following keybinds:               C-v "ScrollPageDown"     C-d "DeleteNext"     C-h "DeletePrevious"     C-p "MovePreviousLine"     C-n "MoveNextLine     C-b "MovePrevious"     C-f "MoveNext"     C-t "MoveNextWord"     C-i "MovePreviousWord"     C-e "MoveLineEnd"     C-a "MoveLineBeginning"      Some of the above might not be the standard Emacs keys. Also, more importantly, some default keybinds that use `alt` might not work due to the change (I haven't tested thoroughly). You can customize by modifying those `.tr` files.


title: Unicode-aware string functions?

text: I've recently discovered that `ToUpperCase` is quite unreliable on non-ASCII input: ![see code below](http://i.stack.imgur.com/my6SR.png)               In[31]:= ToUpperCase@{"éàÇœßþσς", "ĳķǌđӽծ", "ÿ"}     Out[31]= {"ÉÀÇŒSSÞ∑∑", "ĳķǌđӽծ", "Y"}      So: it handles some accented ASCII, ligatures, Western European stuff, greek and cyrillic, while it fails on others (returning the lowercase characters themselves when they have valid uppercase variants). In at least one case, it fails utterly (the uppercase version of `ÿ` is `Ÿ`, not `Y`). Mathematica’s documentation is very short on specifics on Unicode support. It broadly states that: > Mathematica has efficient systemwide 16-bit Unicode support, allowing a full > range of international, technical and other character sets and character > encodings. which of course I very much doubt after seeing the above. More specifically, the `ToUpperCase` doc does not include a mention of Unicode. * * * So, after that bleak assessment, the question is the following: **how do I get better Unicode-compliant string manipulation functions?** (mostly `ToUpperCase` and `ToLowerCase` for now, but I'm sure others will be a problem for me in the future). Are there internal functions that do this, or external packages? Have I missed something in M’s documentation? * * * _On a humorous note:_ the documentation for `ToUpperCase` even uses my example of a buggy transform (`ÿ`) in an example. It is, however, used about an unrelated issue, to warn users that “for a few characters, ToLowerCase is not the inverse of ToUpperCase” (as might be expected by Unicode-unaware programmers): ![enter image description here](http://i.stack.imgur.com/NvSl2.png) * * *


title: Looking for a package regarding Schur Polynomials and Kostka numbers

text: I'm currently looking for any Mathematica package that involves Schur polynomials and/or Kostka numbers. More generally, I'd be happy with anything that expands on symmetric polynomials in general. Does such a thing exist? I've had no luck finding any.


title: Iteration of a function

text: I have a function $f(x)=x^7+k$ I want to iterate $xn+1=g(xn)$, 50 times starting with $x0=1$ and keep the last 10 values I want to assign these values to a function `y` and be able to use `y` to calculate this iteration for any input constant $k$, eg $k=0$, $k=0.1$, then store all the corresponding 10 values I have extracted for $k=0$, $k=0.1$, up to 1 in a table. Is this possible? I can't figure it out. I have only done this and I am stuck: `Take[NestList[f, 0, 50], -10]`


title: Show parameters on graph

text: I am graphing the 4 PDFs for a distribution for 4 different parameters in the same graph. I want the values of the parameters to be shown in corner of the graph. How do I do this?


title: Manipulate not working inside DialogInput

text: Some controls do not appear to work with `Manipulate` inside a `DialogInput`. For example:               DialogInput[{Manipulate[x, {x, {1, 2, 3}}], DefaultButton[]}]      does not work, but the slider version:               DialogInput[{Manipulate[x, {x, 1, 3, 1}], DefaultButton[]}]      does work. Is this a bug or am I missing a vital option setting?


title: Solve within a range?

text: Is it possible to solve an equation in which some some of the parameters have defined ranges? Example:               Solve[x^2 + 0.09149 x + 6.263*10^-6 + kp (10.95 x + 0.9574) == 0 &&            y^2 + 0.09149 y + 6.263*10^-6 + kp (10.95 y + 0.9574) == 0 &&            kp (10.95 z + 0.9574) == 0, {kp}]      where `x < -4` and `y < -5` and `0 > z > -5`. I am trying to solve for variable `kp` and would like to know how the value of `kp` differs for different values of x, y and z which is defined. X and y shall of course have some kind of max value for which it shall evaluate the solve function. Ohh.. one important fact. Kp can't become negative. it's the main reason why i want to to solve it for for changing parameter defined within a range.


title: Define product derivative

text: How do I define the $n$th product derivative of a function in _Mathematica_? The first product derivative $f^\ast$ of a function $f$ is $$ f^\ast(x)=\exp\left(\frac{f^\prime(x)}{f(x)}\right) $$ The $n$th product derivative is the result of applying this operator $n$ times. This is my attempt at a recursive definition:               In[111]:= Clear[prodd]     prodd[f_, n_] := prodd[e^(f'/f), n - 1]; prodd[f_, 0] = f          Out[112]= f               In[113]:= prodd[E^x, 1](* Should print E *)          Out[113]= e^(E^-x Derivative[1][(E^x)])          In[114]:= prodd[E^E^x, 1](* Should print E^E^x *)          Out[114]= e^(E^-E^x Derivative[1][(E^E^x)])          In[114]:= prodd[E^x, 2](* Should print 1 *)


title: MUnit creating a hierarchy of TestSuites

text: I would like to create a hierarchy of `TestSuites`. However it appears that it is not possible to call a `TestSuite` from another `TestSuite`. So before I go and reinvent the wheel, I thought I would see how others have done (or would) accomplish this. * * * **Details of what I am trying to accomplish** I have grouped packages (and their tests) that perform like functionality by directory. For illustrative purposes lets say I have three subdirectories: importers, manipulators, and processes. I have a TestSuite in each subdirectory named TestAll.mt . I also have one in the top level directory called TestAll.mt that I would like to have call the TestAll.mt in the three subdirectories. I would like to be able to run the test suites at both the subdirectory and top levels. Running the test suite at the subdirectory level would only run the particular subset of tests, while running the test suite at the top level would run the test suites in all the subdirectories. I would like to avoid having to add an entry for a particular test to both the subdirectory and top level test suites. A bonus would be if the top level test suite auto discovered the test suites in the subdirectories (not having to specify the subdirectories in the root test suite), but that is not crucial. ## Update * * * Attempt #1 -- Make a list of .mt files in each of the sub TestAll.mt s. If the top level TestAll.mt is called, the sub levels' lists would be appended to the top level's list and then that list would be supplied to TestSuite. If a sub level's TestAll.mt is called, its list would be supplied as the argument to TestSuite. **Result:** Failure From Workbench, adding any expression to a .mt that contains `TestSuite` appears to cause none of the tests to run.               x=1;     TestSuite[         {             "Test1.mt",             "Test2.mt"         }     ]      From a notebook, `TestSuite` shows up in command completion, but does not show up in the MUnit package usage info. Executing the following:               TestSuite[      {       "/pathToTests/Test1.mt",       "/pathToTests/Test2.mt"       }      ]      Results in:               TestSuite[{"/pathToTests/Test1.mt", "/pathToTests/Test2.mt"}]      Searched the MUnit package files for TestSuite, no hits.               cd "/Applications/Wolfram Workbench.app/configuration/org.eclipse.osgi/bundles/214/1/.cp/MathematicaSourceVersioned/Head/MUnit"     find . -name "*.m" -print -exec grep TestSuite {} \;      * * * Attempt #2 -- Roll my own `TestSuite` ...


title: Obtaining a thin/compact SVD

text: I'm using `SingularValueDecomposition` for a least-squares regression, the instruction that works fine for what I need is               SingularValueDecomposition[X,Length[SingularValueList[X]]]      Is there a way to do the same thing but without calling `SingularValueList` as I suppose similar computations are done two times in `SingularValueDecomposition` and `SingularValueList` ?


title: Singularities using VectorPlot

text: I am trying to plot a vector function of a fluid flow given by $\vec{V} = (\frac{-\cos(\theta)}{r^2},-\frac{\sin(\theta)}{r^2})$ I am trying to plot it in Mathematica using the command below, I converted to Cartesian coordinates by the way. But this does not run in Mathematica. Without the `Exclusions` option, I only get one arrow at the origin. Can you help me with this plot?               VectorPlot[           {-(x/(x^2 + y^2)^(3/2)), -(y/(x^2 + y^2)^(3/2))},            {x, -1, 1}, {y, -1, 1},            Exclusions -> {(x^2 + y^2)^(3/2) == 0}       ]