title: Constructing symbol definitions for With

text: I would like to be able to define two arrays, one containing symbol names and one containing the values of those symbols, for use in constructs such as `With`. For example:               params = {a,b,c,d};     vals = {1,2,3,4};     With[{a=1,b=2,c=3,d=4},Print["Do something fancy"]]      I would like to construct the local variable assignment array {a=1, b=2, ....} automatically. The wishful thinking solution of `With[params = values, ...]` doesn't work and I've tried a random selection of Mapping, Threading and Holding, all to no avail. It looks like a similar question has been answered before however the function proposed by Leonid doesn't work in the `With` block. I suspect my issue focuses on an attempt to manipulate Symbols in a non-trivial manner (and by non-trivial, I simply mean anything beyond a = 1).


title: Plotting Phase Space

text: I have these two Equ' $$x'[t]=Sin[y]$$ $$y'[t]=Cos[x]$$ and im trying to plot the phase space(plane) for this system... ive tryed Equationtrekker but cant seem to find the way to use it this way... any help? Thanks!


title: Need help with phase diagram in mathematica

text: Sketch the phase diagram for systems with the following velocity functions where a and b are constants with b > a > 0 a. dx/dt = a, dy/dt = b b. dx/dt = a, dy/dt = x Please can someone show me how to draw the phase diagrams for these two functions here?


title: How can I draw this particular phase diagram in Mathematica?

text: Sketch the phase diagram for systems with the following velocity functions where `a` and `b` are constants with `b > a > 0`               a. dx/dt = a, dy/dt = b     b. dx/dt = a, dy/dt = x       Please can someone show me how to draw the phase diagrams for these two functions here? I know these functions are too simple but this is what we are learning to do in our class right now. So, I'd appreciate some help. Thanks.


title: Phase space vector field

text: I have a system of non linear equations and from `NDSolve` I get the solution. I plot the phase space with `ParametricPlot[{y1[t],y2[t]}/.solution,{t,0,10}]`. I want to plot the vector field and I want your help. To be more specific, I want to see whether the fixed points are stable or unstable. I know how to do it by watching them from nonlinear dynamics, but the vector field is a much more faster way to figure out about the stability of the fixed points.


title: Plotting a Phase Portrait

text: I'm trying to plot a phase portrait for the differential equation $$x'' - (1 - x^2) x' + x = 0.5 \cos(1.1 t)\,.$$ The primes are derivatives with respect to $t$. I've reduced this second order ODE to two first order ODEs of the form $ x_1' = x_2$ and $x_2' - (1 - x_1^2) x_2 + x_1 = 0.5 \cos(1.1 t)$. Now I wish to use mathematica to plot a phase portrait. Unfortunately, I'm unsure of how to do this because of the dependence of the second equation on an explicit $t$. Thanks.


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

text: The situation is that I have a List like this:               A = {{1, 11}, {1, 12}, {1, 17}, {1, 20}, {1, 52}, {4, 179}, {5, 10}, {5,        55}, {12, 16}, {13, 274}, {15, 206}, {17, 16}, {17, 23}, {17,        24}, {17, 25}, {22, 82}, {26, 131}, {30, 222}, {30, 391}, {40,        24}, {41, 31}, {41, 54}, {41, 78}, {41, 82}, {43, 42}, {44,        67}, {45, 21}, {47, 81}, {49, 192}, {52, 10}, {56, 67}, {56,        76}, {56, 79}, {56, 81}, {56, 89}, {56, 90}, {56, 91}, {56, 92}}      I would like to order the list A by frequencies from first component. I tried figure out this order with this function:                frec = Table[i[[1, 1]]  , {i,            Sort[Tally[A, #1[[1]] ==   #2[[1]]  & ], #1[[2]] > #2[[2]] & ]}]     {56, 1, 41, 17, 30, 5, 52, 49, 47, 45, 44, 43, 40, 26, 22, 15, 13, 12,               4}      It means that 56 appears as first component more than 1, and so on. But I really don't know how to use this order to produce something like this:               A = {{56, 67}, {56, 76}, {56, 79}, {56, 81}, {56, 89}, {56, 90}, {56, 91},         {56, 92},{1, 11}, {1, 12}, {1, 17}, {1, 20}, {1, 52},{41, 31}, {41, 54}, {41, 78}, {41, 82},{17, 16}, {17, 23}, {17, 24}, {17, 25}, ...       In advance, thanks to see the question.


title: Option AutoAction of Manipulate doesn't respond under Ubuntu

text: I'm using _Mathematica_ 10.0 under Ubuntu 14.04. When using the function `Manipulate` with option **AutoAction** , I find that the slider doesn't respond to my mouse movement _without clicking_. I need to _drag_ to move it. Similarly, every function that has the option **AutoAction** , such as `LocatorPane`, doesn't respond to my mouse movement as well. But under Windows 8.1, it works well. I refered to this page: Manipulate (Linux version of Mathematica). But my OpenJDK seemed to be up-to-date. What should I do? **Reference:** AutoAction - Wolfram Mathematica Documentation Center P.S. My OpenJDK version: > java version "1.7.0_55"   >  OpenJDK Runtime Environment (IcedTea 2.4.7) (7u55-2.4.7-1ubuntu1)   >  OpenJDK 64-Bit Server VM (build 24.51-b03, mixed mode)


title: Select gives different answers in versions 8 and 9

text: Consider the code below:               s = Solve[(3 - Cos[4*x])*(Sin[x] - Cos[x]) == 2, x, InverseFunctions -> True];     Select[s[[All, 1, 2]], Element[#, Reals] &]      In MMA 8.0, I get               {-\[Pi], \[Pi]/2, \[Pi]}      but in MMA 9.0, I get an empty set { } Assuming the solution by MMA 8.0 is correct, can someone show me a work around for MMA 9.0?


title: Initial and boundary value errors

text: > NDSolve::ivone: Boundary values may only be specified for one independent > variable. Initial values may only be specified at one value of the other > independent variable. >> I keep getting this, although I wish to use NDSolveValue to solve the following differential equation: $\ u_{xx}-\frac{u_t}{\sqrt{t^2+x^2}}=-6u^5+(8+4e)u^3-(2+4e)u $ where e is a parameter, with the initial conditions being $\ u(0.001,x)=tanh(x), u_t(0.001,x)=0$ and the boundary conditions being $\ u(t,0)=0,u(t,6)=1 $. I have loads of operations I wish to perform on the solution, but every single operation depends on getting the solution in the first place. Here's the code I intend to run in order to perform everything I want on it:               eps4 = 0;     phi6m4 = NDSolveValue[{        D[u[t, x], x, x] -         D[u[t, x], t]*1/Sqrt[t^2 + x^2] == -6 u[t, x]^5 +              (8 + 4 eps4) u[t, x]^3 - (2 + 4 eps4)u[t, x],        u[0.001, x] == Tanh[x],        Derivative[1, 0][u][0.001, x] == 0,        u[t, 0] == 0, u[t, 7] == 1}          , u, {t, 0.001, 6}, {x, 0, 7}];      > NDSolveValue::ivone: Boundary values may only be specified for one > independent variable. Initial values may only be specified at one value of > the other independent variable. >>


title: How to plot X and Y data to see average data converging?

text: I initially have ran a large, say 1000 (to be changed later) number of monte carlo simulations (mcRun), and I want to see when the average data result starts to converge to a reasonable value. So I basically first ran 1000 simulations, and took average data based on 0 to first 10%(100), then average data based on 0 to 20%(200) and so on. So just to show the data: For[n = 0, n < 10, n++, Print [data[n]]] {622.917} {583.165} {564.45} {570.583} {584.956} {583.185} {579.662} {572.974} {570.253} {558.536} So how to plot this data where Y is data[0] to data[9] and X is 0.1 mcRun, 0.2mcRun...1 mcRun. Or possibly 3D animate later using Manipulate? as I will have more sensitivity analysis to be done later.


title: More than one expression in the Table[] command?

text: I would like to construct a Matrix using the Table[] command. The issue is that I would like to use more than one expression for it. What I need to obtain is something like this :               {{f[1, 1], g[1, 1], f[1, 2], g[1, 2]}, {f[2, 1], g[2, 1], f[2, 2],g[2, 2]}}      I tried to write a table containing the two expressions f[i,j] and g[i,j] inside the Table[] command but without success... What I obtain instead is something like this :               In[8]:= Table[{f[i, j], g[i, j]}, {i, 2}, {j, 2}]          Out[8]= {{{f[1, 1], g[1, 1]}, {f[1, 2], g[1, 2]}}, {{f[2, 1],         g[2, 1]}, {f[2, 2], g[2, 2]}}}      What would be the correct syntax to construct these type of matrices? Or am I completely wrong trying to use the Table[] command?


title: Parallelize plotting

text: I'm using Mathematica to make a few 3d plots. ~~For the sake of generality, let's say they are unrelated to each other (so I can't imagine making a table out of them)~~. However, the machine I'm using has 4 cores and plotting (evaluating the function at different points can be done pretty much independently, so I should be able to parallelize my plots (or even a single plot for that matter). How can I do this? Ps: If the question is not clearly posed or more information is needed, let me know. Edit: @halirutan's answer corrects my mistake, which I've now struck off.


title: Select row from a table by column value

text: I have the following:               animals = {{dog, black, 200}, {cat, white, 100}, {moose, brown, 500}, {zebra,black,100}}      If this came from a SQL table called animals, which has fields named: type of animal, color, weight I would say:               Select * from animals WHERE weight = 100      How do you do this in _Mathematica_?


title: Data Table Manipulation in Mathematica

text: I am a statistician searching for an efficient way to select rows or columns from a table of data in _Mathematica_. Let me pose the question in 2 parts with a SQL-style table of data:               List[{"ID", "Variable 1", "Variable 2"}, {"Alpha", 1, 0}, {"Beta", 1, 1}, {"Alpha", 1, 0}]]      Which, when formatted as a Grid looks roughly like this:               ID     Variable 1 Variable 2     Alpha       1          0     Beta        1          1     Alpha       1          0      **Part 1: How can the data in the header of the table, for example "ID", be set as the name of the list for that column? Ideally, the result would allow you to do the following:**               In[24]:= ID          Out[24]= {"Alpha", "Beta", "Alpha"}      _Would one need to write a function to dissect the header row and then line up the header names as the name of a list that corresponds to the appropriate header? Although one might ask 'Why not refer to everything as a position and avoid the renaming headache entirely?' it is extremely cumbersome when working with tens or hundreds of columns/variables to use a meaningless position to reference a variable._ **Part 2: How can an individual row, or subset of rows, be returned from a table? Essentially I'm looking for the equivalent of the "WHERE" clause in SQL or the "subset" function in R.** _For example in the "ID" column I might want to retrieve all the rows where "ID" == "Alpha". Do I have to create a method that iterates over the "ID" list, stores the position in the list where the value of the element is equal to "Alpha", and then concatenate a list that contains the value in that position for all the other lists?_ I'm confident I could write the functions I mention, but it seems unconscionable that Mathematica would overlook such a rudimentary data manipulation task. I understand there's also the DataManipulation package that allows for SQL queries, but I have to believe (hope?) there's a way native to Mathematica that's quicker. Thank you for indulging me! And my apologies in advance to all the Mathematica aficionados who might see this as a corrupt question for trying to program in another language while in Mathematica!


title: Simplifying nested If statements

text: Consider :               list = {100,102,103,99,106,107,104,112}      I want to consider, extract only the "big moves" of that time series. In this case the moves bigger then 5 from the moving point of reference. The pseudo code would go as such : Let's assume you have the data `x(t)` for `t=1` to `T`, You start from the first data point, `z(1) = x(1)`               if abs(x(2)-z(1))> delta,          z(2)= x(2),      elseif abs(x(3)-z(1))> delta,          z(2)= x(3),      elseif abs(x(4)-z(1))> delta,          z(2)= x(4),             if abs(x(5)-z(2))> delta,              z(3)= x(5),          elseif abs(x(6)-z(2))>delta,              z(3)= x(6),             if abs(x(7)-z(3))>delta,                  z(4)=x(7)             endif         endif     endif      I tried to write it with an `If` statement, but I don't know when my test is going to pass thus, how many `If`s to nest.               If[Abs[list[[2]]-list[[1]]]>5,        list[[2]],                  If[Abs[list[[3]]-list[[1]]>5,                  list[[3]]....      Here this process will stop at `list[[5]]` with `Abs[list[[5]]-list[[1]]=6` At this point, `list[[5]]` becomes my new point of reference :                If[Abs[list[[6]]-list[[5]]]>5,          list[[6]],                   If[Abs[list[[7]]-list[[5]]>5,                  list[[7]]....      So my desired output is the following :               {100,106,112}      I am pretty sure, this type of operation has a name but I don't know it. It felt like a `While[]` or `For[]` but I can`t figure it out. Please let me know how to improve the question.


title: Kernel inexplicably hangs if I define a pure function without suppressing output

text: **Save any unsaved work before trying as it may crash Mathematica and other programs by filling up the memory!** In v9.0.1.0 on OSX 10.8.5, if I start a new session and define two functions               f1P = Sin[#^Sin[Sqrt[Gamma[#]]]] &;      and               f2P = Sin[#^Sin[Gamma[(# + 1)]]] &;      they both work fine. Now, if I quit the kernel and define _the exact same functions_ but removing the `;`s when I evaluate the cell with `f1P`:               f1P = Sin[#^Sin[Sqrt[Gamma[#]]]] &      I get some output (`Sin[#^Sin[Sqrt[Gamma[#]]]] &`). Then if I try to evaluate the cell with the second function definition the kernel hangs indefinitely. In fact the kernel can't handle the definition of `f1P` without `;` at all (if I try to give it values nothing happens). Strangely, this isn't the case with `f2P`: I remove the semicolon, evaluate and it runs fine. But with `f1P` the kernel consumes more and more ~~CPU~~ memory. I have not idea why CPU usage spiked yesterday - I tried this today and it increased to ~35% but not more. The memory demand keeps growing though until the Kernel gets terminated or until Mathematica crashes. This seems to be a bug with Mathematica on OSX as other people confirmed and I have now reported it to WR so I will edit again once I have confirmation from them. Still, if anyone has any idea what might be happening I'd like to know. **\---EDIT---** This issue has been resolved in version 10. WR have confirmed the bug which _"causes unusual memory usage on a Mac because of the Predictive Interface"_


title: Integrate with FunctionInterpolation differs from NIntegrate

text: In working with interpolating functions and integration, I noticed a lot of differences between `NIntegrate` and `Integrate` in the case of a function applied to an interpolating function. In order to provide a simple example, look at this output:               ifun = Interpolation[ {{0, 0}, {1, 1}, {2, 3}, {3, 4}, {4, 3}, {5, 0}}]     NIntegrate[x*ifun[x], {x, 0, 5}]      > >     32.5694 >                 xifun = FunctionInterpolation[x*ifun[x], {x, 0, 5}]      > FunctionInterpolation::precbd: Requested precision [Infinity] is not a > machine-sized real number between \$MinPrecision and \$MaxPrecision. >>               out = Integrate[xifun[x], {x, 0, 5}];     N[out]      > >     32.591 >   The difference is at the second decimal place, or of the order of 0.06%. For more complicated functions (lots of data values and Bessel functions, I get errors of more than 100%). I would like to know the reason of the error. In my real-life example I only get correct answers using the `NIntegrate` method. I know there is this other question: How to integrate functions of linearly interpolated data? But they don't use `FunctionInterpolation` and I think that there should be a simple explanation for this difference. My data is also not linearly- interpolated.


title: Import tweets from Twitter

text: Robert Raguet-Schofield in the Mathematica Blog introduced a way to import tweets from Twitter into _Mathematica_. I attempted to use this method. I started with this line of code:               xml = Import["https://twitter.com/statuses/user_timeline.xml?screen_name=WolframResearch"]      and received this message: > FetchURL::httperr: The request to URL > https://twitter.com/statuses/user_timeline.xml?screen_name=WolframResearch > was not successful. The server returned the HTTP status code 404 ("Not > Found"). Then I tried this               xml = Import["https://twitter.com/WolframResearch"]a      and this time I got some output. But when I continue the procedure to extract the tweets with this line               tweets = Cases[xml, XMLElement["text", _, {s_String}] :> s, ∞]      I get an empty set. How can I import tweets into _Mathematica_ in an effective way, given I am not a familiar with Apachi?


title: Accessing Twitter API using Mathematica

text: How do interact with the Twitter API using Mathematica? SocialMediaData is a lovely function, but appears to be severely limited in what it can draw from Twitter. For example, if I want to get a list of retweets of a Tweet I've sent there's an API call for this but not a means of doing so through SocialMediaData. How do I augment the function with all the API has to offer?


title: Finding a mapping between elements in two lists that satisfy some criterion (such as being less than threshold Euclidean distance apart)?

text: I have two lists of $d$-dimensional coordinates, for example setting $d=3$ we might write:               L1 = {{1,2,3},{4,5,6},{7,8,9},{999,999,193}}     L2 = {{80,-10,-12},{1.1,2.4,3.1},{6.99,8.0435,8.999},{4,5.02,6.02}}      Here, some of the elements in $L_2$ are just the elements in $L_1$ perturbed in 3-space by some small amount (a MSD $\leq 0.5$), with the mapping $(1,2,3) \to (2,4,3)$ and where the coordinates at positions four in $L_1$ and one in $L_2$ do not having a mapping (i.e. there's not necessarily a bijection for the lists). Is there a simple "one-liner" in Mathematica 9 that allows us to compare two lists and return a list of points that satisfy some mapping criterion, e.g. Euclidean distance in the above example? Update - For the above example, setting the Euclidean distance to $R=1$ we'd specifically like to output: {{{1,2,3},{1.1,2.4,3.1}},{{4,5,6},{4,5.02,6.02}},{{7,8,9},{6.99,8.0435,8.999}}} (Elements can be in whatever order.) Could we do this for a set of more than two lists?


title: print the name of the variable in a list without evaluation

text: a := az + 1     b := bz + 5     list := {a, b}      I'd like mathematica to print               a = az + 1     b = bz + 5      so basically it needs to first print the name of the variable in the list, followed by "=", and followed by the actual content of the variable. **update (1):** so here is something close to what I want               a := az + 1     b := bz + 5     list := {Hold@a, Hold@b}     Column[Table[Print[list[[i]], "=", ReleaseHold@list[[i]]], {i, 1, 2}]]      outputs:               Hold[a]=1+az     Hold[b]=5+bz      However, I don't know how to get rid of `Hold[]`. I'm also hoping there is a more elegant way.


title: How to split a file?

text: Is there a way to split an external file using Mathematica? (Other than importing it, dividing it internally and exporting the parts) For instance like some File Split utility do.


title: Generating high quality charts in Mathematica for use in LaTeX and Word

text: I frequently have a probelem using my charts in reports because the text (axes labels and tick marks) look low resolution (fuzzy). When I export my charts, i export them as PNG files. Unless I'm mistaken, this is the correct file format for vector graphics. In _Mathematica_ , the charts look great at any size, but when I export and drag them into Word, they don't look nearly as nice any more. Does any one have any tricks they use to use the _Mathematica_ charts in applications like Word?


title: How to properly plot a response of a transfer function in Mathematica?

text: I'm trying to display the output response of a transfer function in Mathematica with and without a compensator. The problem is very strange: while the transfer function compensate is showing well, the other is not. The plot seems incomplete and no matter what `PlotRange` I set, the graph always stays incomplete at the same point. Here is a screenshot: ![enter image description here](http://i.stack.imgur.com/w43qV.png) Anybody have an idea of what is wrong? I'm pretty sure the math itself is okay, because I get the second transfer function from the first. But when I want to compare the two responses graph, the first always stays incomplete.


title: Looking for a input template for Limit

text: I'm using v. 8. I'm looking for a limit input template (analogous to the integral template), but I can't seem to find it in any of the palettes. Can anyone help? Edit: I'm looking for a 2D input (traditional form) purely for typesetting purposes (no calculations) Something analogous to the integral template (pictured below): ![enter image description here](http://i.stack.imgur.com/0n8R3.png)


title: Redirect of mathematica graphics output to another computer screen

text: I need send the result of my calculation to the screen connected to HDMI output as a full-screen image. As I understand, I need change the DisplayFunction to usage of certain OutputStream. Do anybody help me with creation of proper DisplayFunction? Which parameters are needed? Now I use DisplayFunction->CreateDialog and manually move the window to second screen, but it is evidently stupid way.. I need more or less precise alignment of an image at the HDMI-screen, which is normally reproducible each time.. Could anybody show me right way for creation of the true redirection of graphics output?


title: Manipulate - why does the axis scale change when I release the slider?

text: I was playing around with Manipulate to demonstrate simple geometric idea of conic sections and put this little sample together. When i move the slider it moves my plane, which is what I expect. However, when I let go of the slider, the graphics are rescaled. So how I stop that? I have set the `PlotRange` and `AspectRatio`, so I don't understand why the scale is changing.               Manipulate[       plot = Plot3D[n, {x, -1, 1}, {y, -1, 1},         AspectRatio->1, PlotRange->{{-1, 1}, {-1, 1}}, Mesh->False];       cone = Graphics3D[{Opacity[0.3], Cone[{{0, 0, -1}, {0, 0, 1}}, 1]},         PlotRange->{{-1, 1}, {-1, 1}}, AspectRatio->1];       Show[{plot, cone}, AspectRatio->1],       {{n, 0}, -1, 1}]


title: How to extract sample values from an imported WAV file?

text: Suppose I read a file with               B = Import["something.wav"]      Now how can I obtain a list of sample values?


title: What's wrong with this pattern of the form Except[Repeated[....]]?

text: I'm trying to build a head that recognizes molecules. Here's the code               Mol::arg = "Invalid molecule.";     Mol[Except[Subscript[_String, _Integer] ..]] := Message[Mol::arg]      I'd expect that this code should recognize molecules of the form               Mol[Subscript["C", 4], Subscript["N", 5]]      but it should issue the message if something like               Mol[Subscript["C", 4], 7]      is entered. However, when I enter this last one, no message is issued. I don't understand what I'm doing wrong.


title: Finding the eigenfunctions of one and two dimensional Harmonic Oscillator

text: (Edited) For finding the ground state wave function of: $ H\psi(x) = (-1/2)d^2\psi(x)/dx^2 + (1/2)x^2\psi(x) = E \psi(x)$ I have written:               mOneDSchEq[n_] :=     Table[Switch[i - j, -1, p[x[i]],      0, (10/(n + 1))^2 q[x[i]] - 2 p[x[i]], 1, p[x[i]], _, 0], {i,      n}, {j, n}];          q[x_] := -x^2; p[x_] := 1;     Xarray[n_] := Do[x[i] = -5 + i 10/(n + 1), {i, 0, n + 1}];          EigVec[n_] := Eigenvectors[mOneDSchEq[n]];     lisEigVec = EigVec[35];     OneEigVec[j_] := Part[Reverse[lisEigVec], j];     y[i_] := Part[OneEigVec[1], i];     listOfPoints =      Join[{{x[0], 0}}, Table[{x[i], y[i]}, {i, 1, 35}], {{x[36], 0}}];     ListPlot[listOfPoints, PlotJoined -> True, PlotRange -> All,      PlotLabel -> "Ground State Wave Function of Harmonic Oscillator",      AxesLabel -> {"x", "y"}]      Which I have obtained the Gaussian, correctly. The question that came to my mind is that: Is it possible by knowing the ground stat eigenvalue, i.e. 1/2, solving the Schrödinger equation numerically, and obtain the ground state wave function? in other words, to solve: $ H\psi(x) = (-1/2)d^2\psi(x)/dx^2 + (1/2)x^2\psi(x) = (1/2) \psi(x)$ or $ H\psi(x) = (-1/2)d^2\psi(x)/dx^2 + (1/2)x^2\psi(x) = (3/2) \psi(x)$ So, I wrote:               s = NDSolve[{-(1/2) \[Psi]''[x] + (1/2) x^2(\[Psi][x]) == (1/2) \[Psi][       x], \[Psi][-5] == 0, \[Psi][5] == 0}, \[Psi], {x, -5, 5}]          Plot[Evaluate[\[Psi][x] /. s], {x, -5, 5}, PlotRange -> All]      BUT, I got nothing. What is the problem? The other question is that, I was traveling through the website and found an elegant approach to two dimensional Harmonic Oscillator here. My question is, if again we want to solve the Schrödinger equation numercally and obtain wave functions, now two dimensional, by knowing the eigenvalues, what should we do? For example: $ H\psi(x,y) = (-1/2)(d^2/x^2 + d^2/dy^2)\psi(x,y) + (1/2)(x^2 + y^2)\psi(x,y) = (1) \psi(x,y) $ and $ H\psi(x,y) = (-1/2)(d^2/x^2 + d^2/dy^2)\psi(x,y) + (1/2)(x^2 + y^2+ x y)\psi(x,y) = (0.96) \psi(x,y) $ Thanks for your attention!


title: How to express this output in the form $X=A.x$?

text: This problem arose in my stereo vision project. I have two matrices: $$ A = \left( \begin{array}{ccc} \text{x1}*\text{p131}-\text{p111} & \text{x1}*\text{p132}-\text{p112} & \text{x1}*\text{p133}-\text{p113} \\\ \text{y1}*\text{p131}-\text{p121} & \text{y1}*\text{p132}-\text{p122} & \text{y1}*\text{p133}-\text{p123} \\\ \text{x2}*\text{p231}-\text{p211} & \text{x2}*\text{p232}-\text{p212} & \text{x2}*\text{p233}-\text{p212} \\\ \text{y2}*\text{p231}-\text{p221} & \text{y2}*\text{p232}-\text{p222} & \text{y2}*\text{p233}-\text{p223} \end{array} \right) $$ $$B = \left( \begin{array}{c} \text{p114}-\text{x1}*\text{p134} \\\ \text{p124}-\text{y1}*\text{p134} \\\ \text{p214}-\text{x2}*\text{p234} \\\ \text{p224}-\text{y2}*\text{p234} \end{array} \right) $$ I computed the following vector k:               k = Simplify[Inverse[Transpose[A].A].Transpose[A].B]      And mathematica output a huge answer for k (as expected), wich I think it's not necessary for me to type it in here. Here is where my problem starts. This computation must be done at 120 Hz, where all entries of A and B are known, but only $\text{x1,x2,y1}$ and $\text{y2}$ change from time to time (forcing me to recompute the whole transpose and inverse thing every time they change). I would like to express the matrix k as $$k = k1*k2 $$ where $k1$ entries are functions only of the $\text{p}_{ijk}$ and $k2$ entries are functions only of $\text{x1,x2,y1}$ and $\text{y2}$. I suppose mathematica won't directly do that, but maybe I could use it to help me in the process. To illustrate better what I mean for $k=k1*k2$ let me do an example: Suppose I have the following vector $k$ $$k=\left( \begin{array}{c} \frac{b+a}{a} \\\ a-b \\\ 1+a.b \\\ \frac{a}{b} \end{array} \right)$$ I could rewrite it as $$ k=\left( \begin{array}{c} 1+\frac{b}{a} \\\ a-b \\\ 1+a.b \\\ \frac{a}{b} \end{array} \right) $$ and then as a matrix multiplication: $$ k=\left( \begin{array}{c} 0 & 0 & 0 & 0 & 1 & 1\\\ 1 & -1 & 0 & 0 & 0 & 0\\\ 0 & 0 & 1 & 0 & 0 & 1\\\ 0 & 0 & 0 & 1 & 0 & 0 \end{array} \right)*\left( \begin{array}{c} a\\\ b\\\ a.b\\\ \frac{a}{b} \\\ \frac{b}{a} \\\ 1 \end{array} \right) $$ Where only the second factor depends on $a$ and $b$ Hope I made myself clear. Any help would be appreciated!


title: Property assignment on a graph vertex using PropertyValue does not work inside a function

text: I created this function:               AddStone[board_Graph, v_, s : white | black | empty] :=         PropertyValue[{board, v}, VertexState] = s      This function should change the VertexState property of vertex `v` in graph `board` to one of `white`, `black`, or `empty`. That's simple enough, right? Then I created a graph:               board = GridGraph[{5, 5}];      But then if I execute:               AddStone[board, 8, white]      I get an error: > "Set::setraw: Cannot assign to raw object PropertyValue[{ ... > ,8},VertexState]=white." where the "..." stands for an image of the graph `board`, which I obviously need not draw here. In the Documentation for `PropertyValue` it is stated that one can set properties this way. In fact, the code               PropertyValue[{board, 4}, VertexState] = white      does work without issuing any messages.


title: Graph label smushed in when printing

text: I was playing around with the printing options because at first my notebook's printout was strangely way too large. However, after apparently solving the problem, now I noticed that when I print out this test graph (adapted from here), the labels and axis titles got smushed in when printing even though they show up fine in both the Working and Printout environment. I tried to remove the formatting of the graph (ImageSize->400, LabelStyle->14, RotateLabel->False) so that MMA would print the graph the best way it sees fit, but that didn't solve the probe Any idea what might have caused this behavior?               energy[theta_, speed_, m_, g_, len_] :=        m g len (1 - Cos[theta]) + (1/2) m len^2 speed^2;          m = 1; g = 9.8; len = 10;          data = Table[        energy[i, j, m, g, len], {j, -4, 4, .01}, {i, -3 Pi, 3 Pi, Pi/20.}];          ListContourPlot[data, InterpolationOrder -> 2, Contours -> 20,       MaxPlotPoints -> 30, DataRange -> {{-3 Pi, 3 Pi}, {-4, 4}},       FrameTicks -> {{{-4, -3, -2, -0, 1, 2, 3, 4},          None}, {{-3 Pi, -2 Pi, -Pi, 0, Pi, 2 Pi, 3 Pi}, None}},       FrameLabel -> {{"\[Theta]'(t)", None}, {"\[Theta](t)",          "constant energy levels for nonlinear pendulum model"}}]      ![Smushed in label](http://i.stack.imgur.com/lj9pM.jpg)


title: How to repeat a plot with different options

text: I'd like to have first a function plot and then the same plot repeated inside a `Manipulate`, with additional things (like tangent planes etc.). I can do               plot=Plot3D[<whatever>]      and then               Manipulate[Show[plot,<whatever>],...]      but there is one problem. I'd like to have the _second_ plot semi-opaque, so that things are more visible. My question is either (1) how to achieve this using my approach with `plot=Plot3D[...]`, or (2) is there any better approach? I've seen this question, but the first answer seemed too complicated (am I wrong?) and the second one didn't work for me...


title: How to compile Map and MapAt

text: I have a long list (say, million of elements, like this one:               {{{1.0, 2.0}, 3}, {{4.0, 5.0}, 6},...}      I would like to compile a function `powq[list_,q_]` that would replace this list by a list in which the terms 3,6,.... are replaced by `3^q`, `6^q`,....:               {{{1.0, 2.0}, 3^q}, {{4.0, 5.0}, 6^q},...}      For a general function `f`, interactively, I can do it as follows:               mf[list_]:=MapAt[f, list, 2]      Then `Map[mf,list]` produces the desired result:               {{{1.0, 2.0}, f[3]}, {{4.0, 5.0}, f[6]}}      But I am having problems with defining               powq:=Compile[{{list,_Real,2},{q_Real]}},....]


title: Is there a way to interactively read a point from a Graphics3D?

text: Suppose I have a tesselation, e.g. the Stanford bunny:               bunny = Import["http://graphics.stanford.edu/~mdfisher/Data/Meshes/bunny.obj", "OBJ"]      ![Stanford bunny](http://i.stack.imgur.com/lOysk.png) I'd like to be able to click on one of the vertices of the tessellation and either get its coordinates, or even better, its index in the `GraphicsComplex`. Is there a way to do this?


title: Importing and manipulating strings - time data

text: I have a list of time durations, which are strings of the form: `"hh:mm:ss"`. Here's a sample for you to play with:               durations = {"00:09:54", "00:31:24", "00:40:07", "00:11:58", "00:13:51", "01:02:32"}      I want to convert all of these into numbers in seconds, so that I can actually do useful things with this data! How would I go about doing this? There must be some way to get _Mathematica_ to extract the relevant things from each string. Thanks. Edit: I'm surprised that there doesn't seem to be a question related to this already - but it may be that I was using the wrong search terms.


title: Help function ? sometimes doesn't show help

text: I was just wondering if this is a known bug. When I want to get basic help using the `?` command before some function name, it typically works for a while, but I've noticed that after I've computed some stuff (like, around 150 or so inputs), _Mathematica_ doesn't pull up the help, but instead just lists the attributes of the command. I'm running version 9.0.1 on OS 10.9.3, but this was also happening on an entirely different system with an older OS (10.6.8 I believe). If I restart the kernel, it works again. If I can reproduce the problem, I will post a screenshot. * * * **Addendum**. I have now been able to take a screenshot of the issue: ![enter image description here](http://i.stack.imgur.com/4XdjX.png)


title: Configure initial directory

text: How can I configure the initial directory? By configure, I mean set it so that when Mathematica starts the initial directory is one of my choosing. By the by, what exactly is the significance of the initial directory? Is that the default location of where a notebook gets saved?


title: Problem with equation solving using Solve

text: I understand that these kinds of questions may be a bit overdone but I can't for the life of me figure out what's wrong with this piece of code.                   Solve[df == (Sqrt[2*Pi]*s)^(-n) &&          cf == 0 && af*s^3 + bf*s^2 +          cf*s + df ==          1/(E^(1/2)*(Sqrt[2*Pi]*s)^n) &&          ak*s^3 + bk*s^2 + ck*s + dk ==          1/(E^(1/2)*(Sqrt[2*Pi]*s)^n) &&          3*ak*s^2 + 2*bk*s + ck ==          3*af*s^2 + 2*bf*s + cf &&          ak*(2*s)^3 + bk*(2*s)^2 +          ck*(2*s) + dk == 0 &&          3*ak*(2*s)^2 + 2*bk*(2*s) + ck ==          0 && (2*Pi^(n/2)*((af*s^4)/4 +          (15*ak*s^4)/4 + (bf*s^3)/3 +          (7*bk*s^3)/3 + (cf*s^2)/2 +          (3*ck*s^2)/2 + df*s + dk*s))/         Gamma[n/2] == 1/2, {af, bf, cf, df,          ak, bk, ck, dk}]      It outputs {} and i can't understand why.


title: Is there a built-in function which detects singularities in a function?

text: Given a function `f[x]` and a region M in the complex x-plane, how can I find singularities of `f` in this region, i.e., issue a command to _Mathematica_ which returns the type of singularity and its parameters? Let me be more specific   1. discontinuities (jumps)   2. poles   3. branch points Examples               f[x_] := Sin[x] Sign[Cos[x]]     g[x_] := 1/(a - x)^2     h[x_] := Sqrt[x + b]        **EDIT 11.09.14**   The restriction to real x in my first version of the text was not a good idea. I have changed it.


title: Switching the ordinate and abscissa causes problem in `ParametricPlot`

text: I have a function that plots properly in `PolarPlot`, but I'd like to plot it in `ParametricPlot` and then switch the y and x values, or ordinate and abscissa. It doesn't work for my function, but I'm not sure if it's just my function or some other subtle problem:               r[phi_] := (6*(Cos[phi]^5)/(2*Pi))^0.5;     PolarPlot[r[phi], {phi, 0, Pi}]     new[x_] := CoordinateTransform["Polar" -> "Cartesian", {Re[r[x]], x}];     ParametricPlot[{new[x], x}, {x, 0, Pi}]     ParametricPlot[{x, new[x]}, {x, 0, Pi}]      Generates: ![enter image description here](http://i.stack.imgur.com/SGbzu.jpg) ![enter image description here](http://i.stack.imgur.com/vuKPj.jpg) ![enter image description here](http://i.stack.imgur.com/tHFEJ.jpg) The final plot doesn't contain anything, and no errors or warnings are output.


title: Overwriting first line of large file

text: As mentioned, I wish to read the first line of a file, and if needed, overwrite it with a new string. The aim is to have a CSV with a list of possible elements. Example:               Adding the elements: 5 A, 6 B, and 7 C to a blank CSV:     A B C     5 6 7     Adding 4 A, 9 D:     A B C D     5 6 7     4 0 0 9     Adding 2 B, 7 E     A B C D E     5 6 7     4 0 0 9     0 2 0 0 7      Rewriting the file is okay for small files, but the files are expected to grow to sizes of hundreds of MB, so repeatedly overwriting the entire file is not practiceable, since the entries are preferably done quickly. How would one go about overwriting only the first line of the file? Reading the first line is possible from http://mathematica.stackexchange.com/questions/5179/how-to-read-data-file- quickly# _=_, but what about writing?


title: how could I repalce Sqrt[x^2+y^2+z^2] back to r

text: do a calculation in mathematica               r = Sqrt[x^2+y^2+z^2]          D[D[E^(I (-k r + t \[Omega]))/r, x], y]      but how could I get back to repalce Sqrt[x^2+y^2+z^2] back to r the result is: $$ -\frac{k^2 x y e^{i \left(t \omega -k \sqrt{x^2+y^2+z^2}\right)}}{\left(x^2+y^2+z^2\right)^{3/2}}+\frac{3 i k x y e^{i \left(t \omega -k \sqrt{x^2+y^2+z^2}\right)}}{\left(x^2+y^2+z^2\right)^2}+\frac{3 x y e^{i \left(t \omega -k \sqrt{x^2+y^2+z^2}\right)}}{\left(x^2+y^2+z^2\right)^{5/2}} $$


title: Get the name of a symbol passed to a function

text: I'm trying to get the name of a symbol passed to a function with this:               f[x_] := {SymbolName[x], x}     SetAttributes[f, HoldFirst]     x = 5;     f[x]      But `x` is being evaluated anyway:               SymbolName::sym: Argument 5 at position 1 is expected to be a symbol. >>     {SymbolName[5], 5}      What am I missing here?


title: Mapping with Trace[]

text: As part of some data anaylsis, I am using the function Trace to give me the name of an array of data, which I then use to label my plots. eg. my data array is called r1 so I run:               ToString@((Trace[r1])[[1]])      which simply returns the string "r1". All fine and dandy. The problem arises when I try to do this for a list of data arrays, I write:               Trace[#]&/@{r1,r2}      which I expect to give me the list {"r1","r2"}. Instead I get {{},{}}. What am I doing wrong? Any help will be much appreciated!


title: Dynamic graphics are less responsive inside a Manipulate

text: I have some code which displays a `GraphPlot` and allows the user to click on any vertex in the graph to display some information about that vertex in a popup window. There is two-way highlighting between the popup and the vertex, so that if the user hovers over either the vertex or the popup window, both the vertex and the popup will be highlighted (the vertex by changing size and the popup by changing colour). I do this by defining a `VertexRenderingFunction` for the graph plot which uses `Module` to create a unique symbol for each vertex. This symbol is set to `True` whenever the mouse is over the vertex or the popup window, and the dynamic highlighting is determined by the value of the symbol. This works okay (though I'd be interested in better ways to accomplish the same effect). However, as soon as I put the `GraphPlot` inside a `Manipulate`, the highlighting becomes rather sluggish, even if the `Manipulate` is not changing the plot in any way. I don't understand why that happens. Here's a minimal working example:               (* create some data *)     data = Thread[RandomChoice[Range[200], 350] -> RandomChoice[Range[200], 350]];          (* define the vertex rendering function *)     vrf := Module[{mo},        PopupWindow[         Dynamic[          mo = CurrentValue["MouseOver"];          {PointSize[Dynamic[If[mo, 0.03, 0.01]]], Point[#1]}],         Dynamic[          mo = CurrentValue["MouseOver"];          Panel["Popup Window Text", Background -> Dynamic[If[mo, Pink, White]]]]         ]] &;          (* graph plot *)     gp = GraphPlot[data, VertexRenderingFunction -> vrf]      This works nicely. But if I do this:               Manipulate[gp, {x, 0, 10}, TrackedSymbols :> {x}]      it is much less responsive. Can anyone tell me why this happens, and more importantly how to prevent it? I'm using version 8.0.4 by the way. **NB** The first argument of the `Manipulate` in my example is deliberately independent of `x`. The slider control is nothing to do with the problem, it is just there to make a valid Manipulate expression. I have used `TrackedSymbols :> {x}` to make doubly certain that Manipulate isn't tracking any symbols inside the GraphPlot. In my real application the `Manipulate` does useful things, but I realised as I stripped the code down that merely being inside a `Manipulate` affects the responsiveness of the plot, even if the `Manipulate` doesn't change the plot in any way.


title: Problem with cross product of two columns

text: I am trying to perform a cross product of two "Columns" which I expect to give me a column too: > Cross[{{a}, {b}, {c}}, {{x}, {y}, {z}}] but it gave me an error: > Cross::nonn1: The arguments are expected to be vectors of equal length, and > the number of arguments is expected to be 1 less than their length. any idea why this is happening ?


title: Discrete sampling of interpolating function returned by NDSolve

text: When solving an ODE with NDSolve, Mathematica returns an interpolation function. I need a discrete sampling of this function however. Naively, I can write this as (example):               slv = f[t]/. NDSolve[f'[t] == -f[t], f[t], {t,0,10}][[1]];     result = Table[{T, slv/.t->T}, {T,0,10,0.1}];      This is very slow for large times and fine sampling, and I have to do this for a large number of functions. But in principle, Mathematica must already store a discretized representation of the function for the interpolation function. Is there a way to access this? Or do you have suggestions on how to make the code above faster? Thanks!


title: How can I draw a polygon from a set of angles?

text: In recreational mathematics, polytans are polygons formed by edge-connecting isosceles right triangles. Order- _n_ polytans are those constructed from _n_ such triangles. My question is this: Given a set of _n_ angles and an N x N grid, how do I draw a graph using a set of angles? I am trying to find if the angles form the perimeter of a polytan (i.e., given a starting point on the plane, does progressively iterating through the angles get me back to the point of origin?). For example, given these three sets: {{270, 315, 315}, {315, 270, 315}, {315, 315, 270}}, the output would show two isosceles right triangles: {270, 315, 315} and {315, 315, 270}, and one non-polygon: {315, 270, 315}, as seen in the image below. In the image, the initial reference line is {{0,0}->{0,1} (on the y-axis), and the point of origin is {0,1}. ![enter image description here](http://i.stack.imgur.com/UWuss.png) I need the constructions to be graphs so that I can check whether two polytans of the same order are identical, but just in different orientations (like the two triangles in the image). Vertex count, vertex degree, edge-connectedness, etc., would also be useful.


title: How to specify assumptions before evaluation?

text: If I request mathematica evaluate an integral for me, I'll often get a more general `ConditionalExpression` than I want. Example :               Clear[ii, u, z, l, jj]     ii = Integrate[ 1 / Sqrt[z^2 + u^2], {z, -l, l}]      > >     ConditionalExpression[ -Log[-l + Sqrt[l^2 + u^2]] + Log[l + Sqrt[l^2 + > u^2]], >                                            Re[u/l] != 0 || Im[u/l] >= 1 || > Im[u/l] <= -1] >   I can reduce this after the fact with something like:               jj = FullSimplify[ii, u > 0 && l > 0 && Element[ u | l, Reals] ]      > >     Log[(u^2 + 2 l (l + Sqrt[l^2 + u^2]))/u^2]   >   but I'd imagine it should often simplify the calculations if I could provide the assumptions up front, especially the obvious ones like restricting various variables to the domain of reals. Is there a way to do this?


title: Excluding an interval of parameters from Integrate

text: I'd like to compute an integral that depends on a parameter, but I'd like to exclude an interval from the computation. For concreteness, say I want to compute               Integrate[f[x,z],{x,-a,a}]      but I would like to specify that z is a complex number _not_ in the real interval [-a,a]. Any thoughts? If I let the integral run, I get a conditional expression that I think is correct, but I'd like to specify the exclusion ahead of time if possible. Thanks!


title: How to add a condition to a formula so that it will not appear at the result?

text: Sometimes I have very long and complicated equations, when I evaulate the equations for example taking derivative or integral there will be several conditions with the answer. My question is that; is there any way that I enter the conditions at the begining of the program so that so that it will not appear in the evaluation result? I will give a simple example:               pdf = x^(L-1)/( γ^L Gamma[L]) Exp[(-x)/γ];     Re[L] > 0;          Integrate[ pdf, {x, 0, γ}]      > >     ConditionalExpression[ (Gamma[L]-Gamma[L,1])/(Gamma[L]),  Re[L] > 0 ] >   in the above example even if I write the condition which is `Re[L] > 0`, it will appear again at the result of evaluation.


title: Telling mathematica that something is an integer

text: Is it possible for me to tell mathematica something is an integer? like if I typed               Sin[n Pi]+Cos[n Pi]      it would tell me it equals 1 for even n and -1 for odd n? This would really help me check my answers when trying to find Fourier Series (I am just learning them now)


title: How can I say that all quantities need to be positive (and real)?

text: Can you say at the beginning of a script in Mathematica that you want all the quantities to be positive (and real)? So that in all calculations, only the real values of these quantities will be considered (by calculations and by plotting) I want to do this because I want to optimize a free energy by finding the best length quantities. But then I will find answers with negative or imaginary length quantities.Also when I make a 3Dplot of the free energy as a function of two of these quantities, Mathematica plot the imaginary values. Update: An example is: R1 is defined as followed:               R1[a_,l_] =        1/3 (-((l π OppC[α]^2)/VolS[α]) + (2^(1/3) l^2 π^2 OppC[α]^4)/(VolS[α] (-2 l^3 π^3 OppC[α]^6 +        27 v VolS[α]^2 + 3 Sqrt[3]Sqrt[-4 l^3 π^3 v OppC[α]^6 VolS[α]^2 +        27 v^2 VolS[α]^4])^(1/3)) + 1/(2^(1/3)VolS[α]) (-2 l^3 π^3 OppC[α]^6 +        27 v VolS[α]^2 + 3 Sqrt[3]Sqrt[-4 l^3 π^3 v OppC[α]^6 VolS[α]^2 + 27 v^2 VolS[α]^4])^(1/3));      Then I want to Plot R1:               Plot3D[R1[α, l], {α, 0, 0.5*π}, {l, 0, 10}].       But by plotting, also imaginary values of R1 are plotted. What do I have to do that Mathematica does not plot these values?


title: Combine InputAlias with InputString to parse expressions from a string

text: My knowledge of low-level notebook programming is very limited so I would be very grateful for any input regarding the following issue: I would like to define an input alias (via `InputAliases`) that evaluates               parse[InputString[]]      _in-place_ (like selecting it and then performing _Menu_ → _Evaluation_ → _Evaluate in Place_ or `Cmd` \+ `Return`). The function `parse` will translate my textual input into an expression (and insert it at the current cursor position). Currently, I am using the following alias,               SetOptions[EvaluationNotebook[],         InputAliases->{"parse"->RowBox[{"parse","[","InputString","[","]","]"}]}]      and the workflow looks like this   1. `ESC` `parse` `ESC` to produce `parse[InputString[]]`   2. Press `Ctrl` \+ `.` a few times to select `parse[InputString[]]`   3. Evaluate in place via `Cmd` \+ `Return`   4. Type something into the input field and press `Return` Basically, I would like to get rid of steps 2 and 3. I would appreciate any other solution if the desired behavior cannot be achieved using `InputAliases`. I would also be more than happy if an `InputField` could be used instead of `InputString`.


title: How can I make an X-Y scatter plot with histograms next to the X-Y axes?

text: I just saw a nice plot there: ![enter image description here](http://i.stack.imgur.com/gjON3.png) How could I implement that in Mathematica — by which I mean the plot structure, not so much the styling.


title: 3D visualization of 4D object data

text: I have some paired data here {{x1,y1},...{x_n,y_n}} (Download link) which represents {frequency, amplitude} of a spatial object surface mesh. Its quite a lot of cells and data as you can see in the histogramms, x frequency, y amplitude, z number of cells with specific frequency and data bin range. ![enter image description here](http://i.stack.imgur.com/vuJl3.jpg) ![enter image description here](http://i.stack.imgur.com/R3LzF.jpg) Now this data gets plotted with to visualize distinct spots of the sample surface with different amplitude by different colors. Most of the frequency dynamics happens between 0.3-4.9               ArrayPlot[gridmatrixpair, Mesh -> False, ColorFunction -> (Which[          0.3 < #[[1]] < 4.9 && 1*10^1 > #[[2]] > 1*10^0, Pink,          0.3 < #[[1]] < 4.9 && 1*10^2 > #[[2]] > 1*10^1, Gray,          ...      AspectRatio -> 2/7]       ![enter image description here](http://i.stack.imgur.com/JBzdf.jpg) or different frequency in narrow amplitude range               ArrayPlot[gridmatrixpair, Mesh -> False, ColorFunction -> (Which[          0.3 < #[[1]] < 0.8 && 1*10^9 > #[[2]] > 1*10^7, Pink,          0.8 < #[[1]] < 1.3 && 1*10^9 > #[[2]] > 1*10^7, Gray,          ...          True, White] &), ColorFunctionScaling -> False,       AspectRatio -> 2/7]       ![enter image description here](http://i.stack.imgur.com/mtNaB.jpg) I was wondering what would be a solution to show a combined spatial frequency and amplitude distribution in one picture. What I think of is something like the 3rd picture but this 2D picture is actually in a 3DHistogram like picture where the bar height represents the amplitude and bar color frequency, so actually 3D visualization of 4D data. Or represent frequency from lightblue to darkblue, amplitude from lightred to darkred and then both colors are mixed according to RGB to represent the mixture by green, but probably not so good visual contrast as this data covers 4-5 ranges that need to be covererd. One could also probably use simply the 3rd picture and project it on the xy-plane of a ListPlot3D (I think MM can do this), and then take the amplitude as z-data. I have no starting point and no big overview about MM, I'm looking more for a tip what is the right direction which gives a good visual contrast for those 4-5 ranges.


title: Discrete 3D Plot with date on one axis

text: 1) How do I plot the following data in 3D (large data, only a part of it is used here):               {      {"date", "v1", "v2"},      {{2000, 6, 16, 0, 0, 0.}, 10.4324, 11.084},      {{2000, 6, 30, 0, 0, 0.}, 9.75499, 11.02},      {{2000, 7, 14, 0, 0, 0.}, 10.0905, 10.932},      {{2000, 7, 28, 0, 0, 0.}, 10.2406, 11.249},      {{2000, 8, 11, 0, 0, 0.}, 10.1241, 11.411},      {{2000, 8, 25, 0, 0, 0.}, 9.92124, 11.4},      {{2000, 9, 8, 0, 0, 0.}, 8.63775, 11.566},      {{2000, 9, 22, 0, 0, 0.}, 8.52399, 11.507},      {{2000, 10, 6, 0, 0, 0.}, 9.09311, 11.635},      {{2000, 10, 20, 0, 0, 0.}, 8.68255, 11.626},      {{2000, 11, 3, 0, 0, 0.}, 8.19321, 11.696},      {{2000, 11, 17, 0, 0, 0.}, 9.47059, 11.296},      {{2000, 12, 1, 0, 0, 0.}, 9.75926, 11.469},      {{2000, 12, 15, 0, 0, 0.}, 10.0035, 11.343},      {{2000, 12, 29, 0, 0, 0.}, 9.5563, 10.946},      {{2001, 1, 12, 0, 0, 0.}, 9.66618, 10.67},      {{2001, 1, 26, 0, 0, 0.}, 9.57756, 10.57},      {{2001, 2, 9, 0, 0, 0.}, 9.47097, 10.33},      {{2001, 2, 23, 0, 0, 0.}, 8.86714, 10.11}      }       2) I want to see how data evolves as time changes. How do I use `Manipulate` to do this?


title: How do I make a log plot where the plot is logarithmic in the distance from the X-Axis (including negative values)?

text: For example, if I were to do a plot of `Sin[x]`, I would get what looks like a Log plot of `Sin[x]`, with another log plot of `-Sin[x]` that has been flipped upside down and placed underneath the first one, in this way, the plot is logarithmic in distance from the x-axis, and can show both positive and negative values.


title: Visualization: elliptical insights into data sets…

text: I was recently reading the following paper on visualization techniques using ellipses to gain statistical insights. Elliptical visualization for looking at correlations has briefly been touched on this board as well. Elliptical Insights: Understanding Statistical Methods through Elliptical Geometry. There are a couple of plots in the paper on quickly plotting correlations between complex data that I found quite useful and would like to replicate them. Having a function to visualize complex correlations would be useful to a lot of folks… However, my skills in MMA are lacking a bit... ![Scatterplot Matrices showing data, 68% data ellipses and regression lines](http://i.stack.imgur.com/XJz6R.png) ![enter image description here](http://i.stack.imgur.com/lnsY4.png)


title: Can Mathematica check if two expressions give the same output for integer input?

text: Let me give the background for this question. I'm using WebAssign to assign homework problems, and WebAssign has a built-in mechanism which can grade problems using Mathematica commands. For instance, if the solution to a problem is $e^{x+y}$ then it is possible to use the Simplify command to ensure that $e^x e^y$ is marked as correct. I'm currently assigning problems on Fourier series, and expressions like $\cos(n \pi)$ occur frequently. It is fairly standard practice to rewrite $\cos(n \pi)$ as $(-1)^n$, and I want these two expressions to be treated as equivalent (as well as similar expressions for $\cos(n \pi /2)$, etc.) The problem is that these expressions are only equal on the integers, and so Mathematica has no reason to believe they are the same. I suppose I could just write some code which plugs in the first hundred integers and checks to see if the values are the same, but I'm wondering if there's a more elegant solution.


title: Simultaneous Equation Solving Under Nonnegative and Bounding Conditions

text: I have nonlinear equations to solve parametrically;               PG = 100;          p1 = 0.8;          p2 = 0.2;          Solve[C1 - 10 + PG/2 + GC1 + GL1 == 0 &&        C2 - 15 + PG/2 + GC2 + GL2 == 0 && GL1 - fd (a1) t 10 == 0 &&        GL2 - fd (a2) t 15 == 0 &&        GC1 - (t (1 - fd) 25 - PG) ((p1)/((p1) + (p2))) == 0 &&        GC2 - (t (1 - fd) 25 - PG) ((p2)/((p1) + (p2))) ==         0 && (0.3/GL1) - (0.5/C1) - (0.3/GC1) - (0.4/PG) ==         0 && (0.3/GL2) - (0.5/C2) - (0.3/GC2) - (0.4/PG) == 0 &&        GC1 - 4 GC2 == 0, {C1, C2, GC1, GC2, GL1, GL2, fd, a1, a2, t}]      I do get 8 roots for this problem. However, for more complex solvings of this model (change numeric values - 15,10 to alpha, beta, gamma) I do get no more memory error. To avoid that I want to put some conditions on the variables since all roots are not meaningful and it takes time+memory to calculate it. Ex: a1 > 0, a2 > 0, 0 $\leq$ fd $\leq$ 1, C1 C2 takes positive values. I want to solve under these or more conditions. How to put these nonnegativity and bounding conditions for variables in the mathematica solve command? At least if I could put nonnegativity conditions I would get rid of the negative roots. Does it matter if I use Reduce instead ? I would appreciate your comments and your help.


title: Export MatrixPlot graphics to PDF

text: I am trying to export a plot generated by `MatrixPlot` to PDF but am having problems with the way the exported PDF is rendered.                 mPlot = MatrixPlot[length,        Epilog -> {Cyan,          MapIndexed[If[#1 != 0, Text[#1, Reverse[#2 - 1/2]]] &,           Reverse[number], {2}]}, Mesh -> True,        FrameTicks -> {{Table[i, {i, 9}],           MapIndexed[{First[#2], regionCodes[[#1]]} &,            Table[i, {i, 9}]]}, {Table[i, {i, 9}],           MapIndexed[{First[#2], Rotate[regionCodes[[#1]], 90 Degree]} &,            Table[i, {i, 9}]]}}, ColorFunctionScaling -> False,        PlotRange -> {Min[length], Max[length]}]      The matrices `length` (plotted as shades of gray in the figure below), `number` (shown as the cyan numbers in the figure below), and `regionCodes` have the following values               length = {{0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0.079774, 0.0545131,         0.0484267, 0.0614324, 0.0627509, 0.0572262, 0.0424639, 0}, {0, 0,         0.0600802, 0.100418, 0.0615561, 0.0737833, 0.0732888, 0.0624553,         0}, {0, 0, 0, 0.0740108, 0.0559982, 0.0666054, 0.0749018,         0.0493431, 0}, {0, 0, 0, 0, 0.0774839, 0.0554172, 0.0564699,         0.0491287, 0}, {0, 0, 0, 0, 0, 0.0798436, 0.0643044, 0.0606039,         0}, {0, 0, 0, 0, 0, 0, 0.107009, 0.0713126, 0}, {0, 0, 0, 0, 0, 0,         0, 0.0951722, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0}}     number = {{0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 37, 53, 21, 778, 1064, 228,         15, 0}, {0, 0, 27, 40, 761, 1164, 272, 21, 0}, {0, 0, 0, 7, 331,         507, 125, 9, 0}, {0, 0, 0, 0, 5935, 12430, 2917, 245, 0}, {0, 0, 0,         0, 0, 10665, 4323, 393, 0}, {0, 0, 0, 0, 0, 0, 664, 90, 0}, {0, 0,         0, 0, 0, 0, 0, 7, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0}}     regionCodes = {"New England", "Middle Atlantic", "East North Central",        "West North Central", "South Atlantic", "East South Central",        "West South Central", "Mountain", "Pacific"}      This is `length//MatrixForm` ![enter image description here](http://i.stack.imgur.com/RDYJ0.png) And this is `number//MatrixForm` ![enter image description here](http://i.stack.imgur.com/bTfpA.png) The plot looks like this when shown in Mathematica ![enter image description here](http://i.stack.imgur.com/gO0DL.png) But the exported PDF is rendered as follows (shown in OS X Preview) ![enter image description here](http://i.stack.imgur.com/NAOLh.png) There is a lot of shading and (and anti-aliasing?) going on (it shouldn't!). The only solution I have come up with is to rasterize the plot before exporting it. It does the job, but I don't consider it very elegant.               Export["regionIBD_MatrixPlot.pdf", Rasterize[mPlot, ImageResolution -> 600], ImageSize -> Full]      The funny thing is that if I export it as TIFF, it renders correctly. Is there a way to export the plot as a vector graphics and not as a bitmap?


title: Partial row reduction of a matrix

text: I have an $m\times n$ matrix (presumably of full rank) with $m>n$, and I would like to row reduce it, but leave the last column unreduced; that is, I want to get output on the form $\pmatrix{ 1 & 0 & 0 & \ast \\\ 0 & 1 & 0 & \ast \\\ 0 & 0 & 1 & \ast \\\ 0 & 0 & 0 & \ast \\\ 0 & 0 & 0 & \ast}$ instead of $\pmatrix{ 1 & 0 & 0 & 0 \\\ 0 & 1 & 0 & 0 \\\ 0 & 0 & 1 & 0 \\\ 0 & 0 & 0 & 1 \\\ 0 & 0 & 0 & 0 }$ which is what RowReduce gives me. I can't seem to mangle RowReduce into doing it, and I would really like to avoid manually implementing the algorithm. Is there some nice way to do this? Thanks in advance for any help you can give me.


title: Evaluate an ODE for several values of a coefficient and draw all the solutions in one plot

text: I want to draw one plot showing all the solutions the following ODE with different values of `N`. How can i do it?               s = NDSolve[{2 y'''[x] + (y[x]*y''[x]) == 0,                   g''[x] + (0.5****N***y[x]*g'[x]) == 0,                   g[0] == y[0] == 0, y'[0] == 0, y'[8] == 1, g[12] == 1}, {y, g}, {x, 0, 12}];          Plot[Evaluate[{g[x]} /. s], {x, 0, 12}, PlotStyle -> Automatic]


title: Factoring a quintic

text: I am trying to prove that a quintic polynomial, $p(x) = A5 x^5 + A4 x^4 + A3 x^3 + A2 x^2 + A1 x + A0$, which admits at most three real roots. Unfortunately Descartes' rule of signs does not help, since I have 5 sign changes. The polynomial's coefficients (the $An$ in the above expression) depend on a number of parameters, and after assigning numerical values to the parameters, _Mathematica_ factors the polynomial into the product of either   * three monic linear polynomials and a quadratic polynomial with negative discriminant   * one monic linear polynomial and two quadratic polynomials with negative discriminant which confirms what I think. Since _Mathematica_ can factor the quintic when the coefficients are numerical, I wonder if that implies it can also factor the quintic when expressed symbolically. If this is the case, how can I ask _Mathematica_ to do it?


title: PlotMarkers don't change colour for different lines

text: I have a set of data and several function operating on the same data, that I wish to plot together in a `ListPlot`. I need different `PlotMarkers` for each function to visualise the data. Because the data is quite closely spaced, I specified the number of markers using `Mesh` in the way I found here: Custom Intervals of Markers So I have the following:               a = Table[ii, {ii, 0, 2 \[Pi], 0.01}];     b = Sin[a];     c = Sin[a + \[Pi]/4 ];          ListPlot[       {Transpose[{a, b}],        Transpose[{a, c}]       },      PlotMarkers -> Automatic,      Joined -> True,      Mesh -> 20]      However, the `Mesh` command suddenly makes all markers the same shape and colour, so this is what I get out: ![enter image description here](http://i.stack.imgur.com/sa7Yf.png) How can I make sure that the `PlotMarkers`' colour and shape remain unchanged while being able to specify the number of markers in the plot? I'm using Mathematica 9.


title: Menu commands on Palettes and other windows without menu bars?

text: In the Version 10 interface, at least by default, there is no longer a common menu bar in a separate window, and menus appear to be localized to individual Notebook windows. If I select a Palette and attempt to use the menu in an adjacent Notebook, specifically **Generate Notebook from Palette** , the Palette loses focus and that menu item is disabled.   1. Can I restore the common menu bar from earlier versions?   2. If not what is the fastest and simplest way to apply these commands?   3. When is the **Generate Notebook from Palette** item not disabled? I have been unable to use it.


title: Dynamic Programming with delayed evaluation

text: By using dynamical programming, we can save intermediate steps for recursive relations, as in               f[n_]:= f[n] = f[n-1] + f[n-2]      However, this only stores definitions for explicit values of `n`. But I need to be able to store _function definitions_ , where the number of parameters of the function depends on each step. More specifically, I have something like $$ t^{a_1 \cdots a_n} = A \, t^{a_1 \cdots a_{n-2}} + B \, t^{a_2 \cdots a_n} \\\ t^a = C^a \\\ t^{ab} = D^{ab} $$ Where all $a_i$ are indices with unspecified values. This recursive definition allows me to express any $t^{a_1 \cdots a_n}$ as a combination of $C$'s and $D$'s. It's easy to implement this in mathematica:               t[a_]:= c[a]     t[a_,b_]:= d[a,b]     t[a__]:= A t@@Most[Most[{a}]] + B t@@Rest[{a}]      but for high $n$, calculation times become very long (and especially because my function is a bit more complicated than this). This is where we normally would use dynamic programming, something like:               t[a__]:= t[a] = A t@@Most[Most[{a}]] + B t@@Rest[{a}]      but this is not what we need, because if I execute               t[a,b,c]      it only makes a definition for `a`, `b` and `c` literally, meaning that `t[b,a,c]` will have to be recalculated recursively. This is because it is stored as `Set`, and not a `SetDelayed`:               t[a,b,c] = A c[a] + B d[b,c]      What I would need is some kind of magic dynamic programming that stores function definitions as in               t[a__]:= Magic.... =A t@@Most[Most[{a}]] + B t@@Rest[{a}]      such that when I execute               t[a,b,c]      it stores               t[a_,b_,c_] := A c[a] + B d[b,c]      etcetera. I've looked into Leonid's answer for this question, but I can't easily see how to adapt it for a growing number of arguments. Any ideas? Many thanks in advance! **EDIT** Thanks to Leonid's answer, I now understand a bit how this can be solved. Unfortunately, the way I'd need it, is a bit more complicated. I have several function definitions, with `Condition`, `PatternTest`, `Optional` and next to the recursive ('growing') variables I also have some that aren't. At first I thought I'd figure it out myself based on Leonid's answer (hence the accept), but I didn't. The idea is to make a wrapper `memoize`, which I wrap around my function definition such that it memorises the function definitions. An example in pseudocode:               memoize[         t[dot[a__], b_?EvenQ, c_:1]/;b!=c := .... some recursive function of t ...     ]      The first thing I tried is to retrieve all patternames, and replace them with `Unique[]` ones:               ClearAll@memoize     SetAttributes[memoize, HoldAllComplete]     memoize[expr_SetDelayed] :=         (* first we retrieve the lhs and rhs *)         With[{funcLHS = Hold[expr] /. Hold[SetDelayed[x_, y_]] :> Hold[x] ,                funcRHS = Hold[expr] /. Hold[SetDelayed[x_, y_]] :> Hold[y]},             (* next we retrieve the names of the patterns used *)             With[{patternNames = First /@ Cases[funcLHS, _Pattern, Infinity]},                 (* we make some locally scoped patterns *)                 With[{varsExt = Table[Unique[], {Length[patternNames]}]},                     (* and we express the lhs and rhs in function of the former locally scoped patterns *)                     With[{lhs = funcLHS /. Rule @@@ Transpose[{patternNames, varsExt}],                            rhs = funcRHS /. Rule @@@ Transpose[{patternNames, varsExt}]},                             {lhs,rhs}/.{Hold[x_],Hold[y_]}:>SetDelayed[x,y]         ]]]]      And this works, but it doesn't do anything useful. Now I would need to replace the central part with Leonid's answer somehow, which means I have to inject `vars` into `lhs` and `rhs`, with the additional difficulty that `Length[vars]` won't equal `Length[varsExt]`. So this is what I tried:               ClearAll@memoize     SetAttributes[memoize, HoldAllComplete]     memoize[expr_SetDelayed] :=         With[{funcLHS = Hold[expr] /. Hold[SetDelayed[x_, y_]] :> Hold[x] ,                funcRHS = Hold[expr] /. Hold[SetDelayed[x_, y_]] :> Hold[y]},             With[{patternNames = First /@ Cases[funcLHS, _Pattern, Infinity]},                 With[{varsExt = Table[Unique[], {Length[patternNames]}]},                     With[{lhs = funcLHS /. Rule @@@ Transpose[{patternNames, varsExt}],                            rhs = funcRHS /. Rule @@@ Transpose[{patternNames, varsExt}]},                              {lhs, Hold[                             With[{vars = Table[Unique[], {Length[{#}]}] & /@ varsExt},                                 With[{pts = (Pattern[#1, _] &) /@ vars},                                     {lhs/.MapThread[ Pattern[#1, _] -> Sequence @@ (Function[x, Pattern[x, _]] /@ #2) & , {varsExt, vars} ]                                     ,                                     rhs/.MapThread[ #1 -> Sequence @@ #2 & , {varsExt, vars} ]                                     }/.{Hold[x_],Hold[y_]}:>Set[x,y] ;                                     lhs/.x_Pattern:>x[[1]]                             ]]]                          } /. {Hold[x_], Hold[y_]} :> SetDelayed[x, y]          ]]]]      But the pattern replacing on `lhs` doesn't work, and it doesn't take care of `Condition`, `Optional`and `PatternTest`. So I'm totally stuck, although I have the feeling that it's only a few changes to make it work..


title: Mathematica plotting help (plotting a complex fourier series).

text: How would I plot the following in Mathematica? $ \displaystyle\sum_{n=2}^{10} \bigg(\dfrac {4ine^{inx}(-1)^n}{(n^2 - 1)^2} - \dfrac{4in e^{-inx}(-1)^n}{(n^2 - 1)^2} \bigg) $ Thanks.


title: Summation with jump indices like 1,4,6,9?

text: I is easy to enter $ \sum_{s=1}^{n}k(s) $ But how can I enter $ \sum_{s=1,3}k(s) $ ? When I try it, Mathematica says               Syntax::sntxi: Incomplete expression; more input is needed .      Also the following didn't work. $\sum_{s=1,3}^{3}k(s)$


title: list manipulation

text: I have a list like the following:                {{1, 3}, {2, 5}, {3, 6}, {2, 4}}      I want the final list to be like that :               {{1, 3}, {2, 5}, {3, 6}}.      Here the first element of the sub list is needs to check with other sub list's first element and remove the sub list where first element repeated again. So the final list doesn't have `{2,4}` because `2` is repeated twice.


title: How to delete duplicated sublist

text: I have a list like this:               rew={{{2011, 3, 13, 0, 0, 0}, 1044.4}, {{2011, 3, 13, 3, 0, 0}, Missing["NotAvailable"]},      {{2011, 3, 13, 3, 0, 0}, 1044.7}, {{2011, 3, 13, 6, 0, 0}, 1043.4},      {{2011, 3, 13, 9, 0, 0},1041.5}, {{2011, 3, 13, 12, 0, 0}, 1044.1},      {{2011, 3, 13, 15, 0, 0}, 1045.4}, {{2011, 3, 13, 18, 0, 0}, 1046.8},      {{2011, 3, 13, 21, 0, 0}, 1047.5},.....}      How do I delete duplicated sublists? From this list I want to delete                {{2011, 3, 13, 3, 0, 0}, Missing["NotAvailable"]}, {{2011, 3, 13, 3, 0, 0}, 1044.7}      this sublists which have duplicates because the first part is the same. And also delete duplicates if I face the duplicates


title: Dependency injection - use a specific implementation of one function within another

text: Consider...               f[x_]:=Body containing h[some args]...     g[x_]:=Body containing h[some args]...      However I want to define something like...               The h to use inside f has this definition h[args___]:=f specific definition.     The h to use inside g has this definition h[args___]:=g specific definition.      I know I can do this using Block wrapped around the call to f and g but I was curious if some cunning extension of UpValues would work; more like a dependency injector pattern. My experience of using UpValues is very limited and reading the documentation for UpValues it would appear to be appropriate only when the precise pattern of h within f or g is known. Added 26/08/2014 10:11 (London) The specific problem I was trying to apply this to concerned two very similar functions that produce some graphics. Those graphics required different scaling functions to produce their results. What I wanted to do was attach in some way the specific scaling to the relevant function but separate from the plotting functions themselves. Block comes closest to what I was trying to achieve. I may go with this. Many thanks to all who answered.


title: Simulation code performance tuning

text: The following simulation takes over 20 seconds for evaluation. I have difficulty re-coding it with Nest and Map or Compile functions to make it more efficient. Can some one help with this? **The overview of the code is:** It is a numerical solution for evolution of density of vehicles on a corridor that has `L` lanes. The corridor is split into `n` sections of `dx` length and each section has a sink and source coming from a ramp (which intern is divided into `p` segments each). the network is loaded from on-ramps with density `A` for `m` time periods only and simulated till the network is empty. The variable `a1` is the control of inflow from the ramps on to the corridor. The outflow factor is B. The output of the simulation is the total density observed over the whole simulation. Also, how can I use parallelization on this code?               demand[n_, k_] := Min[k Vf, n capacity];     supply[n_, k_] := Min[(n Kj - k) w, n capacity];     flo[n_, Ku_, Kd_] := Min[demand[n, Ku], supply[n, Kd]];     dx = 1/6; n = 48; m = 300; p = 36; capacity = 2500; A = 18.; B = 0.1; L = 3.;      RML = 30; Vf = 100; Kj = 150; w = 20; dt = 1/600;          f[a1_] :=      Module[{G,k0=ConstantArray[0, n],k, kr=Table[Table[0,{i1,1,p}],{i2,1,n}],P},      k = k0; RM = 100 a1; j = 0; RampSpill = 0;     For[i = 2, i < n, i++, kr[[i, 1]] = A];      NtwrkTT = TT = Plus @@ (Plus @@ kr);     While[TT > 0, TT = 0;      Do[FQin = If[i == 2, Min[demand[L, k0[[i - 1]]], supply[L, k0[[i]]]], FQout];      dem = demand[L, k0[[i]]]; dem = If[dem == 0, 0.001, dem];      G = Min[1, supply[L, k0[[i + 1]]]/dem];      P = G demand[1, kr[[i, p]]];      Qr = (P - B FQin) dx;      FQout = Min[demand[L, k0[[i]]], supply[L, k0[[i + 1]]]];      k[[i]] = k0[[i]] + (FQin - FQout + Qr)/Vf;      kr0 = kr[[i]];      Do[MR = If[ir == RML + 1, RM, capacity];       RQin = Min[MR, If[ir == 2, flo[1, kr0[[ir - 1]], kr0[[ir]]], RQout]];       MR = If[ir == RML, RM, capacity];       RQout =Min[MR, If[ir < p, flo[1, kr0[[ir]], kr0[[ir + 1]]], P]];       kr[[i, ir]] = kr0[[ir]] + (RQin - RQout)/Vf, {ir, 2, p}];      kr[[i, 1]] = If[j <= m, A, 0], {i, 2, n - 1}];     TT = Plus @@ (Plus @@ kr);     TT += Plus @@ k;     k0 = k; NtwrkTT += TT; j++];     NtwrkTT dt] // Timing     f[14]      **Edit:** Please find below the profile output:![enter image description here](http://i.stack.imgur.com/a6Iqy.jpg)


title: combining manipulate with "static" plot

text: Is there a way to show a plot of a "static" function as background for a manipulate panel ? In other words: I have put into a manipulate a trajectory (solution of a system of two differential equations):               solcontrol =      FullSimplify[       DSolve[{y'[t] == - y[t] - u z[t],                z'[t] == -1 -2 z[t] + u y[t], y[0] == 0, z[0] == -.5},                {y[t], z[t]}, t]];      Then, I use Manipulate               {{ysol[t_], zsol[t_]}} =        Simplify[{y[t], z[t]} /. solcontrol,        Assumptions -> Element[u, Reals] && t > 0];          With[{y = ysol[t], z = zsol[t]},         Manipulate[         ParametricPlot[{y, z}, {t, 0, tend}],           {{tend, .1}, 0, 20},{{u, .7}, 0, 20}]]      Remark/problem:I'm using Mathematica 9 on a Debian. I don't know if you see the same manipulate panel as me on (say) Windows, but my panel sets its dimension "dynamically" respect on the form of trajectories. Finally, my problem is to show the result of manipulate with this contour plot:               DeltaA[y_, z_] = -y^2 - z -2 z^2;     DeltaB[y_, z_] = -2 y z - y;           ContourPlot[{DeltaA[y, z] == 0, DeltaB[y, z] == 0}, {y, -1,1},{z, -1, 1}]      because I want to see how trajectories behave respect the line of the plot. thank you


title: Slow mixture fitting when having ill-conditioned covariance matrices. How to make it faster?

text: I'm using Mathematica 9.0 to fit multidimensional observations with a gaussian mixture. To do so I first adapted these steps to ensure that the mixture parameters are well defined (see http://mathematica.stackexchange.com/a/16833/12672). Runing time was unacceptable (I waited some hours and aborted it afterwards), so I tried the fitting in Matlab. Matlab instantly retrieved an error message from the clustering algorithm that states "ill-conditioned covariance created at iteration 3". To overcome this I tried 2 solutions concerning the covariance matrices definitions following the suggestions in http://stackoverflow.com/a/16263971 and http://www.mathworks.com/matlabcentral/answers/100210. To reproduce my problem and illustrate my experiments here I enclose some data, part of my original data, this being 7 samples each 5-dimensional, which I try to fit in a 2 gaussian mixture:               data = {{0, 2.76, 10.68, 12.4133, 9.26667}, {0, 0, 0, 0, 1.13333}, {6.06667, 8.32, 6.86667, 6.6, 4.49333}, {1.25333, 5.96, 7.49333, 5.81333, 5.05333}, {0, 0, 1.13333, 6.42667, 7.41333}, {0, 0, 0, 3.25333, 3.82667}, {0.76, 6.28, 10.28, 9.05333, 5.12}};     data // MatrixForm     d = Dimensions[data]     nDim = Last[d];     nMixtures = 2;      **One solution** is to **use a single covariance matrix for all the mixtures**. What follows is the implementation in Mathematica:               For[k = 1, k < nMixtures + 1, k++,          m[k] = Table[mm[k, i], {i, nDim}]];(*means*)     For[k = 1, k < nMixtures, k++,          w[k] = Exp[ww[k]]/((1 + Exp[ww[k]])*(nMixtures - 1))]; (*mixture weights*)     c = Table[If[i >= j, cc[i, j], 0], {i, nDim}, {j, nDim}];(*triangular matrix*)     s = c.Transpose[c];(*covariance matrix*)     M = Append[Array[w, nMixtures - 1], 1 - Total[Array[w, nMixtures - 1]]];(*all weights, which sum up to 1*)     Q = {};     For[i = 1, i < nMixtures + 1, i++,          Q = Insert[Q, MultinormalDistribution[m[i], s], i]];(*all mixtures, which share the same covariance matrix*)      The corresponding **fitting takes 85 seconds in my PC** using the following command:               edf_shared = EstimatedDistribution[data, MixtureDistribution[M, Q]]; // Timing      The same implementation **in Matlab takes 0.0047 seconds** :               data = [0,0,6.0667,1.2533,0,0,0.76; 2.76,0,8.32,5.96,0,0,6.28; 10.68,0,6.8667,7.4933,1.1333,0,10.28; 12.4133,0,6.6,5.8133,6.4267,3.2533,9.0533; 9.2667,1.1333,4.4933,5.0533,7.4133,3.8267,5.1200]';     edf_shared = gmdistribution.fit(data,nMixtures,'SharedCov',true);      **Another way** to go around this problem is, instead of using the same covariance matrix for all gaussians, **add a small epsilon to the diagonal of the covariance matrices**. **In Mathematica it takes 29,247 seconds (about 8 hours)** :               For[k = 1, k < nMixtures + 1, k++,          m[k] = Table[mm[k, i], {i, nDim}]];(*means*)     For[k = 1, k < nMixtures, k++,          w[k] = Exp[ww[k]]/((1 + Exp[ww[k]])*(nMixtures - 1))];(*mixture weigths*)     For[k = 1, k < nMixtures + 1, k++,          c[k] = Table[If[i >= j, cc[k, i, j], 0], {i, nDim}, {j, nDim}]];(*triangular matrices*)     epsilon = 0.00005;     epsilonMatrix = DiagonalMatrix[ConstantArray[epsilon, nDim]];(*diagonal matrix*)     For[k = 1, k < nMixtures + 1, k++,          s[k] = c[k].Transpose[c[k]] + epsilonMatrix];(*covariance matrices*)     M= Append[Array[w, nMixtures - 1], 1 - Total[Array[w, nMixtures - 1]]];     Q = {};     For[i = 1, i < nMixtures + 1, i++,          Q = Insert[Q, MultinormalDistribution[m[i], s[i]], i]];(*all mixtures, with regularized covariance matrices*)     edf_epsilon = EstimatedDistribution[data,MixtureDistribution[M, Q]]; // Timing      The corresponding implementation **in Matlab takes 0.0055 seconds** :               edf_epsilon = gmdistribution.fit(data,nMixtures,'Regularize', 1e-5);      Neadless to say, **when evaluating the estimated distribution function on a point, execution time is also an issue**. The implementation using shared covariances in Mathematica requires 276 seconds, while in Matlab is just 0.41 seconds. The first approach involving a shared matrix, when applied to this new point takes 107 seconds in Mathematica and 0.20 seconds in Matlab. **I also tried playing with the _EstimatedDistribution_ function parameters** such as _WorkingPrecision_ , _AccuracyGoal_ , _ParameterEstimator_ , etc., I didn't see any substantial improvement. At most, when I reduced the _WorkingPrecision_ to 5 I managed to cut down the estimation time to just 40 seconds. **My question is whether there is a better way to do this** , I mean to estimate the parameters of a gaussian distribution in Mathematica while coping for ill-conditioned covariance matrices. By better I mean **faster while keeping a relatively good accuracy in the estimations** , in the Matlab direction I enclosed here. Perhaps there is some issue with my code, or the approaches themselves are intrinsically inconvenient in Mathematica. Any suggestion will be welcome, thanks in advance!


title: Combination of CellPrint and PrintTemporary, or DisplayForm for Cells

text: I'm programmatically generating some formatted output that generates a cell in the form of a `Cell[]` expression. For instance, the output might be               cell = Cell[TextData[{"Function ",         Cell[BoxData[FormBox[RowBox[{"f","(","x",")"}],             TraditionalForm]], FormatType->"TraditionalForm"]}],        "Subsection"];      (where $f(x)$ will actually be some complicated expression). **How can I get the rendered`Cell` expression displayed in the notebook temporarily during evaluation?** I can display it (permanently) in the notebook using `CellPrint`: ![CellPrint](http://i.stack.imgur.com/nT9Cu.png) I can display text temporarily using `PrintTemporary`: ![PrintTemporary](http://i.stack.imgur.com/pOVpD.png) But combining them doesn't work, because `PrintTemporary` assumes its argument is an expression to print rather than a box structure: ![PrintTemporary doesn't work](http://i.stack.imgur.com/9mqEH.png) Adding `DisplayForm` doesn't work; it seems `DisplayForm` only works for boxes when not wrapped in a complete `Cell` expression: ![DisplayForm doesn't work](http://i.stack.imgur.com/4EBMo.png) So I really need a `CellPrintTemporary` function.


title: How can I get a Taylor expansion of the Sin[x] function?

text: How can I get a Taylor expansion of the Sin[x] function by the power series?


title: Unevaluated symbols

text: I often find it useful to define a symbol from strings (often in a loop in which I define other symbols). This I accomplish with `Symbol` (and often `ToString`). However, if the symbol has already been defined, my call to `Symbol` returns not the symbol, but that to which the symbol evaluates. This may arise rarely, but I stumbled upon it when automatically generating `usage` messages, as in the following example.               vars = {x,y};     x$dN = {x1, x2};     y$dN = {y1, y2};     For[ i = 1, i <= Length[vars], i++,       Evaluate[         Symbol[           ToString[vars[[i]]] <> "$dN"         ]       ]::usage       =       "generic (no argument) thermodynamic quantity vector"     ]          (* Symbol::symname: The string "{x1, x2}$dN" cannot be used for a symbol name.         A symbol name must start with a letter followed by letters and numbers" *)      This is the obvious error because I'm trying to define the `usage` for `x$dN`, which evaluates to `x$dN = {x1, x2}`. So my question is: can we sometimes leave a symbol unevaluated, yet use it as a symbol?


title: Cell brackets on left side?

text: Is it possible to have the cell brackets on the left? I looked through the options and couldn't find anything, but maybe it's some kind of esoteric style setting or something. The reason I'm looking for this is because the content of notebooks is on the left, which means that's where my mouse hangs out most of the time. So I suspect having the cell brackets on the left would be more natural. (I'm aware of the cellgroup openers, my question is about general selecting/manipulating, not just opening/closing).


title: Is there an NDSolve`ProcessEquations analog for NIntegrate?

text: NDSolve has an interface for repeatedly solving an equation with different initial conditions without having to analyze the equation and set up the solving algorithm each time. This can improve performance dramatically. For example,               In[1]:= nd = First@NDSolve`ProcessEquations[{y'[t] == -y[t], y[0] == 1}, {y}, t]          Out[1]= NDSolve`StateData[<0.>]           In[2]:= solve[y0_] := Module[{}, nd = First@NDSolve`Reinitialize[nd, y[0] == y0];                             NDSolve`Iterate[nd, 1]; NDSolve`ProcessSolutions[nd]]          In[3]:= Timing[NDSolve[{y'[t] == -y[t], y[0] == #}, {y}, {t, 0, 1}] & /@Range[0.001, 1, 0.001]] // First          Out[3]= 0.527396          In[4]:= Timing[solve /@ Range[0.001, 1, 0.001]] // First          Out[4]= 0.250309      Is there an analogous interface to `NIntegrate` that would allow me to process the integral once, then do integrations using the same integration method (as chosen by `NIntegrate`) repeatedly using different constants in the integrand and/or different limits of integration?


title: Driven simple harmonic oscillator — amplitude of steady state motion

text: I am (partly as an exercise to understand _Mathematica_ ) trying to model the response of a damped simple harmonic oscillator to a sinusoidal driving force. I can solve the differential equation with some arbitrarily chosen boundary conditions, and get a nice graph;               params = {ν1 -> 1.0, ω1 -> 10.0, F -> 4.0};     system =        {D[x1[t], {t, 2}] == -ν1 D[x1[t], t] - ω1^2 x1[t] + F Cos[ω t], x1[0] == 1, x1'[0] == 0};     soln = DSolve[system /. params, x1[t], t][[1]][[1]];     Plot[x1[t] /. soln /. ω -> 8, {t, 1, 20}, Frame -> True, Axes -> False]      ![SHM transients](http://i.stack.imgur.com/tRS4H.png) But I don't care about the transients - I just care about the steady state situation. I tried using Limit to extract this;               amp = Table[Max[Limit[x1[t] /. soln, t -> ∞]], {ω, 1, 20, 1}]     ListPlot[amp]      ![response](http://i.stack.imgur.com/df9l9.png) Looks a bit peculiar to me. Also, this is incredibly slow, and doesn't work symbolically. I thought I could do something along the lines of forcing it to take as a solution of the DE $a Sin(\omega t + \phi)$;               params = {ν1 -> 40.0, ω1 -> 10.0, F -> 10.0};     x1 = a Sin[ω t + ϕ];     system = D[x1, {t, 2}] == -ν1 D[x1, t] - ω1^2 x1 + F Cos[ω t]     amp = Solve[system /. params, a]     phase = Solve[D[a /. amp, t] == 0, ϕ][[1]][[1]]      but this just turns into a mess and doesn't give the right result either. Is there a canonical way to tackle this sort of problem? I don't really know what I'm doing with Mathematica yet, so any explanations would be gratefully received.


title: $RecursionLimit::reclim: Recursion problem

text: Please, find bellow my original question. Here is all my code:               vm = 5;     r0 = 127.25;     di = r0*2;     de = 273;     v = 0.000000464;     ρf = 958;     ρt = 7854;     pr = 2.88;     kf = 0.656;     kt = 58;     cf = 4186;     ct = 470;     re = (vm*(2*r0/1000)/v)     e = 0.00015;     f = 1.325 (Log[0.27*(e/(2*r0/1000)) + 5.74*(1/re)^0.9])^(-2)     tinf = 298;     tme = 373;     αf = kf/(ρf*cf)     c1 = (-f*ρf*vm^2/(4*r0/1000))     g = 9.81;     β = 1/((tme + tinf)/2)     var = 0.000018;     prar = 0.703;     α = 0.000025;     kar = 0.028;          ym[r_] := (((r0/1000) - r)*vm*(f/8)^(0.5))/v;     εm[r_] := v*(0.4*ym[r]/6)*(1 + (r/(r0/1000)))*(1 + 2*(r/(r0/1000))^2);          momento = NDSolve[{(1/r)*D[(v + εm[r])*r*D[u[r], r], r] == (1/ρf)*c1, u'[0.0000001] == 0, u[(r0/1000)] == 0},u[r], {r, -0.0000001, (r0/1000)}, MaxSteps -> 10000];     mom[r_] = u[r] /. First[momento];          hi = (kf/(2*r0/1000))*((re - 1000)*pr*(f/8))/(1 + 12.7*(f/8)^0.5*(pr^(2/3) - 1))     ra = (g*β*((tme + tinf)/2 - tinf)*(de/1000)^3)/(var*α);     he = (kar/(de/1000))*(0.6 + (0.387*ra^(1/6))/(1 + (0.559/prar)^(9/16))^(8/27))^2      Here starts my problem. Mathematica isn't able to solve systems of PDEs with more than one independent variable. But Mathematica is able to solve each one individually. So, I have to solve iteratively both the two equation varying a boundary condition (by the way, it is a partial elliptic equation). But, at the moment this is not the problem.               l = 200;     tempo = 100;     Clear[tmed];      Clear[tmedpred];      Clear[ttf];      Clear[med];     Clear[tpred];      tmed[x_, t_] := tinf; (*Initial*)     med[x_, t_] := tinf; (*Initial*)     tmedpred[x_, t_] := tinf; (*Initial*)     tpred[x_, t_] := tinf; (*Initial*)     ttf[x_, r_, t_] := tinf; (*Initial*)     subrel = 0.4;     eps = 10^-4;          (*While[erro\[GreaterEqual]eps,*)          enf1 = NDSolve[{(ρf*cf*(D[tf[x, r, t], t] + mom[r]*D[tf[x, r, t], x])) == ((1/r)*        D[(r*(αf + εm[r])*D[tf[x, r, t], r]), r]),tf[x, r, 0] == (tme - tinf)*Exp[-1000*x] + tinf,tf[0, r, t] == tme, (D[tf[x, r, t], r] /. r -> 0.0000001) ==       0, -kf*(D[tf[x, r, t], r] /. r -> (r0/1000)) == (1 - Exp[-1000*x])*hi*(tmed[x, t] - ttf[x, r0/1000, t])},tf[x, r, t], {x, 0, l}, {r, 0.0000001, (r0/1000)}, {t, 0, tempo}, Method -> {"MethodOfLines", "SpatialDiscretization" -> {"TensorProductGrid", "MinPoints" -> 13}}];     tff[x_, r_, t_] = tf[x, r, t] /. First[enf1];          med[x_, t_] := (NIntegrate[(mom[r]*tff[x, r, t]*r), {r, 0.0000001, r0/1000}])*2/((2/((r0/1000)^2)*NIntegrate[(mom[r]*r), {r, 0.0000001, r0/1000}])*(r0/   1000)^2));          tpred[x_, t_] := tmedpred[x, t] + subrel*(med[x, t] - tmedpred[x, t]);     tmed[x_?NumericQ, t_?NumericQ] := tpred[x, t];          ent1 = NDSolve[{ρt*ct*(D[tt[x, r, t], t]) == (1/r)*(D[(r*kt*D[tt[x, r, t], r]), r]), tt[x, r, 0] == tinf, -kt*(D[tt[x, r, t], r] /. r -> (r0/1000)) == (1 - Exp[-1000*x])*hi*(tmed[x, t] - ttf[x, r0/1000, t]), -kt*(D[tt[x, r, t], r] /. r -> (de/2000)) == (1 - Exp[-1000*t])*he*(ttf[x, de/2000, t] - tinf)}, tt[x, r, t], {x, 0, l}, {r, (r0/1000), (de/2000)}, {t, 0, tempo}];          tmedpred = tmed      Here is the problem. "tmedpred" shall return to the structure of the first NDSolve (enf1) and the code keep the loop up to an error value. Realize that the While structure is not in the code. I'm doing a manual evaluation. The error: $RecursionLimit::reclim: Recursion depth of 1024 exceeded. >> The box message: "A very large output was generated. Here is a sample of it: (<<1>>) + subrel (med[100, 50] - tmedpred[100, 50]) The problem starts with the input tmedpred = tmed (original question) I have two function:               med[x_?NumericQ,         t_?NumericQ] := ((NIntegrate[(mom[r]*tff[x, r, t]*r), {r,             0,             r0/1000}])*(2/((2/((r0/1000)^2)*               NIntegrate[(mom[r]*r), {r, 0, r0/1000}])*(r0/                1000)^2)));      and,               tmed[x_, t_] := tmedpred[x, t] + subrel*(med[x, t] - tmedpred[x, t]);      `mom[r]` and `tff[x,r,t]` are `NDSolve` output. This functions are inside a While code and at the end of the loop, `tmedpred = tmed` (`tmedpred` become `tmed` and the While code should keep iterating up to an error value) `tmedpred[187,100]` (it is a simple evaluation of the function) At this moment the warning > "$RecursionLimit::reclim: Recursion depth of 1024 exceeded." And a box with the message > "A very large output was generated. Here is a sample of it:" > > (<<1>>) + subrel (med[187, 100] - tmedpred[187, 100])) + subrel (med[187, > 100] - tmedpred[187, 100]) Could some one help me with this problem? I was wondering if it is possible to create a function that is not connected to the original function but keep its original behavior(a kind of numerical function). Regards!


title: How to make equidistant or split ListPoint

text: How to split the curve with more equidistant points?                  lpts={{1., 0., 0.}, {0.540302, 0.841471, 0.25}, {-0.416147, 0.909297, 0.5},          {-0.989992, 0.14112, 0.75}, {-0.653644, -0.756802, 1.}, {0.283662, -0.958924, 1.25},            {0.96017, -0.279415, 1.5}, {0.753902, 0.656987, 1.75}, {-0.1455, 0.989358, 2.},          {-0.91113, 0.412118, 2.25}};             l = Line@lpts;        Show[Graphics3D[{Blue, Thick, l}, Boxed -> False],          Graphics3D[{Red, PointSize[Large], Point[lpts]}]]      ![enter image description here](http://i.stack.imgur.com/w6mJt.png)


title: Generating evenly spaced points on a curve

text: In the `KnotData` package a simple command such as               points = Table[KnotData[{3, 1}, "SpaceCurve"][t], {t, 0, 2 Pi, 0.1}];      will generate a series of points that comprise a knot (here, a trefoil, if successive points are connected). However, the distance between points is not constant; is there a way to generate evenly spaced points? (I.e. evenly spaced arc lengths between points).


title: Scaling an image with "Drawing Tools" primitives on it

text: Imagine I doodle with the "Drawing tools" pen, or place lines on an image after importing it. Now say I want to scale this image by some constant factor $C$ while maintaining the same aspect ratio. How can I correspondingly scale my "Drawing tools" objects?


title: Back Linear Substitution

text: I have an equation set `Ax=b` and `A(n*m),n<m` . To lower down the dimension, I express some vars by other vars, which gives `By=c`. After some calculation, the values of `y` is achieved and I want to get `x` back. How can I accomplish this work? **The main aim is to get the substitution and back substitution, instead of solving the equations.** Remark: `n` and `m` are not fixed, the code need to be general for different scales. For example:               x[1]+x[2]+x[3]==1&&x[2]+x[4]==1      Then we have:               x[1]==x[4]-x[3]&&x[2]==1-x[4]      And after some calculation, I get `{x[3],x[4]}=={0,1}` and I want to get:               {x[1],x[2],x[3],x[4]}=={1,0,0,1}      I know it's silly to use `x[i]`, as I can't handle matrices well. I believe there is a way to finish all these in the language of matrices.


title: How to find integer solutions?

text: Following is the equation: ![enter image description here](http://i.stack.imgur.com/IKvhW.png) Need to solve for integer values of x,y when a,b lies between -1000 and 1000. Problem is to find the number of integer values of pair (x,y) that satisfy it.


title: Exporting/Importing a Table of complex numbers

text: I'm generating a long table of list of the form: `PN={{1,2,1+i},{3.5,2.6,2}...},{...},...` Using: `Export["PN.dat", PN, "Table"]` Seems to do the job of exporting, but then using: `PN = Import["PN.dat", "Table"] or PN = ReadList["PN.dat"]` Can't reconstruct the same List, the first way considers the imaginary number i as something else "I", while the second one returns insane data like: `{{-1., -2.6464*10^-40, 0. + 2.76621*10^18 I}, {-0.129967...` Any ideas how to do this right? (Using ToExpression Returns $Faild)


title: Tiling a square

text: I wondered if there was a way to automate the process of finding a way to tile a tile into a square. The idea is to represent the tile with a matrix of $0$s for blank space and $1$s for filled spaces like in $\\{\\{0,1,1\\}, \\{1,0,0\\}\\}$. ![The tile.](http://i.stack.imgur.com/0k8C4.png) The square (or a general rectangular area) is represented by an array as well. The function should then have as arguments two lists (representing the tile and the area) and should find the ways (if they exist) to do the tiling. This is quite an hard problem for me, I have tried playing with `Plus`, so that if the result matrix has $2$ it means that the tile overlaps while if it is $0$ there is a gap but I can't find a way to tell _Mathematica_ that they should fit the area.


title: Line of best fit on LogLog plot

text: I have a LogLog plot, and i'm unsure about how to fit a line to it. The data represents a calibration curve.                calibdata = {{1, 39270.4}, {0.01, 4982.57}, {0.001, 1153.55}}      ListLogLogPlot[calibdata, PlotMarkers -> {Automatic, Medium}]


title: Building a continued fraction

text: I've completed a problem that involves approximating $e$ by a continued fraction: $$\frac{N_1}{D_1+\frac{N_2}{D_2+\frac{N_3}{\ddots+\frac{N_k}{D_k}}}}$$ with the $N_i$ being the list `{1,1,1, …}` and the $D_i$ being the list `{1,2,1,1,4,1,1,6,1,1,8, …}`. (Note: The continued fraction actually approximates $e-2$). The overarching structure of computing the continued fraction is a straightforward application of `Fold` with the following function defined:               f[x_, {m_, d_}] := m/(d+x);     eContFracApprox[n_] := Fold[f, 0, (*properly constructed list of pairs*)]      which shifts the crux of the problem to generating the lists for $N_i$ and $D_i$ and combining them properly. I have a solution, but I'm not happy with it:               Reverse[     MapThread[       List, {Table[1, {n}],         Take[Flatten[{Join[{1, 2}, Table[{1, 1, i}, {i, 4, n, 2}]]}],n]}     ]     ]      I think it's ugly and it doesn't work for values of $n < 3$. Perhaps someone can suggest a different/better approach? Specifically, I'd like to know if we can do away completely with `MapThread` and generate the list of pairs directly from an application of `Table`. * * * **Edit 1** : Just to be clear. I'm looking for an improvement to generating the lists of the $N_i$ and $D_i$. Although, alternate ways of generating continued fractions are also appreciated. I'll also add my complete function for reference:               eContinuedFractionApprox[n_Integer] := Module[{f},       f[x_, {m_, d_}] := m/(d + x);     N[Fold[f, 0,      Reverse[       MapThread[List,        {Table[1, {n}], Take[Flatten[{Join[{1, 2}, Table[{1, 1, i},              {i, 4, n, 2}]]}],          n]         }        ]       ]      ],     n     ] + 2      ]


title: Check when DSolve returns input

text: I'm making a program where i need to plot the soluton of an ODE and ,if possible, obtain the analytical solution. My idea was to use DSolve, check the output, and if it failed use NDsolve. Now, i know i can set a time limit using `TimeConstrained[]` , but how do i check when DSolve instantly return the input because the alculation is too complex or there is no analytical solution? sorry if this was answered elsewere, i tried to search but i couldn't find anything related.


title: Changing Plot order for 3D printing

text: Alright, I got a my first 3D print done of a pseudosphere using parametric plot and a deflated sphere using a contour plot, but when I try               ParametricPlot3D[         {Cos[v]*(3 - u) + .25*Sin[4 u],           Sin[v]*(3 - u) + .25 Sin[4 u],           u},        {u, 6, 13}, {v, 6, 13},       PlotStyle -> {Thickness[.3], FaceForm[Yellow, Blue]},        PlotPoints -> {50, 50}, MaxRecursion -> 0, Mesh -> All]       it gives an error about triangulation self-intersects. I do not have the exact error code because I'm not in charge of the MakerBot. It makes the first round and then stops. I noticed that the estimated time was 50 times longer than it took for that first loop. Is there a way to fix that, and maybe a changing plotting order would be more machine friendly?