title: Function or script which maxes out the CPUs?

text: I've been using Mathematica for awhile now and have never come even close to maxing out my CPU cycles. Are there any functions which consume lots of CPU cycles? Right now I am running a script which uses Parallelize and is consuming about 15%. Also, a related question -- is there any way to get Mathematica to use more CPUs? It'd be nice to get to my answers faster.


title: Performing operations on function lists

text: I am exploring the use of `Dynamic` variables for the `ViewPoint` and `ViewVertical` options in a `Graphics3D` object. I have the following code:               vp = {0, -5, 0}     vv = {0, 0, 1}     (* Cell break here to make changes in vp and vv a bit easier *)     img = Graphics3D[{Yellow, Cuboid[{0, 0, 0}, {1, 3, 1}], Blue,        Cuboid[{2, 1, 1}, {4, 2, 3}]}, SphericalRegion -> True,        Lighting -> "Neutral", ViewPoint -> Dynamic[vp],       ViewVertical -> Dynamic[vv]]     (* Another cell break, but hopefully making cut and paste easier by adding comments *)     {ViewVertical, ViewPoint} /. AbsoluteOptions[img]      There are two things that bother me:   1. The `AbsoluteOptions` line throws an error ViewPoint::nlist3 is not a list of numbers. I presume this is because the `Head` of vp is `Dynamic`. This error isn't thrown for ViewVertical, however, which I would expect should complain as well. Am I missing something, or can the `ViewVertical` error be safely ignored? (I don't like quieting errors for fear of covering up something later on down the line.)    2. Because of the dynamic head, operations on vv and vp require a bit of manipulation. For example, in the next bit of code, the first line doesn't work and the second line does, but obviously the dynamic evaluation has been lost: .               Norm[ViewVertical /. AbsoluteOptions[img]]     Norm[(ViewVertical /. AbsoluteOptions[img]) /. {Dynamic -> List}]      Again, I worry about my hack to change Dynamic into a List isn't the most elegant (or safe) way to gain access to these values. Furthermore, I envision wanted to maintain the Dynamic nature of the data manipulation. Any suggestions would be welcome. P.S. I have looked here for some guidance, and while helpful in framing the picture, I'm still a bit confused with the use of Dynamic in this case.


title: How to pop out of a subsection in a notebook

text: Let's say I have a section in a notebook, which I begin with a `cmd-4` keystroke. I type in some text and expressions, and now I want to introduce a subsection for some subordinate material. I type a `cmd-5`, write a title, build up my stuff, and now I want to pop out or "return" to the main stream of the section ("back to our regularly scheduled programming"). But I don't see a way to do that. The subsection fold-bars (on the right-hand side of the notebook display) seems to continue to the very end of the section or to the beginning of the following peer subsection. To close off the subsection, it seems I must create a new subsection.


title: how to generate repeatable Unique streams?

text: I need to label some data in arbitrarily nested ragged lists, with a stream of unique labels. It's very convenient if the labels are consecutive integers, starting at 0 or 1, and if I can produce the same stream every time I label a given data set. I can do this with recursive functions that thread around the current label in the parameter list and conventionally in every output (say the first element in a list, by convention; this is essentially an explicit simulation of the state monad of Haskell). It's cumbersome and ugly, so I'm looking for a better solution. `Unique` comes close to fitting the bill. In a fresh kernel, MMA version 9.0.1 on Mac 10.8.4, consider the following               Table[Unique[],{3}]           {$3, $4, $5}      Great. Let's try starting them at 1, following the documentation,               $ModuleNumber = 1;      Table[Unique[], {3}]          {$6, $7, $8}      Ooops, surprise! The following, which was my first attempt, produces an internal ENULL bugcheck               Block[{$ModuleNumber = 1},      Table[Unique[], {3}]]          Mathematica has detected an internal error:       vMessage ENULL          Please report this error as soon as possible to     support@wolfram.com giving as many details as possible     of the circumstances under which it occurred.      I can mimic the entire thing with my own global state variable and mimic of `Unique`, but thought I'd first check here for insight and advice.


title: Hierarchical clustering: convert Mathematica cluster hierarchy to NEWICK format

text: Can anyone tell me a clever way to convert the hierarchical clustering object, created, say, by `Agglomerate` or `DirectAgglomerate` (of the built-in hierarchical clustering package) to the so-called Newick (or New Hampshire) format used in biology? It would convert               Cluster[Cluster[     Cluster["A", Cluster["H", "J", 1.52217, 1, 1], 28.8538, 1, 2],      Cluster[Cluster["C", "E", 10.1371, 1, 1], "D", 22.0063, 2, 1],             47.1129, 3, 3], Cluster[Cluster["B", Cluster["G", "I", 2.5374, 1, 1],            5.73533, 1, 2],"F", 13.6197, 3, 1], 64.5168, 6, 4]          to               (((A:28.85378,(H:1.52217,J:1.52217):27.33162):18.25912,      ((C:10.13706,E:10.13706):11.86925,D:22.00630):25.10660):17.40389,      ((B:5.73533,(G:2.53740,I:2.53740):3.19793):7.88433,F:13.61966):50.89713)      the latter composed of branch lengths rather than nodal abscissae.


title: Specific initial sample points for 3D plots

text: `PlotPoints` lets you determine _how many_ sample points you want in each direction, but sometimes I want specific ones. For `Plot` you can give an argument like `PlotPoints->{None, pts}` to use `pts` as the initial points:               Show[      Plot[Sin[x], {x, -3 Pi, 3 Pi},       PlotStyle -> Red,       MaxRecursion -> 0,       PlotPoints -> {None, {-7.3, -5.2, -Pi, Pi, 3.8, 5}},       PlotRange -> {{-3 Pi, 3 Pi}, {-1, 1}}],      Plot[Sin[x], {x, -5 Pi, 5 Pi},PlotStyle -> Dashed]      ]      ![custom samples](http://i.stack.imgur.com/jks1N.png) Is this also possible for `Plot3D`? Whatever I try I end up with completely broken plots, anyone know the syntax of what I have stumbled into? **EDIT** `PlotPoints->{Automatic,pts}` seems to work, although about 2x as many points are used.               f[x_, y_] := Cos[y]^3 Sin[x]^2 + Cos[x] Sin[y]     pts3d = Reap[Plot3D[f[x, y], {x, -5, 5}, {y, -5, 5},                         EvaluationMonitor :> Sow[{x, y}]]][[-1, 1]];     opts = {{Automatic, "Automatic"},             {{None, pts3d}, "{None, pts3d}"},             {{Automatic, pts3d}, "{Automatic,pts3d}"},             {{Automatic, RandomReal[{-5, 5}, {5000, 2}]}, "{Automatic,Random}"}             };     Row[Plot3D[f[x, y], {x, -5, 5}, {y, -5, 5},         PlotPoints -> First@#,         PlotLabel -> Last@#,         ImageSize -> 200] & /@ opts]      ![plot](http://i.stack.imgur.com/ysmCN.png) Here are three plots with exactly the same points that look different:               {orig, {origpts}} = Reap[DensityPlot[f[x, y], {x, -5, 5}, {y, -5, 5},         EvaluationMonitor :> Sow[{x, y}]]];     {auto, {autopts}} = Reap[DensityPlot[f[x, y], {x, -5, 5}, {y, -5, 5},         PlotPoints -> {Automatic, RandomSample[origpts]},         MaxRecursion -> 0,         EvaluationMonitor :> Sow[{x, y}]]];     {none, {nonepts}} = Reap[DensityPlot[f[x, y], {x, -5, 5}, {y, -5, 5},         PlotPoints -> {None, RandomSample[origpts]},         MaxRecursion -> 0,         EvaluationMonitor :> Sow[{x, y}]]];          (* All give {} *)     DeleteCases[origpts, Alternatives @@ autopts]     DeleteCases[autopts, Alternatives @@ origpts]     DeleteCases[nonepts, Alternatives @@ origpts]          {orig, auto, none}      ![same but different](http://i.stack.imgur.com/lfuoG.png)


title: Error from BoundedDiagram

text: I cannot understand the meaning of the error > BoundedDiagram::notuniq: BoundedDiagram requires that boundary vertices lie > in unique Voronoi polygons. >> > > BoundedDiagram::nobd: Bounded diagram failed. >> When I try to run the following code, it gives me the above error.               Needs["ComputationalGeometry`"]     Boundary = {{-2, 2}, {2, 2}, {2, -2}, {-2, -2}};     points = {{-1, 0}, {1, 0}, {1, 1}};     BoundedDiagram[Boundary, points]     DiagramPlot[points]      Is it a problem with the code? Have i misunderstood `BoundedDiagram`? What I have posted here is a simplified situation. I am using more points in real work.


title: How can automatic ticks be made "outie"?

text: By default, `FrameTicks` stick into the data area in a way that is sometimes uncomfortable.               Plot[Cos[x], {x, 0, 10}, Frame -> True]      ![enter image description here](http://i.stack.imgur.com/YrX0O.png) I see that I can create "outie" ticks manually using               Plot[      Cos[x], {x, 0, 10}, Frame -> True,       FrameTicks -> {{{0, 0, {0, 0.01}}, {Pi, Pi, {0, .01}}, {2 Pi, 2 Pi, {0, 0.01}}, {3 Pi, 3 Pi, {0, 0.01}}}, {{-1/2, -1/2, {0, 0.01}}, {1/2, 1/2, {0, 0.01}}}, None, None}     ]      ![enter image description here](http://i.stack.imgur.com/KtZo1.png) But I want to use the automatic tick positions, sizes and labels. I can (kind of) achieve this so:               With[      {originalPlot = Plot[Cos[x], {x, 0, 10}, Frame -> True]},      Show[originalPlot,        FrameTicks -> AbsoluteOptions[originalPlot, FrameTicks][[1, 2]] /. {a_, b_, {c_, d_}, e___} :> {a, b, {d, c}, e}]      ]      ![enter image description here](http://i.stack.imgur.com/IfSU4.png) There are (at least) three problems with this approach:   1. Extra vertical-axis tick labels have been inserted; all vertical-axis ticks appear to have been converted to minor ticks.   2. Trailing decimal points have been added to the integer tick labels.   3. `FrameStyle` no longer affects the ticks, apparently because the `ReplaceAll` solution hardcodes the `FrameTicks` style before `FrameStyle` is applied: An example of correct application of `FrameStyle` (with default, "innie" ticks):               Plot[Cos[x], {x, 0, 10}, Frame -> True, FrameStyle -> Gray]      ![enter image description here](http://i.stack.imgur.com/IWfGW.png) An example of broken application of `FrameStyle`:               With[      {originalPlot = Plot[Cos[x], {x, 0, 10}, Frame -> True, FrameStyle -> Gray]},      Show[originalPlot,        FrameTicks -> AbsoluteOptions[originalPlot, FrameTicks][[1, 2]] /. {a_, b_, {c_, d_}, e___} :> {a, b, {d, c}, e}]     ]      ![enter image description here](http://i.stack.imgur.com/HsbXo.png) How can this approach be improved to address these problems?


title: How to change the aspect ratio with drawing tool?

text: I'm drawing an image in editing an slide show with the drawing tools. But the aspect ratio of the created drawing seems fixed and not changeable with mouse dragging the border and corner as in other applications. How can I change this ratio?


title: Why does this pattern with Plus not work for numbers?

text: I have a very simple question about redefining basic built-in functions, such as `Plus`. I'm pretty sure someone must have asked a similar question around here, but I couldn't find one. Consider the following code:               Unprotect[Plus];     x_ + y_ := x y     Protect[Plus];      For symbols this works as expected:               x+y     (* ---> x y *)      For numbers, however, the new definition does not work:               1+2     (* ---> 3 *)      Of course I know that it is stupid to use something like this and that defining functions or using upvalues etc. is the way to go here, but I'm really interested in why this happens. Can the pattern for `Plus` be defined in such a way that it works for numbers as well? Is `Plus[1,2]` evaluated internally _before_ the pattern can be matched?


title: How to add fill color to a 2D Graphics object?

text: Problem / background: consider the following code snippet.               pnt[fig_, n_] := {fig[[1, n]], fig[[2, n]]}     hor := {.025, .1, .25, .4, .475, .525, .6, .75, .9, .975}     ver := {.05, .20, .80, .95}     fig4 := Transpose[{        {hor[[1]], ver[[2]], 1}, {hor[[2]], ver[[1]], 1}, {hor[[4]],          ver[[1]], 1}, {hor[[5]], ver[[2]], 1},        {hor[[1]], ver[[3]], 1}, {hor[[2]], ver[[4]], 1}, {hor[[4]],          ver[[4]], 1}, {hor[[5]], ver[[3]], 1},        {hor[[6]], ver[[2]], 1}, {hor[[7]], ver[[1]], 1}, {hor[[9]],          ver[[1]], 1}, {hor[[10]], ver[[2]], 1},        {hor[[6]], ver[[3]], 1}, {hor[[7]], ver[[4]], 1}, {hor[[9]],          ver[[4]], 1}, {hor[[10]], ver[[3]], 1},        {hor[[3]], ver[[2]], 1}, {hor[[3]], ver[[3]], 1},        {hor[[8]], ver[[2]], 1}, {hor[[8]], ver[[3]], 1}        }]     draw4A[fig_] := {       BezierCurve[{pnt[fig, 1], pnt[fig, 2], pnt[fig, 3], pnt[fig, 4]}],       BezierCurve[{pnt[fig, 5], pnt[fig, 6], pnt[fig, 7], pnt[fig, 8]}],       BezierCurve[{pnt[fig, 9], pnt[fig, 10], pnt[fig, 11], pnt[fig, 12]}],       BezierCurve[{pnt[fig, 13], pnt[fig, 14], pnt[fig, 15],          pnt[fig, 16]}],       Line[{pnt[fig, 1], pnt[fig, 4]}],       Line[{pnt[fig, 5], pnt[fig, 8]}],       Line[{pnt[fig, 9], pnt[fig, 12]}],       Line[{pnt[fig, 13], pnt[fig, 16]}]}     Graphics[draw4A[fig4]]      which draws four half-pie type of objects: ![enter image description here](http://i.stack.imgur.com/iC6N8.png) Question: I want to fill each part with a different, optional color different than that of the surrounding line. **How can I add this fill color?**


title: Recursive Integration

text: I'd like to evaluate the following recursive integration using _Mathematica_ $$ \ M(T) = \int_0^T\int_0^\infty e^{-\delta s}g(x,s)dxds\ +\int_0^T e^{-\delta s}f(s)M(T-s)ds\, $$ where $g(x,s)$ and $f(s)$ are statistical probability density functions. Since it's a recursive function, the initial condition is given by $M(0) = 0$. For simplicity we can assume $f(s)$ to be an exponential PDF and $g(x,s)$ to be a Farlie–Gumbel–Morgenstern Copula PDF. I am not interested in the closed form solution of $M(T)$, rather I am interested only in its numerical answer. This is what I've tried so far:               FGMExpExp = Exp[-2 (s + 10 x)] (36. - 18. Exp[s] + Exp[10 x] (-18.  + 19. Exp[s]));     Delta = 0.04; a = 10; b = 1;      M[0] = 0; (* Initial Condition *)          Mu[T_] := Mu[T] = NIntegrate[Exp[-Delta*s]*x FGMExpExp, {x, 0, 1.05}, {s, 0, T}] +          NIntegrate[b Exp[-(Delta + b)*(T - s)] Mu[s], {s,0, T}]   (* Defining the integration *)     Mu[1] (* The quantity we are interested in. Will change T=1 to T=5 later *)      Your help is greatly appreciated.


title: Why changing list's head takes time?

text: Consider               AbsoluteTiming[Range[10^7];][[1]]      > 0.035000 and               AbsoluteTiming[HoldComplete @@ Range[10^7];][[1]]      > 0.725000 Why it takes twenty times longer to change head than to create a list? Since `HoldComplete` doesn't evaluate arguments one would think that head changing should be fast.


title: I can't Plot the equation -(π/4) + x - 1/2 Sin[2 x] == 0

text: I'm starting with _Mathematica_ and I can't solve numerically the equation               -(π/4) + x - 1/2 Sin[2*x] == 0      using `NSolve` as well as I can't plot it correctly because when I do               eqn1 = x - (Sin[2*x]/2) - (Pi/4) == 0     Plot[eqn1, {x, -2, 2}]      it shows an empty window with nothing more than just the x and y axis.


title: Inverse of a polynomial in a polynomial ring

text: Let $N$ be a prime, and $q$ be a positive integer. Given a polynomial $f(x)$ in $R = \mathbb Z[x]/(x^N-1)$, I want to find another polynomial $f_q(x)$ in $R_q = \mathbb Z_q[x]/(x^N-1)$, such that $$f(x)f_q(x)=1 \pmod q$$ I want _Mathematica_ to tell me   1. whether the inverse polynomial $f_q(x)$ exists; and   2. if so, find $f_q(x)$. > Examples for $N=11$ and $q=32$ are cited from Wikipedia's entry on > NTRUEncrypt: > > $f(x) = -1 + x + x^2 - x^4 + x^6 +x^9 - x^{10}$ > > $f_q(x) = 5 + 9x + 6x^2 + 16x^3 + 4x^4 + 15x^5 + 16x^6 + 22x^7 + 20x^8 + > 18x^9 + 30x^{10}$


title: How can I efficiently ArrayFlatten a matrix of sparse matrices?

text: I have a matrix of sparse matrices that I want to convert to a sparse block matrix. So, basically I want what `ArrayFlatten` does, except that I want the output to be sparse. So e.g.:               sp = SparseArray[{{2, 2} -> 1.}, {50, 50}];     sparseArrayFlatten[      {       {sp, 0},       {0, -sp}       }]      should return `SparseArray[{{2, 2} -> 1., {52, 52} -> -1., {_, _} -> 0},{100,100}]`. Currently, I use `SparseArray@ArrayFlatten[...]`, but for large matrices, this is inefficient. (Sometimes `ArrayFlatten` _does_ return a sparse array, but I haven't completely figured out when. For example, if I remove the `-` sign above, or if I use `-> 1` instead of `-> 1.`, I get a sparse result.)


title: Optimizing List Multiplications

text: I've got a list manipulation optimization problem. Consider a two-dimensional nxm list `list1`, and a three-dimensional nxmxm list, `list2`. Is there a faster way of taking the following product?               Table[list1[[i]].list2[[i]].list1[[i]], {i, 1, length}]      I know that Table operators are notoriously slow, and this seems like there might be a built-in list-manipulation operator to accomplish the same thing, or something very similar.


title: How to get path and file name of a pasted image?

text: Say in Documentation Center -> ImageData -> EXAMPLES ->   Basic Examples you find an image of a planetary body (Mars?). Can one obtain the file source for this image wich is copied   into a Mathematica line? The image is originated for shure in   Mathematicas images samples somewhere in its folders.   What I mean however is to get the info rigth from the picture   in that Notebook.


title: Plotting geodesics of upper half plane

text: I want to solve (numerically) the geodesics of the upper half plane and plot. The results are quite known (i) straight lines parallel to $y$-axis and (ii) semicircles centered on the $x$-axis. Now the problem is how to solve the coupled ODEs. I tried with `NDSolve` but the results are not coming. Can you please write a code and help me. Here are the coupled ODEs: $$\begin{align*} \ddot{x} &= \frac{2\dot{x}\dot{y}}{y}\\\ \ddot{y} &= \frac{-\dot{x}^2+\dot{y}^2}{y} \end{align*}$$ Thanking you in advance.


title: Am I missing something in this integral?

text: I am trying to solve this simple integral:               Integrate[Cos[m*x]*Cos[mp*x], {x, 0, 2 \[Pi]},       Assumptions ->         Element[m - mp, Integers] && Element[m + mp, Integers] &&         m - mp != 0 && m + mp != 0]      which is zero. However, Mathematica gives:               1/2 (Sin[2 (m - mp) \[Pi]]/(m - mp) + Sin[2 (m + mp) \[Pi]]/(m + mp))      Why?, any tip? Thanks


title: How to provide data to users in a way similar to Mathematica's curated data

text: How can one go about implementing a custom data backend usable by _Mathematica_? For example something like `CountryData` or `FinancialData`? I would like to expose our data backend as a service with similar access logic used in the above mentioned data libraries.


title: How can I obtain the complex root of an equation with FindRoot

text: I want to obtain the complex roots of some equations that are similar,but each of them has a different condition. this difference is the value of `α` in these equations. When I try to obtain the complex roots, just the real part is close to correct value, but the imaginary part is identical for all of the equations, and an error message was returned every time. What is the reason for this? The coding has many special characters and fancy formatting, making it hard to post my code here, so I have posted images. The images show the main equation with `α = .1` and the results for `α = .1` `α = .2` and `α = .3`, respectively, and the error message I got. Here are the images: ![enter image description here](http://i.stack.imgur.com/oj957.png) ![enter image description here](http://i.stack.imgur.com/WE2Vu.png) ![enter image description here](http://i.stack.imgur.com/YzLGc.png) And here is the code:                Subscript[j, ν, 1][s_] = s*(SphericalBesselJ[0, s]) - 1*(SphericalBesselJ[1, s])      Subscript[j, 1][s_] = SphericalBesselJ[1, s]      Subscript[n, ν, 1][s_] = s*(SphericalBesselY[0, s]) - 1*(BesselY[1, s])      Subscript[n, 1][s_] = SphericalBesselY[1, s]      Subscript[h, 1][s_] = SphericalBesselJ[1, s] + I*(SphericalBesselY[1, s])      Subscript[h, ν, 1][s_] =         s*(SphericalBesselJ[0, s] + I*(SphericalBesselY[0, s])) -         1*(SphericalBesselJ[1, s] + I*(SphericalBesselY[1, s]))      α = .1      β = .95      Subscript[u, B][w_] =         .10114688*Sqrt[5.59` + 0.031098192`/((3.30216`- 0.000049206` I) - w)]      Subscript[u, C][w_] = .10114688* w Sqrt[3.7` - 81/((0. + 0.01728` I) w + w^2)]      Subscript[u, A][w_] = .10114688*Sqrt[1.777]*w      Subscript[u, D][w_] = .10114688*w           FindRoot[Det[{        {Subscript[j, 1][α Subscript[u, D][w]], -Subscript[j, 1][α Subscript[u, C][w]],          -Subscript[n, 1][α Subscript[u, C][w]], 0, 0, 0},         {((Subscript[u, C][w])^2)*Subscript[j, ν, 1][α Subscript[u, D][w]],          -((Subscript[u, D][w])^2)*Subscript[j, ν, 1][α Subscript[u, C][w]],          -((Subscript[u, D][w])^2)*Subscript[n, ν, 1][α Subscript[u, C][w]],          0, 0, 0},         {0, Subscript[j, 1][β Subscript[u, C][w]], Subscript[n, 1][β Subscript[u, C][w]],          -Subscript[j, 1][β Subscript[u, B][w]], -Subscript[n, 1][β Subscript[u, B][w]], 0},         {0, ((Subscript[u, B][w])^2)*Subscript[j, ν, 1][β Subscript[u, C][w]],          ((Subscript[u, B][w])^2)*Subscript[n, ν, 1][β Subscript[u, C][w]],          -((Subscript[u, C][w])^2)*Subscript[j, ν, 1][β Subscript[u, B][w]],          -((Subscript[u, C][w])^2)*Subscript[n, ν, 1][β Subscript[u, B][w]], 0},         {0, 0, 0, Subscript[j, 1][Subscript[u, B][w]],          Subscript[n, 1][Subscript[u, B][w]], -Subscript[h, 1][Subscript[u, A][w]]},         {0, 0, 0, ((Subscript[u, A][w])^2)*Subscript[j, ν, 1][Subscript[u, B][w]],          ((Subscript[u, A][w])^2)*Subscript[n, ν, 1][Subscript[u, B][w]],          -((Subscript[u, B][w])^2)*Subscript[h, ν, 1][Subscript[u, A][w]]}       }] == 0, {w, 4.6}]


title: Version 8.0 integrates but Version 9.0.1 doesn't

text: I am trying to run the following integral in version 9.0, but it fails:               Integrate[      2 I (-1 +        x) ((-8 + 12 x - 6 m\[Pi]^2 x - 2 m\[Pi]^2 x^2 -         4 x^3)/((1 - x)^2 +         m\[Pi]^2 x) + ((4 - 2 x + 4 m\[Pi]^2 x - 8 x^2 +         6 m\[Pi]^2 x^2 + 6 x^3) Log[         1/((1 - x)^2 + m\[Pi]^2 x)])/((1 - x)^2 + m\[Pi]^2 x)), {x, 0,        1}, Assumptions -> m\[Pi] > 0 && m\[Pi] < .1]      Version 9.0.1: ![Version 9.0](http://i.stack.imgur.com/V0LB0.png) But in version 8.0, it works: ![enter image description here](http://i.stack.imgur.com/CQEZj.png) Is this a bug, or is the integral really non-convergent? What's a possible workaround, since I don't have easy v8 access?


title: Opening notebooks from Workbench on Mac OS X?

text: I recently switched from Windows 7 to Mac OS X 10.9.2 for Mathematica development, and have set up Mathematica 9.0.2 and Wolfram Workbench 2 (running under Eclipse Kepler). Most everything works pretty well. However, on Windows, I would often work with notebooks by double-clicking them in Eclipse's "Package Explorer" view, which would open them in an already-running Mathematica front-end if there was one available. This was a pretty convenient. It also doesn't seem to work on the Mac; when I double click a notebook, it launches a whole new front-end. This is less convenient. I can drag the little notebook icons onto the Mathematica icon in the Dock, but double-clicking would be nicer if I can make it work. The obvious trick was to replace the path to the front-end executable with the path to `open`, the Mac OS command-line tool for opening documents in their associated applications. This didn't work even a little bit, with Eclipse complaining that the path to the executable was wrong.


title: Including two ListLinePlots in a 3D graphic

text: I have two lists of data which I am plotting on two `ListLinePlots`. I would like to have these two plots appear perpendicular to each other on a 3D graphic. I have tried to do this using a modification to the answers to this question, but I am quite new to _Mathematica_ so I had some trouble converting this into code that works for me. Is there any way that I can implement this method when the data is lists rather than functions of some variable?


title: How to combine file data chronologically via reading numbers in a filename and put it in one list?

text: Say I have a bunch of files with nearly same filename, eg. data_timestep1, data_timestep2, ... The data itself in one file is ({x1, y1, z1, absolute field value 1}, {x2, y2, z2, absolute field value 2}, ...), **ASCII table data format** Now I want to put all data from all timestep files into one single file in the form: ({x1, y1, z1, absolute field value 1, timestep1}, {x1, y1, z1, absolute field value 1, timestep2}...,{x2, y2, z2, absolute field value 2, timestep1}, {x2, y2, z2, absolute field value 2, timestep2}...,) so all vectors that belong to unique x, y, z position should be able to be read and sorted by the timestep value, to do FFT Thanks for your tips


title: Taking Top K Occurrences

text: Having millions of numbers in a list, I want to take top `K` occurrences. MMA `Commonest` is very slow so I write my own versions:               a=RandomInteger[{1,1000000},50000000];          MyCommonest1[a_,n_]:=Take[SortBy[Tally[a],Last],-n]          MyCommonest2[a_,n_]:=(b=Tally[a];Take[b[[Reverse[Ordering[b[[All,2]]]]]],n])          MyCommonest3[a_,n_]:=(b=Tally[a];b[[Take[Ordering[b[[All,2]]],-n]]])          MyCommonest4[a_,n_]:=Take[SortBy[Tally[a],-#[[2]]&],n]      Timings:               1.68     1.12     1.15     1.70      Can it be any faster? **Edit** The C# counterpart of this problem in SO is here.


title: Plotting spaces spanned by parameters

text: Suppose I have three coordinates functions of a vector of parameters: x[q],y[q],z[q] where q is at least a three dimensional vector in some domain Q. Is it possible to plot in 3D the space spanned by q? By that I mean all the triplets {x',y',z'} such that there is at least one q in Q such that x[q]=x',y[q]=y',z[q]=z'? Of course I would be happy if this worked with intervals (say Q is the unit cube). And of course I would be happy with the surface of the subset. I need to quickly check that this is a convex subset of R^3. So any other method is welcome.


title: How can I efficiently write formatted data to a Gaussian Cube file?

text: I am working with data files that contain information about electronic wave functions. The data format is specified by the quantum chemistry program Gaussian. I need to import the data, manipulate it, then output it so it can be read by other programs. The file format is specified here, and I put an example file here. The problem is that outputting the data to a file takes an unconscionably long time, and I want to know if that time can be reduced or if it is as fast as it can be. In the example below, the data file is small (less than 2mb), but I am currently working with much larger files, where just writing the file takes over a minute and ends up being the rate-limiting step in my calculations. The data can be read in via                   header = Import["http://pastebin.com/raw.php?i=JXtLghmD", "Text"];         cubedata = ToExpression[Import["https://gist.github.com/anonymous/f37baaa89e8a17d39f12/raw/d872df53f9251827ef4a7ec6f00087dd7f94552d/form_MO_28"]];      If I only need to use the data inside of _Mathematica_ , then the easiest and fastest thing to do is to write it to a binary format.                   Export["cube_28.nc", {"Cube" -> cubedata,"HeaderText" -> header}] // AbsoluteTiming      When I run the above code, it takes two thirds of a second to execute and the resulting file is about 1mb. But if I need to write the data so molecular visualization software can read it, I have to write a text file. Since there is no good printf in Mathematica, this was improvised:                   OutForm[num_?NumericQ, width_Integer, ndig_Integer, OptionsPattern[]] :=            Module[{mant, exp, val}, {mant, exp} = MantissaExponent[num];            mant = ToString[NumberForm[mant, {ndig, ndig}]];            exp = If[Sign[exp] == -1, "-", "+"] <> IntegerString[exp, 10, 2];            val = mant <> "E" <> exp;            StringJoin@PadLeft[Characters[val], width, " "]];              WriteCube[cubeFileName_?StringQ, headerTxt_?StringQ, cubeData_] :=            Module[{moltxt, nx, ny, nz},             moltxt = OpenWrite[cubeFileName, FormatType -> FortranForm];            WriteString[moltxt, headerTxt];            WriteString[moltxt, "\n"];            {nx, ny, nz} = Dimensions[cubeData];            Do[Do[Do[WriteString[moltxt, OutForm[cubeData[[x, y, z]], 13, 5]];                If[Mod[z, 6] == 0, WriteString[moltxt, "\n"]];, {z, 1, nz}];               WriteString[moltxt, "\n"];, {y, 1, ny}];, {x, 1, nx}];            Close[moltxt];];      And now I can write the data to a formatted Gaussian cube file via                   WriteCube["cube_28.cube", header, cubedata] // AbsoluteTiming      which takes eight seconds to execute and results in a 1.68mb file. Does creating the formatted ASCII output have to take twelve times as long to create? Is there any way OutForm and WriteCube could be written more efficiently?


title: How to include automatic references to cells styled with DisplayFormulaNumbered

text: Under the `Style` menu, there is an entry called `DisplayFormulaNumbered`. It does exactly what it seems to suggest: it indexes the contents of the cell by an auto-incrementing number. The numbering is updated throughout the notebook automatically. For instance, if I have three formulas numbered `(1)`, `(2)` and `(3)`, and I delete `(2)`, Formula `(3)` automatically becomes Formula `(2)`. But the references to Formula `(3)` in the text of the notebook are not updated automatically. I have to manually change all of them. Is there a way to automate this task? (Sorry, I can't seem to give a better description of the problem.)


title: What Mathematica features and idioms have n^2 complexity or worse

text: Here are a few: `AppendTo[data, elem]`, `Sort[data, test]`, in some cases use of `___` (as mentioned in David Wagner's book). **Edit:** A Wolfram Research developer explains here why `Union[data,test]` has quadratic complexity, and I am pretty sure the same applies to `Sort[data,test]`. The same Worfram developer explains here that AppendTo[data,elem] has quadratic complexity. There are many math problems such as `Inverse[natrix]`, `FactorInteger[n]` that are inherently expensive on large problems. The most important answers to this question will be features in the core language that can kill the performance of a program. Sometimes you can greatly improve the performance of your program if you avoid such features.


title: Show only the outlines of graphic primitives

text: I want to go from               Graphics[{Red, Rectangle[{0, 0}, {1, 3}], Blue, Polygon[{{1, 1}, {3, 1}, {2, 2}}]}, Frame -> True]      ![enter image description here](http://i.stack.imgur.com/7uJJS.jpg) to ![enter image description here](http://i.stack.imgur.com/S0L0a.jpg) I have rather clumsily written:               RectangleToLines[r_] := With[{n = Flatten @ r},       Line[{{n[[1]], n[[2]]}, {n[[3]], n[[2]]}, {n[[3]], n[[4]]}, {n[[1]],n[[4]]}, {n[[1]], n[[2]]}}]       ]          RectangleToLines[{{0, 0}, {1, 3}}]      > Line[{{0, 0}, {1, 0}, {1, 3}, {0, 3}, {0, 0}}] and similar with the triangle. Terrible, because I would end up with many "FormToLines"-definitions. I feel - that especially with **V10** \- there should be a much cleverer way to do this.


title: How do I built a zoomable Koch curve?

text: I'm new to Mathematica and my goal is to write a simple program in order to demonstrate self-similarity of the Koch curve by zooming in. Here is a good example of what I mean (it's a Java applet). I was going to start learning the built-in powers of Mathematica for a long time and it seems to be a good opportunity. Given the simplicity of the program and popularity of fractals I was sure I'd find many working examples online, yet it turned out to be not the case. In particular, how can one make this zoomable:               f[form_, {a_, b_}] :=      AffineTransform[{{b - a, ({{0, -1}, {1, 0}}).(b - a)}\[Transpose],      a}][1/Norm[      Last[form] - First[form]] TranslationTransform[-First[form]][     form]]          g[form_, points_] :=      Flatten[Map[f[form, #] &, Partition[points, 2, 1]], 1]          Manipulate[form = Append[Prepend[pts, {-Sqrt[3], 1}], {Sqrt[3], 1}];     base = Nest[g[form, #] &, form, refinements];     If[maketriangle,      triangle =      Join[base, RotationTransform[4 \[Pi]/3.][base],      RotationTransform[2 \[Pi]/3.][base]]];     plaatje =      Graphics[{If[     maketriangle, {ColorData[1][1], Polygon[triangle]}, {}],      AbsoluteThickness[1.3], Line[If[maketriangle, triangle, base]],      If[refinements == 0, {Thick, Line[form]}, {}]},      PlotRange -> {{-3.5, 3.5}, {-2.3, 2.3}},      AspectRatio ->      Automatic], {{pts, {{-Sqrt[3]/3, 1}, {0, 2}, {Sqrt[3]/3, 1}}},      Locator, LocatorAutoCreate -> True,      ContinuousAction ->      If[refinements > 2, False, True]}, {{refinements, 0,      "Refinements"}, 0, 6, 1,      SetterBar}, {{maketriangle, True, "Make triangle"}, {True, False}},      SynchronousUpdating -> False, SaveDefinitions -> True]      Source: Create Alternative Koch Snowflakes


title: Labeling a Plot with a Slash for Division Sign

text: I'm trying to label a 2D plot with something like $A/B$ rather than $\frac{A}{B}$. I have tried: `Plot[Sin[x], {x, 0, 10}, AxesLabel -> {HoldForm[A/B], y}]` However, this leaves the $x$-axis as $\frac{A}{B}$. Any ideas?


title: Reading periodic elements from a large file

text: I have a large binary data file (big endian) with 100+ million "rows" of 11 elements, combination of floats and integers. This is the format:               {"Real32", "Real32", "Real32", "Real32", "Real32", "Real32", "Real32", "Real32", "Real32", "Integer32", "Integer32"}      This question: How to read data file quickly?, is related but not exactly the same. I've been reading in the whole file like this:               str = OpenRead[filename, BinaryFormat -> True];     data = BinaryReadList[str, {"Real32", "Real32", "Real32", "Real32", "Real32", "Real32", "Real32", "Real32", "Real32", "Integer32", "Integer32"}, ByteOrdering -> +1];      This requires lots and lots of memory and in the end I throw away most of the data most of the time. Usually I am just interested in the 4th real32 and the 2ndint32, or each "row". I would like to read the only the 4th real32 and the 2nd int32 of each "row" if possible and skip over the rest. I've tried to use `Skip` but the documentation isn't clear if it works with `BinaryReadList`. I get the error `Skip::readf: Real32 is not a valid format specification. "`. The documentation doesn't describe that you can skip byte by byte, but you can...               str = OpenRead[name, BinaryFormat -> True];     count = FileByteCount[name]/(11*4);     reading = Table[{Skip[str, Byte, 12];          BinaryRead[str, "Real32", ByteOrdering -> +1],           Skip[str, Byte, 24];          BinaryRead[str, "Integer32", ByteOrdering -> +1]},      {count}]; // AbsoluteTiming      **edit:** This code works now, but it is very slow, about a minute to load a file that takes only 15 seconds with `BinaryReadList`, however, the memory overhead is orders of magnitude lower. **edit2:** `Skip` appears to be very slow, much slower than `SetStreamPosition` for some reason. So I wrote some new code that uses `SetStreamPosition` with a precomputed list of StreamPositions in bytes. It is about twice as fast as the `Skip` version, which is okay, but its still about 3x slower than `BinaryReadList`               pos = Range[12, FileByteCount[name], 11*4];     data = {SetStreamPosition[str, #];            BinaryRead[str, "Real32", ByteOrdering -> +1],            SetStreamPosition[str, # + 28];            BinaryRead[str, "Integer32", ByteOrdering -> +1]} & /@ pos; // AbsoluteTiming      Hopefully, someone will have an idea how this can be improved. Memory usage is still low, as expected. I'm willing to tolerate a slight slow down (maybe 2x but not 5-10x) if there is a considerable memory savings to be gained but it would be great if the process could be sped up as well. I can't really easily provide a copy of my data file as they are 100s of megabytes. I tried to write some code that generates some random data and writes it to a file, however, `BinaryWrite` appears to be extremely slow... I'm on a fast machine with a solid state drive and its going only a few 100 kilobytes per second... Here is the code, regardless, maybe someone knows a faster way to make a random binary data file. This will make an ~40 MB file.               outputstr = OpenWrite["randomdata", BinaryFormat -> True]     reals = RandomReal[100, {10^6, 9}];     ints = RandomInteger[100, {10^6, 2}];     both = Flatten@Transpose@Join[Transpose@reals, Transpose@ints];     BinaryWrite[outputstr, both, {"Real32", "Real32", "Real32", "Real32",        "Real32", "Real32", "Real32", "Real32", "Real32", "Integer32",        "Integer32"}, ByteOrdering -> +1]     Close[outputstr]


title: How to create a notebook that has the form (not function) of the System Information Notebook?

text: _Mathematica's_ system information display (click Help>AboutMathematica>SystemInformation to see it) is nicely packaged. Is it just a notebook with a TabView and other controls in a notebook with options set to size it just larger than the controls? Does it take any special tricks to keep the functions hidden and make it work the way it does? This occured to me after having asked the base question, which was really about interface mechanisms. Couldn't System Information be written as a CDF? (I realize these are two unrelated questions)


title: Generating lots of Examples in Polynomials Rings

text: I'm studying polynomial rings and i would like to know some tricks for generating lots of examples. For instance, suppose i'm interested in polynomials over the integers mod (2,x^3 + 1). To get a feel for the structure i would like to expand a bunch of random polynomials and see what happens. I would like to do this without typing each individually. Any suggestions? Thank you!


title: Can't run 2 CDF documents at a time on a Windows computer

text: I've rolled out a few CDF's to end users. See earlier posts: suppress message and which player platform. Now, an end user reports that they can't open more than one CDF document at a time. The player just switches documents instead of showing a second window. I use a iMac and I can run two CDF documents at a time side by side without any problem. This might not deliver the most objective test because I do have a full version of Mathematica running on the machine, which could affect how may CDF documents one can run at one time. The end user runs a Windows machine. Has anyone else run up against this? Does anyone know of a work around? * * * Some additional information: My end user runs Windows 7 professional version 6.1.


title: Setting a lower limit on calculation time

text: Sometimes it can come in handy to set a lower limit for a calculation. Consider for example an animation that is generated by some infinite loop, which would run way too fast to display properly for the user. For this reason, I need a function of the type "pause at least". It would be like a little brother of `TimeConstrained`. _I threw together the following small code which seems to do the trick, but I'm wondering whether there is a more efficient or elegant solution for this?_ Here's my version if you're interested, it's pretty straightforward:               pauseAtLeast[calculation_, pause_] :=         Block[{start, result},             start = AbsoluteTime[];             result = calculation;             If[AbsoluteTime[] < start + pause,                 Pause[start + pause - AbsoluteTime[]]             ];             result         ]     SetAttributes[pauseAtLeast, HoldFirst];      Usage:               (* Pauses 2 seconds *)     AbsoluteTiming@pauseAtLeast[Pause[2], 1]     (* Pauses 1 second *)     AbsoluteTiming@pauseAtLeast[Pause[.5], 1]


title: Size distribution of nanoparticles from a transmission electron microscopic image

text: I have found a research article about Martian sand grain size determination from the image using Mathematica (Figure 2 in the linked article). They have not provided any detail of the methodology. It could have many applications in biology specially in the microscopy. May be it is simple, but I have no idea how to do it. Any help would be much appreciated. I have enclosed an image of gold nanoparticles here. There's a reference size bar at the bottom right of the image. ![Gold nanoparticles](http://i.stack.imgur.com/udW8X.jpg)


title: Matrix substitution

text: I'm newbie in Mathematica and would like to ask one simple question. Let's say I have matrix with some elements == -1               mm = ConstantArray[0, {10, 10}];      mm[[4, 4]] = -1;      mm[[7, 7]] = -1;      ...      Now I want to find all occurrences of -1 and set all neighbor cells around them to some values.               pos = Position[mm, -1] (* Positions are kept here *)      Now I want to surround these found positions by some values :               r1 = {{a1, a2, a3}, {a4, a5, a6}, {a7, a8, a9}};     r2 = {{b1, b2, b3}, {b4, b5, b6}, {b7, b8, b9}};     ....     rr = {r1, r2, ....};      Only way I could make to work is following cycle :               For[i = 1, i <= Length[pos], i++,       mm[[(pos[[i,1]]-1);;(pos[[i,1]]+1), (pos[[i,2]]-1);;(pos[[i,2]]+1)]] = rr[[i]];     ]      But it looks really ugly and I suspect would be more slow if I need to do it for bigger number of positions. Could anyone point me to solution in more functional style ? I played a bit with ReplacePart but couldn't get it working.


title: Geometric Transformation not working - degenerate points?

text: I've successfully used `FindGeometricTransformation` to project the simplex triangle onto the x-y plane:               {error, xf} =        FindGeometricTransform[          {{0, 0, 0}, {1, 0, 0}, {1, Tan[Pi/3], 0}/2},           {{0, 0, 1}, {1, 0, 0}, {0, 1, 0}}];      When I try a simple extension of this to one higher dimension, it fails to compute the transformation.               {error, xf} =        FindGeometricTransform[          {{0, 0, 0, 0}, {1, 0, 0, 0}, {1, Tan[Pi/3], 0, 0}/2, {1/2, Tan[Pi/3]/4, Sqrt[2/3], 0}},           {{0, 0, 1, 0}, {1, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, 0, 1}}];      I get the error "FindGeometricTransform::insufficientPts: Need at least 2 non- degenerate pairs of points for Automatic transformation estimation." Any advice?


title: NDSolve two PDE plus one ODE, together

text: I have a couple of PDE (time and space/length) that are correctly managed by NDSolve, but to which I’m adding an ODE on which the `acc` “accumulates”, through time, a “value” coming from one of the boundaries of the PDE (the `b*h[t, le]*u[t, le]`). On my following example, the accumulation is not linked, and so `acc` could be calculated afterwards. But the purpose is to use the `acc[t]` value as a definition of one of the boundary of `h`. Once the errors are gone, I'll define something like `h[t, le]==acc/100` instead of the current fixed value boundary. I’ve tried a lot of assorted stuff, but NDSolve keeps giving errors on the amount of parameters of the ODE, etc, as shown below. I’m now thinking on managing the “accumulation” with the `EvaluationMonitoring`, but it doesn’t sound right...               a = 10;     le = 62;     g = 9.8;     tf = 100;     b = 3.4;     r = 5.86/le;     NDSolve[{        b*u[t, x]*Derivative[0, 1][h][t, x] +           b*h[t, x]*Derivative[0, 1][u][t, x] +           b*Derivative[1, 0][h][t, x] == r,             (r*u[t, x])/(b*g*h[t, x]) + (Abs[u[t, x]]*(b + 2*h[t, x])^(4/3)*             u[t, x])/(a^2*(b*h[t, x])^(4/3)) +           Derivative[0, 1][h][t, x] + (u[t, x]*Derivative[0, 1][u][t, x])/           g + Derivative[1, 0][u][t, x]/g == 0,             Derivative[1][acc][t] == b*h[t, le]*u[t, le],             h[0, x] == 1,        u[0, x] == 0,        h[t, le] == 1,        u[t, 0] == 0,        acc[0] == 0        },       {u, h, acc},       {t, 0, tf}, {x, 0, le}       ];            (*NDSolve::ndode: Input is not an ordinary differential equation. >>*)      **EDIT** I came across a problem with the naming of the variable `acc`. But since it is probably related with a different question, I wrote my problem here


title: Opening cdf file from command line with arguments on windows

text: I want to write a cdf file to read in the commmand line arguments and then do something with them. Something like this:               Mathematica.exe 'filename.cdf' arguments      Then from inside the cdf call `$CommandLine` or something and then get those arguments. Just wondering if this is possible.


title: professionalize/optimize my code that calls a function

text: I have the following construction, which defines a function that I subsequently call in a loop multiple times. I use this very often, but I have never looked into if there is a more professional way to do it in Mathematica. I would be happy to get feedback on my following MWE               g[x_] := Log[x] + 1000;          f[a_, x_, c_] := {        temp = 4*a*c + g[a] // N;        a + temp};          data = {};     For[i = 1, i < 10, i++,      data = Append[data, {i, f[i, 1, 1][[1]]}]]      EDIT: The inner part of the function `f` is not important, it could be anything.


title: How to make the default table alignment "right"

text: The default table alignment is `Center`, however I would like to make it `Right` so that `MatrixForm` by default returns a matrix with right-aligned entries. I have played around with the options inspector setting the option `Alignment(TableViewBoxOptions)` to `{Right, Bottom}`, ![enter image description here](http://i.stack.imgur.com/IBNKf.png) but it does not seem to produce any effect. Also, I noticed a button `Apply` in the options Inspector window, which is greyed and inactive??


title: How to remove unwanted regions in a three-dimensional surface

text: As the title indicates, I want to delete some unwanted regions in a three- dimensional surface created using `ContourPlot3D`. Here is the corresponding code               Clear["Global`*"];          V = 1/2*(x^2 + y^2 + z^2) + (x^2*y^2 + x^2*z^2 + y^2*z^2 - x^2*y^2*z^2);          E0 = 7;          S0 = ContourPlot3D[V == E0, {x, -4, 4}, {y, -4, 4}, {z, -4, 4},      PlotPoints -> 70, PerformanceGoal -> "Speed", Mesh -> None,      ContourStyle -> Directive[Green, Opacity[0.3], Specularity[White, 30]],      ImageSize -> 550]      which produces this output: ![enter image description here](http://i.stack.imgur.com/8icXX.jpg) I want somehow to keep the inside closed 3D surface (which looks like a 3D star) and delete the eight open parts which surround it. I tried several combinations using `RegionPlot3D` but the particular range of $x$, $y$ and $z$ prevent me from obtaining what I want. Any suggestions? **EDIT** If you increase the value of E0 then after a certain value the three- dimensional surface opens and eight channels of escapes (holes) appear. Using this code               Clear["Global`*"];          V = 1/2*(x^2 + y^2 + z^2) + (x^2*y^2 + x^2*z^2 + y^2*z^2 - x^2*y^2*z^2);          E0 = 8.5;     R0 = 6;          S0 = ContourPlot3D[V == E0, {x, -5, 5}, {y, -5, 5}, {z, -5, 5},      PlotPoints -> 100, PerformanceGoal -> "Speed", Mesh -> None,      ContourStyle -> Directive[Green, Opacity[0.3], Specularity[White, 30]],      ImageSize -> 550, RegionFunction -> Function[{x, y, z}, Sqrt@(x^2*y^2 +      x^2*z^2 + y^2*z^2) <= R0]]      you get this output ![enter image description here](http://i.stack.imgur.com/dxzwf.jpg) OK, my question is the following: How can I draw the surface and manipulate the openings at the minimum width. Let me be more specific. Now, using the current code the size of the openings is controlled by the cutoff surface and the particular value of $R0$. If for example, I use $R0 = 2.5$ then I loose essential parts of the surface. ![enter image description here](http://i.stack.imgur.com/ovkJG.jpg) What I want is to define such a cutoff surface or find the specific value of $R0$ so that the external cutoff surface to abut exactly against the inner surface thus, drawing the openings at their minimum width. Any suggestions?


title: WhenEvent method with 3 conditions

text: I am trying to solve system of differential equations below $$x''(t)=-2.25cos(1.5t)-x(t)-x'(t)$$ $$y''(t)=-1.125cos(1.5t)-4y(t)-y'(t)$$ $$z'(t)=\begin{cases}x(t)-(1+y(t)), & \text{if } x>(1+y) \\\ \\\ 0, & \text{if } |x|<(1+y) \\\ \\\ x(t)+(1+y(t)), & \text{if } x<-(1+y) \end{cases} $$ I can solve the equations for $x$ and $y$, but I have no idea how to implement WhenEvent Method to solve for $z$. Notice that there are 3 conditions for $z$. EDIT 11/14: I tried code below               sol1 = First@NDSolve[{x''[t] == -2.25 Cos[1.5 t] - x[t] - x'[t],      x[0] == 0, x'[0] == 0}, x, {t, 0, 30}]     sol2 = First@NDSolve[{y''[t] == -1.125 Cos[1.5 t] - 4 y[t] - y'[t],      y[0] == 0, y'[0] == 0}, y, {t, 0, 30}]          sol3 = NDSolve[z'[t] == a[t], z[0] = 0,      WhenEvent[Evaluate[x[t] /. sol1] > 1 + Evaluate[y[t] /. sol2],       a[t] -> Evaluate[x[t] /. sol1 - (1 + Evaluate[y[t] /. sol2])]],      WhenEvent[Abs[Evaluate[x[t] /. sol1]] < 1 + Evaluate[y[t] /. sol2],       a[t] -> 0],      WhenEvent[Evaluate[x[t] /. sol1] < -(1 + Evaluate[y[t] /. sol2]),       a[t] -> Evaluate[x[t] /. sol1] + (1 + Evaluate[y[t] /. sol2])],      z, {t, 0, 30}]          Plot[Evaluate[x[t] /. sol1], {t, 0, 10}, PlotRange -> All]     Plot[Evaluate[y[t] /. sol2], {t, 0, 10}, PlotRange -> All]     Plot[Evaluate[z[t] /. sol3], {t, 0, 10}, PlotRange -> All]      But it returns many errors I don't understand.   What is the proper way to solve this problem?


title: Impose the color for one discrete value above a color predefined gradient

text: If I plot an array with option ColorFunction -> "Rainbow" :               a = {{0, 1, 5, 3, 0.5, 0, 0, 2, 12, 0.50, 3, 7, 2, 0.2}};     ArrayPlot[a, PlotLegends -> Automatic, ColorFunction -> "Rainbow"]      ![enter image description here](http://i.stack.imgur.com/mfzND.png) but want the points with value = 0 (and only points with value = 0) to appear white (they are missing values) instead of purple, how should I do that? Can I specify a color for discrete points to override what ColorFunction -> "Rainbow" does?


title: Replace all elements of a list

text: I have a set that looks like:               s = {{1, 2, 3} -> 9, {4, 1, 9} -> 9, {3, 7, 3} -> 1};      Now, I want to replace each element of the set by the lhs of "`->`". The result should look like this:               s = {{1, 2, 3}, {4, 1, 9}, {3, 7, 3}};      ## The problem: I only want to **modify** the list `s` **without creating a new list**. This is why `Replace[]` and `Map[]` cannot be used in this scenario. Thank you in advance!


title: Is it possible to Clear all variables (but not functions)?

text: I have written a Mathematica script in which I define functions and variables. Here is a **_vastly_** simplified example:               myFunA[int_Integer] := int + 1     myFunB[int_Integer] := int * 2     myFunC[int_Integer] := int - 3          myVarA = 1;     myVarB = 2;     myVarC = 3;      (In my actual script, the function and variable names vary; they do _not_ follow the form `myFunX`, `myVarX`, etc.) I would like to `Clear` (or otherwise delete) _all_ of the _variables_ (`myVarA`, `myVarB`, `myVarC`) but **not** the functions (`myFunA`, `myFunB`, `myFunC`). Is this possible (without explicitly `Clear`ing each of the many variables, since my actual script defines several dozen variables)? Thank you for your time.


title: Solar system simulation (n-body physics) with OpenCL

text: I would like to simulate a n-body solar system in Mathematica. I have found the following example: http://www.wolfram.com/mathematica/new-in-8/cuda-and- opencl-support/simulate-thousands-of-particles-in-real-time.html [1] I have simplified the code from this example to create a minimal system with one "star" and one "planet". I plan to expand the solar system later with more bodies. My code is:               Needs["OpenCLLink`"]     OpenCLQ[]          srcf = FileNameJoin[{$OpenCLLinkPath, "SupportFiles", "NBody.cl"}]          NBody = OpenCLFunctionLoad[{srcf},      "nbody_sim", {{"Float", _, "Input"}, {"Float", _, "Input"}, _Integer, "Float",      "Float", {"Local", "Float"}, {"Float", _, "Output"}, {"Float", _, "Output"}}, 256]      Note that I have changed all references to `"Float4"` from the example to `"Float"`, because otherwise Mathematica would complain with errors.               numParticles = 2;     deltaT = 0.01;     epsSqrt = 1.0;     pos = OpenCLMemoryLoad[{{0.,0.,0.,100.},{1.,0.,0.,1.}}, "Float"];     vel = OpenCLMemoryLoad[{{0.,0.,0.,0.},{0.,0.,0.,0.}}, "Float"];     newPos = OpenCLMemoryAllocate["Float", {numParticles, 4}];     newVel = OpenCLMemoryAllocate["Float", {numParticles, 4}];      There are several possible issues with the last block of code. First, I don't know what is the `epsSqrt` parameter, I leave it the same as it is in the example code. Second, the bodies' initial positions are stored in the `pos` variable. I _assume_ from reading the code of `NBody.cl` found ~~here~~ ***** that the specification for each body should be `{positionX,positionY,positionZ,mass}`, but I could be wrong. Third, the velocity vectors are stored in the `vel` variable. Here the first three components are `{velocityX,velocityY,velocityZ}`, but I do not know what is the fourth component. If I simulate my simple system with               Graphics3D[{     AbsolutePointSize[20],     Point[Dynamic[Refresh[      NBody[pos, vel, numParticles, deltaT, epsSqrt, 256*4, newPos, newVel, numParticles];      NBody[newPos, newVel, numParticles, deltaT, epsSqrt, 256*4, pos, vel, numParticles];      Take[#, 3] & /@ OpenCLMemoryGet[pos],      UpdateInterval -> 0]]]     },     Boxed -> True, RotationAction -> "Clip", PlotRange -> All     ]      the two bodies just stay where they are. Because they have no initial velocities, they should attract eachother (the heavier body should pull the lighter body towards itself basically), but this does not happen. How can I fix the code to simulate proper forces in a solar system? * * * * **Edit:** The file provided from the link is not the same that Mathematica uses. The location of the internal `NBody.cl` file is `"/Applications/Mathematica.app/SystemFiles/Links/OpenCLLink/SupportFiles/NBody.cl"`. I am not sure if the source is available online. * * * **Update** I have found this article [2] that explains how the `NBody.cl` program works in general, and an actual implementation. I have also read the Mathematica documentation page `OpenCLFunctionLoad`. From these two sites I obtained the following information:   * The proper data type in [1] should be `"Float[4]"` instead of `"Float4"` (and not "`Float`", which I used first).   * `epsSqrt` is "the minimum interaction distance (squared) between particles." If two particles are closer than this, the simulation will not compute the interaction between them.   * The fourth parameter in the `pos` variable is indeed the particle's mass.   * The fourth parameter in the `vel` variable is not used and can be set to any value. I have gone through the Mathematica's internal `NBody.cl` file line-by-line comparing the code with the one provided in [2] and I have found no reason for the program to not work as it should. I have also written the code to solve the N-body system the "normal" way and it works as it should, however it's too slow to use for longer simulations with more bodies than just two in my minimal example here. I believe I have done everything I can to identify the cause of my problem but I have not be able to find a solution yet.


title: Merging two held expressions into a held compound expression

text: Consider               e1 = Hold[a = x + x; b = y + y + y];     e2 = Hold[c = a + a + b + b + b; c^2];      How can I obtain the following?               e12 = Hold[a = x + x; b = y + y + y; c = a + a + b + b + b; c^2]      For example,               e1 ~Join~ e2       does not work since it gives one "," sign in the middle. another attempt               With[{e1temp = e1, e2temp = e2}, Hold[e1temp; e2temp]]      gives nested `Hold` calls that at the end do not want to evaluate (and are hard to get rid off): > >     Hold[Hold[a = x + x; b = y + y + y]; Hold[c = a + a + b + b + b; c^2]]] >   I am amazed that such a simple thing is causing me so much pain. :) ### Edit My current solution.               merge[Hold[expr1_], Hold[expr2_]] := Hold[expr1; expr2]     merge[e1, e2]      > >     Hold[(a = x + x; b = y + y + y); (c = a + a + b + b + b; c^2)] >


title: Saving a source file adds (* ::Package:: *) to the first line

text: I am running Mathematica 9 on a linux machine and I've encountered the following behaviour that I am trying to understand. When I'm editing multiple source (.m) files using mathematica saving adds a new line which reads (* ::Package:: *) at the start of the file. This interferes with the shebang line that designates a source file as an executable and prevents scripts from working. I then fix this problem by closing all source files in mathematica and manually removing the line in a text editor - so this is more of an annoyance than an actual problem. Does anyone know how the line addition can be prevented? Thanks!


title: Plotting error table in 3D

text: I have an error table which includes three parameters(error, epsilon and step size) and the matrix is not square. Now, I want to plot my data in 3D, but didn't manage to do it. My table is as follows ![enter image description here](http://i.stack.imgur.com/eYHN7.png) or               ϵ = {2^-4, 2^-5, 2^-6, 2^-7, 2^-8, 2^-9};     step = {2^-6, 2^-7, 2^-8, 2^-9};     error = {{9.06*10^9, 5.68*10^10, 3.55*10^11, 2.21*10^12}}      Any ideas how to tackle the problem ?


title: Can Mathematica Operators be combined in a linear fashion for readability?

text: Here's a simple example. Suppose we want to find the off-diagonal matrix of m:               m={{1,2},{3,4}}      This can be solved fairly simply by extracting a list of the diagonal elements, re-creating the diagonal matrix from these, and removing them from the full matrix to get the off-diagonal elements:               m - DiagonalMatrix[Diagonal[m]]        to get               {{0,2},{3,0}}      Now, this was a fairly simple solution to the given problem, but what I'm wondering is if there is a way to write something akin to               (Identity - DiagonalMatrix@Diagonal)[m]        To get the same result. In this simple example, not much would be gained by doing this, but I just thought it could be interesting in more complicated problems and help make the code resemble more closely the underlying mathematics in some cases.


title: Export an image at 1000 dpi

text: I'm trying to export an image at 1000 dpi. The author guide of a lot of papers wants this resolution! Then I must to import this image in Word in a small box; let's say 7x4 cm. This is the code that I made and the relative image:               grayColorList = (Blend[{Black, White}, #] & /@ Range[0, 1, 0.1]);     histogram =      Labeled[Histogram[{dataBr[[All, 1]], datacl[[All, 1]],      dataFCl[[All, 1]], dataF[[All, 1]]}, ChartLayout -> "Stacked",      ChartLegends -> {"Br-derivatives", "Cl-derivatives",       "F+Cl+Br-derivatives", "F-derivatives"},      ChartStyle -> {grayColorList[[1]], grayColorList[[4]],       grayColorList[[7]], grayColorList[[9]]}], {Rotate[     Style["Relative Frequency", 12], 90 Degree],      "\!\(\*SubscriptBox[\(\[Lambda]\), \(Exp\)]\)"}, {Left, Bottom},      FrameMargins -> {{-8, 0}, {0, 0}}]       ![Image1](http://i.stack.imgur.com/CMTIf.png) This is a very nice image, but when I try to Export it               Export["Histogram.Tif", histogram, ImageResolution -> 1000]      This is the result: ![enter image description here](http://i.stack.imgur.com/U24A2.png) And this is very ugly image! I've read the other similar posts but I can't find the answer. Thanks in advance.


title: How can we extend the predictive interface so it can suggest new operations?

text: ### Introduction Mathematica 9 has introduced a new predictive interface. For each output, it suggest possible actions the user might want to take. ![The predictive interface at work](http://i.stack.imgur.com/NUmoV.png) **How can this interface be extended so that it will suggest additional, possibly user-defined, actions?** * * * ### The starting point @Rojo mentioned in chat that he discovered that much of the functionality is contained in the `Predictions`` and `PredictiveInterface`` contexts. Many of the symbols have usage messages (but make sure that you trigger loading them by using the predictive interface at least once). The `Predictions`PredictionRule` symbol seems to contain the rules on which the predictions are based, as downvalues (see its usage message). The functionality seems to be defined in files found in the `$InstallationDirectory/AddOns/Applications/PredictiveInterface/` directory. The relevant part is in `.mx` files (not directly readable) and comments in the `.m` files suggest that these may be updated automatically. I posted this question as a starting point for people who want to figure out how this works, and to facilitate collaboration.


title: Unit issues in Mathematica 9

text: I posted the following on the Google+ group `comp.soft-sys.math.mathematica` and had no luck with responses. I've done a Google search and, to the best of my ability, used the documentation center. The post I made was as follows: > I continue to receive "Unable to interpret unit specification m/s" (for > example, but almost anything I attempt returns this message) with input: > UnitConvert[55 mi/h,"m/s"] or UnitConvert[55 mi/h,m/s] or any other > combination of quotes, omitted quotes, etc. Even the prediction/suggestion > box, when I execute Quantity[55,"mi/hour"}, after it returns 55 mi/h, if I > type in any combination of m/s, "m"/"s", "m/s", etc. into the box that opens > when I select "Convert" in the prediction box yields the same "unable to > interpret unit specification. What am I missing? (As you may gather, I'm a _Mathematica_ novice.)


title: Why does memory run out when adding same-sized matrices in a loop?

text: I have written a module that it generates a 101x101x51 zero matrix at first. At every iteration, it generates a list by funct1 and based on this list, if list is empty it gives the previous result. If list is non-empty, it applies funct2 and get the same-sized matrix and add it to the previous one. funct2 uses BinCounts so it generates a matrix with scalar values in it.. The piece of code is :               resultfunction[minx_, miny_, minz_, maxx_, maxy_, maxz_] := Module[{points, i, j, k},     mtrx = Table[0, {101}, {101}, {51}];     Do[points = funct1[i, j, k];     If[points === Null, mtrx, mtrx = mtrx + funct2[0.2, points](*0.2 is a coefficient*)],     {i, minx, maxx}, {j, miny, maxy}, {k, minz, maxz}];     points =.;     mtrx]      The problem is that I am using a device with 32gb RAM, however it runs out of memory when I ran this module. I thought because of the fact that maybe it can be storing the points, at every iteration, I cleared up the points. However, the result is the same. When adding matrices, don't they use the same memory? p.s. minx=miny=minz=1; maxx= 85, maxy=80, maxz=50 Any help is appreciated. **EDIT** funct1 is too long to write it here and it just return Null or a list whose dimensions are {length of the list,3}. funct2 is :               funct2[coefficient_, points_] :=      Block[{bsplinefunct, sampledpoints, results},     bsplinefunct = BSplineFunction@points;     sampledpoints = Thread[bsplinefunct[Range[0, 1, .0001]]];      results = funct3[20, 20, 5, 40, 40, 15, coefficient, {sampledpoints}];     {bsplinefunct, sampledpoints} =.;     results]      funct3 is :               funct3[minx_, miny_, minz_, maxx_, maxy_, maxz_, step_, points_] :=      Module[{matrix},      matrix = Total[Unitize[BinCounts[#, {minx, maxx + step, step}, {miny, maxy + step,           step}, {minz, maxz + step, step}]] & /@ points]]


title: Help in coding of differential equations

text: I need some help with _Mathematica_. How can I do the following? Starting with `f = y[0]^2` (`y[0]` is basically y with 0 subscript) and `f' = 2*y[0]*y'[0]` (Derivative of f), I want to replace `y'[0]` with `y[1]` (again 1 is a subscript), so it becomes `f' = 2*y[0]*y[1]`. Then I want to find `f'', f'''`, and so on.


title: Plotting data in a weird format

text: I have a lot of data on the following form:               data = {{param1,param2,param3,param4,{{x1,y1},{x2,y2},...,{xn,yn}}},...}      The first variables in each sublist are parameters which were used to generate the data and for each there are only finitely many, i.e. `param1` is in the set `{1,2,3,4}` and `param2` in the set `{0,0.25,0.5}`. Each possible param sequence is guaranteed to appear exactly once. Now I would like to create all plots where a couple (or arbitrarily many) of the parameters are fixed but the other ones can vary. For example, one plot would have `param1` to be `1` and `param2` to be `0.5` then the corresponding `Plot` would vary `param3` and `param4` over their possible values. Is it possible to do this with relatively little code? Edit: Here is some data if you want to practice:               data = {{0.05,0.25,2,0.05,{{10,1.81095078464},{20,4.67233914533},{30,7.08803699724},{40,12.2604831338},{50,4.4765112617},{60,30.4472408052},{70,13.9643317682},{80,41.2579927871},{90,11.960557746}}}     ,{0.05,0.25,2,0.1,{{10,2.43799671091},{20,6.61987906477},{30,0.0668059190229},{40,2.7061070004},{50,18.8102895497},{60,24.4730064793},{70,20.2747124961},{80,74.8539284102},{90,47.2172814344}}}     ,{0.05,0.25,2,0.15,{{10,2.67074811192},{20,15.9521439491},{30,3.54972604159},{40,13.1682228406},{50,23.6066621641},{60,12.4390170784},{70,46.0070233365},{80,38.0116375085},{90,12.0705695205}}}     ,{0.05,0.25,3,0.05,{{10,3.1269953325},{20,15.6996942029},{30,24.1145670018},{40,36.0334138554},{50,41.1150906489},{60,31.4063841784},{70,34.4001494185},{80,9.52491909762},{90,15.5320891272}}}     ,{0.05,0.25,3,0.1,{{10,9.6198670177},{20,1.68271939508},{30,14.4069805301},{40,32.0147092546},{50,26.7042711284},{60,47.7967863197},{70,46.7059123396},{80,57.809041849},{90,84.4256784391}}}     ,{0.05,0.25,3,0.15,{{10,3.62785141167},{20,7.48741493046},{30,2.08245578621},{40,36.2518798094},{50,20.0541864045},{60,38.5706584591},{70,42.2491352509},{80,33.8688792853},{90,12.5218627351}}}     ,{0.05,0.25,4,0.05,{{10,6.113253503},{20,3.34466308592},{30,22.8994502487},{40,27.8256812834},{50,42.3128480576},{60,11.8814975842},{70,23.6489403538},{80,67.2170848449},{90,64.7381753617}}}     ,{0.05,0.25,4,0.1,{{10,6.63675406908},{20,14.2655858882},{30,2.16789822064},{40,34.6305949789},{50,31.7812530609},{60,45.0207978304},{70,29.9999048737},{80,66.9741618718},{90,55.0452401763}}}     ,{0.05,0.25,4,0.15,{{10,6.90255549999},{20,3.9885321713},{30,26.7487549741},{40,17.9087260172},{50,15.897872199},{60,9.29221539717},{70,59.9905412021},{80,51.2029208226},{90,43.2240798207}}}     ,{0.05,0.25,5,0.05,{{10,2.03521621274},{20,10.6802820552},{30,22.7668370169},{40,17.4842532703},{50,33.8885022742},{60,53.1974918374},{70,60.2751976503},{80,40.7192672242},{90,83.5475720189}}}     ,{0.05,0.25,5,0.1,{{10,7.67431501913},{20,1.95859099835},{30,23.3519464193},{40,13.8993657827},{50,31.6415181272},{60,23.1976359038},{70,35.0005300883},{80,17.0312839157},{90,57.0400103646}}}     ,{0.05,0.25,5,0.15,{{10,5.06555796312},{20,10.9204321376},{30,21.8069692381},{40,19.5772020736},{50,11.3270822542},{60,4.81298507075},{70,59.7538646808},{80,66.1476668838},{90,73.1291546231}}}     ,{0.05,0.5,2,0.05,{{10,4.64402575054},{20,11.0700265682},{30,13.5807209068},{40,17.4950974568},{50,10.358793839},{60,15.8021221186},{70,63.1214522278},{80,57.8308798847},{90,22.5414408889}}}     ,{0.05,0.5,2,0.1,{{10,4.38798903726},{20,3.70039642682},{30,25.1663321348},{40,5.08534158813},{50,30.2269860186},{60,12.9107480373},{70,10.2495871724},{80,41.7860842547},{90,21.3519476486}}}     ,{0.05,0.5,2,0.15,{{10,6.77220056497},{20,7.38600235623},{30,11.5745943742},{40,30.5829816576},{50,38.589061723},{60,57.6488293351},{70,1.26057229892},{80,5.9267804496},{90,82.6704015928}}}     ,{0.05,0.5,3,0.05,{{10,3.32034254713},{20,10.971486433},{30,0.363147390123},{40,37.65329461},{50,15.949633583},{60,21.8418741365},{70,28.3562497933},{80,71.7087071989},{90,79.5554695131}}}     ,{0.05,0.5,3,0.1,{{10,1.58954955321},{20,3.76237825847},{30,17.5550842398},{40,29.2109934963},{50,6.49252024706},{60,51.8137399056},{70,41.9546186462},{80,24.1401496171},{90,84.1640682329}}}     ,{0.05,0.5,3,0.15,{{10,9.01150441341},{20,10.9523361655},{30,20.6533901253},{40,24.3713540557},{50,8.20484429104},{60,1.16388638136},{70,2.7717770797},{80,36.0311528516},{90,79.6148650441}}}     ,{0.05,0.5,4,0.05,{{10,2.64807693809},{20,17.4186809674},{30,11.0988927114},{40,12.9430380703},{50,20.1267053993},{60,56.2647281546},{70,69.2811052248},{80,27.6645633652},{90,85.1136096421}}}     ,{0.05,0.5,4,0.1,{{10,6.02663873848},{20,2.63294032126},{30,7.74879650203},{40,8.27484945215},{50,5.95510226084},{60,52.6154234102},{70,12.511545849},{80,78.8192910206},{90,12.3488606088}}}     ,{0.05,0.5,4,0.15,{{10,8.25216926779},{20,7.60388967899},{30,1.0533107346},{40,2.21081169594},{50,35.7020132845},{60,57.911449844},{70,17.5890809513},{80,15.1115721942},{90,1.02639298919}}}     ,{0.05,0.5,5,0.05,{{10,8.49277943149},{20,2.51406868421},{30,11.4011785147},{40,39.4308578521},{50,39.8307541943},{60,35.5969342248},{70,62.2928703256},{80,71.5575481117},{90,61.6565219289}}}     ,{0.05,0.5,5,0.1,{{10,3.425448449},{20,10.3597097543},{30,6.19100953018},{40,10.4540143146},{50,23.2857082412},{60,17.3599512427},{70,28.7492345283},{80,35.9268076613},{90,23.5710386153}}}     ,{0.05,0.5,5,0.15,{{10,2.87691906629},{20,15.5942388106},{30,27.7675182329},{40,26.9156263637},{50,30.0860121249},{60,46.5691600184},{70,59.5923947398},{80,13.3664590053},{90,46.9926862072}}}     ,{0.05,0.75,2,0.05,{{10,2.33118591118},{20,0.171302391205},{30,3.8162801126},{40,38.1028271195},{50,15.9557228127},{60,10.9717594589},{70,50.4761540499},{80,34.2194752184},{90,57.3320890909}}}     ,{0.05,0.75,2,0.1,{{10,9.21187915809},{20,15.931228085},{30,13.2347014451},{40,2.09075850626},{50,35.9255672695},{60,33.953217097},{70,16.9449485001},{80,3.7436362842},{90,35.5772239774}}}     ,{0.05,0.75,2,0.15,{{10,0.791065400588},{20,14.0143142872},{30,3.37600328092},{40,22.3812487398},{50,21.1693240081},{60,19.7087594303},{70,68.1887031769},{80,38.0093505188},{90,37.7895850656}}}     ,{0.05,0.75,3,0.05,{{10,9.31810727853},{20,9.76215342921},{30,7.76683101607},{40,35.3384426319},{50,44.4717515812},{60,53.5710585193},{70,45.4840193583},{80,59.5407627578},{90,60.4710222303}}}     ,{0.05,0.75,3,0.1,{{10,2.53659798611},{20,4.70704669175},{30,18.2959346871},{40,35.9224308806},{50,36.5480039338},{60,43.4640708957},{70,7.24722453278},{80,40.943093786},{90,81.9694316569}}}     ,{0.05,0.75,3,0.15,{{10,0.100105878083},{20,15.6660867132},{30,23.5308070875},{40,8.19490108256},{50,6.02445100435},{60,28.6216840496},{70,69.2893512352},{80,3.7744156909},{90,80.9475721672}}}     ,{0.05,0.75,4,0.05,{{10,8.0933835982},{20,18.9656256251},{30,18.4700662413},{40,1.67540094072},{50,12.411938782},{60,1.63616227618},{70,12.593678348},{80,70.6808044911},{90,53.8566296064}}}     ,{0.05,0.75,4,0.1,{{10,3.19835596466},{20,19.0476174241},{30,1.58525644896},{40,4.57246061776},{50,41.0673261923},{60,30.72857255},{70,11.9372932092},{80,76.8378358811},{90,23.608111421}}}     ,{0.05,0.75,4,0.15,{{10,6.6446636599},{20,0.295275665136},{30,11.6826665238},{40,16.6603278505},{50,42.0122936272},{60,51.8210661871},{70,37.1211762546},{80,28.8305779696},{90,15.4410237106}}}     ,{0.05,0.75,5,0.05,{{10,4.44734165144},{20,6.66893577711},{30,3.55054836325},{40,9.4767095531},{50,25.7843768065},{60,24.2743878743},{70,34.2370917884},{80,34.9507738144},{90,83.5111434619}}}     ,{0.05,0.75,5,0.1,{{10,7.84586864359},{20,12.0472863816},{30,27.395358028},{40,7.26350803368},{50,2.6064473865},{60,51.377539089},{70,31.276369458},{80,59.1499919813},{90,31.8353206328}}}     ,{0.05,0.75,5,0.15,{{10,2.20956347811},{20,11.078484084},{30,5.07233531175},{40,38.1356170453},{50,29.6534616181},{60,6.38250659035},{70,62.4726098813},{80,33.6021622135},{90,29.8045456453}}}     ,{0.05,1,2,0.05,{{10,6.77714943938},{20,5.657718189},{30,19.0493303978},{40,39.636743496},{50,34.5096155839},{60,13.9300761353},{70,45.9834142675},{80,4.64884310707},{90,59.6849298315}}}     ,{0.05,1,2,0.1,{{10,3.86505813154},{20,10.0886018939},{30,6.65846439181},{40,26.1224551281},{50,30.9014736954},{60,11.4155036781},{70,33.0291680043},{80,74.6509229773},{90,36.9492872204}}}     ,{0.05,1,2,0.15,{{10,1.99654946557},{20,16.2049557761},{30,26.1363569323},{40,38.7372287427},{50,40.2025346552},{60,39.8858065844},{70,10.3023904166},{80,41.8886418279},{90,70.9094529273}}}     ,{0.05,1,3,0.05,{{10,2.34518030674},{20,12.2556329339},{30,3.05566675163},{40,26.8300477228},{50,30.6367983486},{60,19.4331000773},{70,62.9975381973},{80,73.4322628917},{90,39.1957337766}}}     ,{0.05,1,3,0.1,{{10,7.68796282248},{20,15.9096854918},{30,4.54025818601},{40,7.45388052723},{50,12.457354139},{60,24.3015045943},{70,50.2688106134},{80,36.1148253991},{90,67.9233729094}}}     ,{0.05,1,3,0.15,{{10,4.65218387794},{20,16.8386602868},{30,25.5930142898},{40,7.82172541215},{50,1.29242214896},{60,21.5544155961},{70,31.7440802727},{80,19.2507862987},{90,4.07000801216}}}     ,{0.05,1,4,0.05,{{10,0.69101208094},{20,9.34880796351},{30,7.17856203574},{40,30.112388804},{50,40.8619565867},{60,9.43604345999},{70,69.6804647491},{80,32.8742327742},{90,36.8468278409}}}     ,{0.05,1,4,0.1,{{10,7.52710101478},{20,10.4920352043},{30,15.4111870748},{40,35.6243877241},{50,3.94992669146},{60,49.8266439283},{70,69.5140218785},{80,70.5337864009},{90,85.3876987564}}}     ,{0.05,1,4,0.15,{{10,3.62234353787},{20,14.2397062922},{30,25.1356228484},{40,37.8715362786},{50,23.6113234196},{60,48.1540335361},{70,10.2338938212},{80,34.8127725764},{90,54.6251642429}}}     ,{0.05,1,5,0.05,{{10,3.42309751666},{20,12.8828592654},{30,5.04947596019},{40,37.9218907866},{50,33.1506882433},{60,37.6953472861},{70,5.73178257281},{80,7.03749358685},{90,79.2393944507}}}     ,{0.05,1,5,0.1,{{10,3.77053553619},{20,7.42357221292},{30,19.8494673301},{40,27.7478936358},{50,46.6825595981},{60,12.1764819866},{70,57.2046605066},{80,65.2407822409},{90,33.7164233635}}}     ,{0.05,1,5,0.15,{{10,6.49191956291},{20,5.32890967287},{30,13.1398913983},{40,25.8084558834},{50,44.0679908978},{60,16.0657787413},{70,65.846463301},{80,5.709476188},{90,50.5077277368}}}     ,{0.1,0.25,2,0.05,{{10,8.1805131568},{20,13.3839416884},{30,5.35535429554},{40,31.1637561463},{50,29.2251514633},{60,56.7644536173},{70,28.6419959787},{80,77.7369839641},{90,64.1029710405}}}     ,{0.1,0.25,2,0.1,{{10,4.00140666299},{20,10.8863043703},{30,2.81582596423},{40,27.4965991947},{50,25.0337108129},{60,12.1412568651},{70,21.2241844654},{80,55.4861523882},{90,84.2383928999}}}     ,{0.1,0.25,2,0.15,{{10,6.53764557883},{20,3.1053903961},{30,11.515699156},{40,25.6597655992},{50,44.0127890186},{60,46.0691492929},{70,56.2843023454},{80,43.1056203069},{90,28.4124452184}}}     ,{0.1,0.25,3,0.05,{{10,0.721470639814},{20,14.5078204964},{30,17.2573095333},{40,36.1034897775},{50,40.4045204395},{60,55.1468706076},{70,56.6263585656},{80,51.9798227207},{90,14.6412003494}}}     ,{0.1,0.25,3,0.1,{{10,2.87370884284},{20,4.56253572796},{30,14.6945541145},{40,13.9546874469},{50,7.4818924749},{60,16.5381563607},{70,20.3566470069},{80,38.6153112546},{90,48.0178060833}}}     ,{0.1,0.25,3,0.15,{{10,2.83875203825},{20,15.0609608907},{30,17.5240166232},{40,22.4293300139},{50,21.6102852167},{60,9.15004256886},{70,45.6354523511},{80,69.5680089543},{90,5.71728103804}}}     ,{0.1,0.25,4,0.05,{{10,4.46646009433},{20,5.7320048815},{30,11.4016738341},{40,8.83523265091},{50,16.4847370272},{60,36.8009395286},{70,24.5999040271},{80,14.1650741968},{90,8.02876977497}}}     ,{0.1,0.25,4,0.1,{{10,0.488156430383},{20,9.73307404131},{30,0.597418004153},{40,23.0552672427},{50,16.2087532724},{60,34.43009287},{70,27.3554342695},{80,70.311017112},{90,28.0188921989}}}     ,{0.1,0.25,4,0.15,{{10,5.3461674224},{20,2.91528771185},{30,18.9550685617},{40,17.5601781976},{50,35.342927073},{60,3.18860635682},{70,52.5782031356},{80,11.2419622939},{90,79.0487883136}}}     ,{0.1,0.25,5,0.05,{{10,3.24319494011},{20,9.20282886188},{30,15.2186717481},{40,23.3891524884},{50,36.1335727272},{60,38.6728479249},{70,41.9240629723},{80,22.7397645521},{90,9.30747274433}}}     ,{0.1,0.25,5,0.1,{{10,7.59497995474},{20,0.405926294602},{30,11.8418092773},{40,34.5152511797},{50,33.1815145209},{60,18.2661886311},{70,25.4418955824},{80,31.9778916064},{90,73.9786748628}}}     ,{0.1,0.25,5,0.15,{{10,6.12961088543},{20,19.9331364341},{30,18.2545077545},{40,15.1198651774},{50,26.0912471551},{60,35.1203226514},{70,12.2285551291},{80,72.1932144614},{90,53.0386701391}}}     ,{0.1,0.5,2,0.05,{{10,7.59488953517},{20,11.2978335861},{30,22.5064570351},{40,2.35265743589},{50,0.908253825134},{60,56.5655545397},{70,27.0860153547},{80,78.0129191571},{90,49.7715169565}}}     ,{0.1,0.5,2,0.1,{{10,1.43860542157},{20,16.0605769084},{30,4.63441645706},{40,21.4207950368},{50,7.68008769367},{60,34.8078464101},{70,26.8410066037},{80,31.5708973783},{90,32.8848746975}}}     ,{0.1,0.5,2,0.15,{{10,8.39514333251},{20,10.0341828507},{30,9.38010187697},{40,34.4526749456},{50,5.80913020794},{60,51.8092369073},{70,49.3295337536},{80,55.6237692935},{90,61.8200747267}}}     ,{0.1,0.5,3,0.05,{{10,9.38641922534},{20,17.9040760206},{30,0.25707206566},{40,34.093764649},{50,34.5677933731},{60,19.2397646578},{70,33.2670768537},{80,47.890923252},{90,34.3797445311}}}     ,{0.1,0.5,3,0.1,{{10,4.00465844105},{20,15.5385282854},{30,18.6173588469},{40,22.6123989951},{50,1.62301944438},{60,18.1239726264},{70,17.3044858704},{80,22.0666086744},{90,11.5168991949}}}     ,{0.1,0.5,3,0.15,{{10,2.56845586386},{20,13.0816651606},{30,17.8228500021},{40,37.6102328305},{50,8.51102447018},{60,7.89016813299},{70,41.0452165717},{80,58.5787413693},{90,18.2308463676}}}     ,{0.1,0.5,4,0.05,{{10,2.49727084491},{20,3.56416194578},{30,6.27724685884},{40,6.72849195117},{50,43.2802722534},{60,26.4631951187},{70,10.1557053085},{80,11.5753957119},{90,59.7621806738}}}     ,{0.1,0.5,4,0.1,{{10,7.60259722645},{20,6.0118465907},{30,28.0628724627},{40,31.3206046138},{50,21.9790486839},{60,16.6828749185},{70,58.8901143246},{80,64.3715017101},{90,6.40250308925}}}     ,{0.1,0.5,4,0.15,{{10,9.37837560535},{20,9.30356878331},{30,5.68459387165},{40,28.3961060974},{50,29.9119490477},{60,33.244421553},{70,43.4853149932},{80,62.8169391547},{90,35.0986227335}}}     ,{0.1,0.5,5,0.05,{{10,5.46777855196},{20,0.307003624332},{30,5.57189679082},{40,8.58812353128},{50,12.2046576077},{60,25.5712910446},{70,69.7711454398},{80,60.98627112},{90,8.24922668557}}}     ,{0.1,0.5,5,0.1,{{10,0.621904144918},{20,4.84235895254},{30,3.81862601241},{40,21.0939034156},{50,38.4562570489},{60,57.3622032991},{70,34.6407205654},{80,8.55277344038},{90,0.777217632246}}}     ,{0.1,0.5,5,0.15,{{10,5.7173069971},{20,4.10396300275},{30,24.0751334673},{40,6.41106554954},{50,45.6411938905},{60,0.464834918316},{70,65.728589585},{80,32.7945564693},{90,24.0931788427}}}     ,{0.1,0.75,2,0.05,{{10,8.9647599673},{20,13.8216677501},{30,20.6509238656},{40,20.365515982},{50,37.3223482332},{60,24.2570338722},{70,62.0867170638},{80,59.4777900977},{90,72.215984611}}}     ,{0.1,0.75,2,0.1,{{10,8.42005651213},{20,17.4999589292},{30,3.18182290422},{40,31.8665894313},{50,48.8812894167},{60,10.6751908611},{70,46.9148403878},{80,0.417086397777},{90,89.4324954751}}}     ,{0.1,0.75,2,0.15,{{10,6.44725231886},{20,10.9257419595},{30,21.3480009383},{40,11.2193148168},{50,36.2819546524},{60,25.1980712824},{70,56.4458146677},{80,10.108865306},{90,26.3041268147}}}     ,{0.1,0.75,3,0.05,{{10,4.76687201456},{20,2.78989303629},{30,3.67872578585},{40,24.1374000229},{50,3.13458262944},{60,22.2339463736},{70,17.0706266227},{80,0.46493078169},{90,65.959591258}}}     ,{0.1,0.75,3,0.1,{{10,6.50453054541},{20,7.66629452689},{30,2.18985081258},{40,21.4462060735},{50,16.3647659138},{60,38.586050839},{70,11.6351479006},{80,0.84607270655},{90,7.05753337902}}}     ,{0.1,0.75,3,0.15,{{10,4.0610082593},{20,15.1629496968},{30,4.6376315212},{40,15.0197681633},{50,3.42353231587},{60,11.2098760836},{70,59.3599278468},{80,46.2574383148},{90,30.0227121794}}}     ,{0.1,0.75,4,0.05,{{10,6.79334000709},{20,3.64370415789},{30,2.92337375089},{40,3.71977381894},{50,10.2636864607},{60,46.1272101065},{70,25.8935720849},{80,53.4883066026},{90,58.2896223886}}}     ,{0.1,0.75,4,0.1,{{10,1.81625327454},{20,9.1493886242},{30,21.6836267294},{40,38.482437867},{50,46.4318396042},{60,10.765721794},{70,56.0258192172},{80,42.3598501793},{90,74.5022119774}}}     ,{0.1,0.75,4,0.15,{{10,4.91841545877},{20,5.57999390777},{30,17.2716487067},{40,8.32139860991},{50,27.118256565},{60,5.46594819281},{70,47.1932186526},{80,7.43005621694},{90,50.9875832678}}}     ,{0.1,0.75,5,0.05,{{10,4.84480861517},{20,9.89888074325},{30,23.719083084},{40,21.6634899375},{50,6.24732011313},{60,14.7097765113},{70,49.185263844},{80,21.8097321312},{90,5.75514824834}}}     ,{0.1,0.75,5,0.1,{{10,8.72037052137},{20,16.9280326386},{30,19.6704245917},{40,2.2125274622},{50,15.3600385385},{60,10.9563720553},{70,52.0689616958},{80,73.5710362191},{90,26.8088678002}}}     ,{0.1,0.75,5,0.15,{{10,9.95186325046},{20,16.3136582824},{30,11.6979744236},{40,0.390557619389},{50,29.5577821847},{60,34.2375392989},{70,9.22324351563},{80,21.4867656467},{90,82.804390641}}}     ,{0.1,1,2,0.05,{{10,8.01947891818},{20,19.0030754209},{30,29.2534122496},{40,39.6517823844},{50,18.2692954953},{60,23.1307961294},{70,68.2725326916},{80,12.3784992514},{90,71.1986069198}}}     ,{0.1,1,2,0.1,{{10,9.23874572535},{20,4.85901936625},{30,18.0100639081},{40,32.7408384003},{50,47.8114580113},{60,23.6229427755},{70,43.2051735821},{80,52.5047783624},{90,56.6538206218}}}     ,{0.1,1,2,0.15,{{10,2.18668510165},{20,6.47091257525},{30,3.69963204643},{40,28.982935417},{50,42.8761749312},{60,49.1153650022},{70,57.9429307973},{80,11.2986463003},{90,51.7788844007}}}     ,{0.1,1,3,0.05,{{10,6.77783614674},{20,2.81269851199},{30,9.45030617237},{40,33.65108013},{50,10.1677736682},{60,46.9784275808},{70,60.9172862729},{80,70.7104862139},{90,74.9261280021}}}     ,{0.1,1,3,0.1,{{10,4.65720840751},{20,10.1327336666},{30,1.90984732965},{40,32.3275755173},{50,0.435936583222},{60,45.8175975866},{70,47.4533679588},{80,35.9151943427},{90,69.9355750233}}}     ,{0.1,1,3,0.15,{{10,3.14620186579},{20,17.5287557021},{30,4.38044924704},{40,11.2242619732},{50,26.7538648845},{60,19.625339826},{70,26.9681460657},{80,26.551959502},{90,67.3403824536}}}     ,{0.1,1,4,0.05,{{10,2.45905372009},{20,6.80734076308},{30,9.49468578494},{40,2.91440008801},{50,7.43992468803},{60,31.3034293358},{70,58.6334534046},{80,58.3966360905},{90,4.24386984986}}}     ,{0.1,1,4,0.1,{{10,8.70808261833},{20,11.2891542398},{30,1.13024382079},{40,10.8438009489},{50,11.7378548573},{60,3.80709658481},{70,39.4049530881},{80,29.3675429242},{90,88.7765618262}}}     ,{0.1,1,4,0.15,{{10,2.8564967445},{20,2.55970309021},{30,1.82376394264},{40,17.356910227},{50,30.8140739479},{60,2.08020674412},{70,17.6770250168},{80,18.1465135984},{90,44.7002502179}}}     ,{0.1,1,5,0.05,{{10,7.50890691437},{20,1.25860156777},{30,11.413242993},{40,32.2701127332},{50,45.6851952997},{60,32.7826212573},{70,53.6919597832},{80,20.1546284974},{90,56.0546054759}}}     ,{0.1,1,5,0.1,{{10,1.55501998388},{20,13.6101858787},{30,26.3039157732},{40,3.71133073671},{50,2.75002246892},{60,42.4083005206},{70,30.1913313307},{80,79.9464593415},{90,10.8913239805}}}     ,{0.1,1,5,0.15,{{10,8.40347456801},{20,2.71774550648},{30,2.54605906123},{40,9.53561142156},{50,1.33916929469},{60,53.5867377515},{70,7.09177186215},{80,0.0771498793567},{90,70.7764408365}}}     ,{0.15,0.25,2,0.05,{{10,4.68889441753},{20,7.96328611892},{30,4.01655719657},{40,21.4895894832},{50,7.21124318842},{60,16.4955182638},{70,11.2999917365},{80,66.9551195168},{90,14.8138192007}}}     ,{0.15,0.25,2,0.1,{{10,0.517993279265},{20,16.066755246},{30,27.2075729967},{40,16.761246485},{50,31.8746102425},{60,55.129175232},{70,12.0329711581},{80,66.9226678716},{90,4.91759471141}}}     ,{0.15,0.25,2,0.15,{{10,1.60563632198},{20,0.808022096937},{30,9.40626770679},{40,18.732981883},{50,39.7743614053},{60,28.8355704351},{70,1.12319650437},{80,78.7319637689},{90,68.9857589052}}}     ,{0.15,0.25,3,0.05,{{10,2.89225746093},{20,1.97981361428},{30,3.02844548018},{40,33.2608527643},{50,47.0988291149},{60,17.5358894285},{70,50.1779410412},{80,56.1287857996},{90,84.3115488225}}}     ,{0.15,0.25,3,0.1,{{10,3.08374136533},{20,5.36159511848},{30,8.82159447513},{40,31.2989966591},{50,42.6818470719},{60,50.9076958336},{70,67.1340546208},{80,59.2816112466},{90,46.6317583343}}}     ,{0.15,0.25,3,0.15,{{10,5.00073654068},{20,4.86978545236},{30,25.6100602708},{40,26.3444063013},{50,44.2071496109},{60,48.1289504872},{70,28.3840618896},{80,48.5504799168},{90,81.3278959088}}}     ,{0.15,0.25,4,0.05,{{10,0.474552124823},{20,19.1813339281},{30,17.0823033268},{40,13.2763070699},{50,1.52919979435},{60,1.10918913802},{70,30.5900743464},{80,35.3862006585},{90,46.5202909192}}}     ,{0.15,0.25,4,0.1,{{10,0.78502703143},{20,13.8053434159},{30,29.3308235345},{40,31.4326229529},{50,35.879561435},{60,58.6646762952},{70,7.13661589461},{80,51.9184114507},{90,12.9126119593}}}     ,{0.15,0.25,4,0.15,{{10,8.03184355161},{20,14.518902875},{30,6.71186215894},{40,12.4692281207},{50,0.108964620372},{60,50.2138429107},{70,1.0027792354},{80,40.3083820936},{90,43.2726718215}}}     ,{0.15,0.25,5,0.05,{{10,7.9298886513},{20,13.3568866398},{30,0.412442324174},{40,16.1925022486},{50,39.5801568193},{60,48.8022449388},{70,27.5056867849},{80,28.5742908039},{90,19.195436989}}}     ,{0.15,0.25,5,0.1,{{10,3.78046217182},{20,1.73580206043},{30,9.90425096184},{40,27.0857249394},{50,18.6996113057},{60,45.6483527599},{70,35.1159743894},{80,35.018340979},{90,46.3053966847}}}     ,{0.15,0.25,5,0.15,{{10,9.21442775668},{20,15.5372747147},{30,1.55404164102},{40,20.2501331773},{50,11.1655613111},{60,30.6286665029},{70,29.8099455664},{80,21.6683568949},{90,30.2897020349}}}     ,{0.15,0.5,2,0.05,{{10,3.82577122405},{20,4.83654121189},{30,25.9854611943},{40,20.4281707827},{50,13.1519319846},{60,57.5224327887},{70,24.1312539624},{80,51.5561727025},{90,72.0152217532}}}     ,{0.15,0.5,2,0.1,{{10,2.48104504954},{20,1.98813590853},{30,8.89383873614},{40,35.3223984111},{50,12.82167681},{60,31.446273846},{70,47.399755286},{80,16.2191878487},{90,34.3738933555}}}     ,{0.15,0.5,2,0.15,{{10,0.128157214862},{20,17.7527285702},{30,1.85672988998},{40,26.3261710132},{50,35.1002730227},{60,58.6647534766},{70,29.6514416302},{80,46.4906600405},{90,50.7336191388}}}     ,{0.15,0.5,3,0.05,{{10,2.42977873126},{20,11.4065972833},{30,12.2325223357},{40,7.35699143943},{50,8.98633428928},{60,27.278158577},{70,41.2520641615},{80,64.7368128489},{90,35.9381539364}}}     ,{0.15,0.5,3,0.1,{{10,3.36741635439},{20,12.1881082757},{30,8.34373600407},{40,0.160955987188},{50,40.2280085569},{60,13.4140754916},{70,47.2298087306},{80,29.6386177696},{90,6.24083806263}}}     ,{0.15,0.5,3,0.15,{{10,6.55567638439},{20,11.6433140143},{30,18.6784140582},{40,14.4245865566},{50,21.2774363467},{60,15.4403251852},{70,1.10025606097},{80,65.7737507532},{90,0.18892941952}}}     ,{0.15,0.5,4,0.05,{{10,7.05561654667},{20,18.0497589848},{30,8.85720306598},{40,8.54153113697},{50,42.1041293159},{60,38.0016904869},{70,52.5305570507},{80,56.8090754876},{90,6.52293463126}}}     ,{0.15,0.5,4,0.1,{{10,5.51963147088},{20,3.92689462016},{30,27.5315817379},{40,13.2097948115},{50,39.7504488077},{60,27.7090247267},{70,29.9366229863},{80,51.8689863754},{90,22.2191642971}}}     ,{0.15,0.5,4,0.15,{{10,2.09993877734},{20,4.74432715333},{30,20.0197617606},{40,31.9687687764},{50,45.070091919},{60,37.0739879901},{70,69.6953971482},{80,25.4230410921},{90,69.1332083604}}}     ,{0.15,0.5,5,0.05,{{10,1.47174285055},{20,0.903182300914},{30,22.1220288476},{40,18.7759588738},{50,23.5391522581},{60,55.8545061124},{70,20.4774424447},{80,72.7681097854},{90,82.9887709869}}}     ,{0.15,0.5,5,0.1,{{10,5.86860565438},{20,2.69599657409},{30,29.130898613},{40,27.9599492333},{50,44.9737050978},{60,15.2427491707},{70,16.6220571044},{80,42.1749947539},{90,23.0712614935}}}     ,{0.15,0.5,5,0.15,{{10,0.181255727823},{20,11.8249517445},{30,27.3390767274},{40,25.5378567168},{50,30.1660792917},{60,51.1927849339},{70,64.5389332287},{80,17.3648055261},{90,51.0550435759}}}     ,{0.15,0.75,2,0.05,{{10,1.06885241236},{20,19.024021805},{30,25.3517895354},{40,19.4389463896},{50,19.2563846552},{60,50.7368594105},{70,24.4804335591},{80,14.3453511397},{90,69.6454232131}}}     ,{0.15,0.75,2,0.1,{{10,2.25956772721},{20,13.6948578507},{30,17.2831029294},{40,34.1235921555},{50,41.5407995748},{60,33.1412241657},{70,59.6146265448},{80,28.5040782889},{90,40.5776221975}}}     ,{0.15,0.75,2,0.15,{{10,2.53749757344},{20,0.288123921586},{30,4.8243612897},{40,37.0010306043},{50,48.5221744618},{60,42.8174970376},{70,20.4990141686},{80,14.5076126435},{90,36.6346479207}}}     ,{0.15,0.75,3,0.05,{{10,9.73911350399},{20,7.64798812625},{30,3.61925722115},{40,24.4696971313},{50,25.3560632849},{60,9.68113791502},{70,55.6156781645},{80,10.2958863034},{90,3.05286490775}}}     ,{0.15,0.75,3,0.1,{{10,7.56803652019},{20,0.694446136126},{30,7.71591826247},{40,35.7931582866},{50,16.6308566938},{60,52.4850356995},{70,24.0876693109},{80,32.5979522642},{90,84.501528695}}}     ,{0.15,0.75,3,0.15,{{10,2.0362405788},{20,9.83393181455},{30,20.0356757771},{40,3.23956056258},{50,33.1014781473},{60,52.5154980365},{70,48.8534802118},{80,29.9054094687},{90,66.5593126554}}}     ,{0.15,0.75,4,0.05,{{10,0.155988225256},{20,11.7463722756},{30,8.92976020155},{40,29.8324618932},{50,16.4433241006},{60,15.4707798858},{70,3.40300758945},{80,3.72019120104},{90,85.0090836153}}}     ,{0.15,0.75,4,0.1,{{10,1.64927098771},{20,5.82176700112},{30,18.9650314942},{40,35.2757235514},{50,8.23596927942},{60,38.0463345268},{70,39.9998886011},{80,72.0938268453},{90,29.7621199221}}}     ,{0.15,0.75,4,0.15,{{10,0.969717432483},{20,4.34388704053},{30,9.79694553734},{40,33.3790464266},{50,46.6423649711},{60,13.173827153},{70,66.3759510263},{80,38.9904506078},{90,6.81079339087}}}     ,{0.15,0.75,5,0.05,{{10,0.916062192565},{20,0.115210788673},{30,24.1372059981},{40,39.5487412967},{50,12.9795407898},{60,15.9648821689},{70,37.9625631927},{80,31.6042842953},{90,21.8998030479}}}     ,{0.15,0.75,5,0.1,{{10,8.84944732225},{20,5.37532065994},{30,6.79135049092},{40,34.8183261061},{50,17.5822790056},{60,15.0999688535},{70,20.1620061378},{80,28.258599764},{90,54.356428217}}}     ,{0.15,0.75,5,0.15,{{10,4.13626360277},{20,1.81639177357},{30,11.8839838142},{40,11.8583126285},{50,10.2111814619},{60,35.0986063785},{70,49.1595877012},{80,47.6422749245},{90,68.2012368168}}}     ,{0.15,1,2,0.05,{{10,9.14284975319},{20,0.375425289587},{30,5.80761536234},{40,28.4481976307},{50,24.4168967189},{60,33.0510582974},{70,14.1624425245},{80,2.57317188875},{90,3.06360811559}}}     ,{0.15,1,2,0.1,{{10,0.258580591542},{20,8.4096503308},{30,8.42750252343},{40,36.0511175762},{50,31.3343855056},{60,50.6192782387},{70,53.0348152195},{80,2.04981438806},{90,71.8808955257}}}     ,{0.15,1,2,0.15,{{10,1.3262971009},{20,2.60515019012},{30,6.82750375755},{40,29.0500371429},{50,32.4143480639},{60,42.0437825838},{70,53.44893281},{80,45.8846846944},{90,42.7881414325}}}     ,{0.15,1,3,0.05,{{10,1.65546007446},{20,5.10261820825},{30,4.63732861396},{40,13.5971516901},{50,36.1429628731},{60,0.233076617445},{70,44.1208165382},{80,64.3679667518},{90,72.091892827}}}     ,{0.15,1,3,0.1,{{10,0.98815666183},{20,19.5232636183},{30,12.5041815891},{40,4.75761671169},{50,26.3484261076},{60,15.9968755762},{70,4.44527972207},{80,29.5279938082},{90,10.2544330777}}}     ,{0.15,1,3,0.15,{{10,9.28939712014},{20,17.809287196},{30,27.0891241084},{40,5.69167031908},{50,3.44763829902},{60,5.11336121548},{70,15.7136199463},{80,70.0789661685},{90,71.0501428088}}}     ,{0.15,1,4,0.05,{{10,8.28226731203},{20,6.27905234669},{30,10.3315393165},{40,39.8157633198},{50,13.3123799553},{60,54.2748697008},{70,9.80252178201},{80,53.8320752748},{90,34.5381688841}}}     ,{0.15,1,4,0.1,{{10,7.2755725719},{20,13.4831501115},{30,25.9439047268},{40,16.5083359411},{50,25.1219353484},{60,18.473011902},{70,35.7388386812},{80,61.2713787964},{90,11.3514265817}}}     ,{0.15,1,4,0.15,{{10,6.48974410793},{20,8.6305872474},{30,28.8265442339},{40,6.35122734312},{50,27.5400743584},{60,55.4378616788},{70,17.4228271669},{80,15.8173313577},{90,39.0752439155}}}     ,{0.15,1,5,0.05,{{10,3.23268247216},{20,13.7709591465},{30,23.3759406403},{40,22.1332707115},{50,14.3370112262},{60,55.6636959945},{70,65.8277630726},{80,74.9419416526},{90,74.190470498}}}     ,{0.15,1,5,0.1,{{10,6.21455549181},{20,17.0684916775},{30,11.7651442358},{40,32.152138861},{50,17.4576146591},{60,28.2173453561},{70,51.9479490413},{80,41.2463708704},{90,13.6302645349}}}     ,{0.15,1,5,0.15,{{10,3.61590425964},{20,19.7064604062},{30,7.32257426682},{40,20.1419433185},{50,17.2420775206},{60,11.5885523282},{70,57.7289284563},{80,63.9188339033},{90,3.75163366931}}}};


title: Is undocumented \.bd = ½ bad to use?

text: I want to use `\.bd` which leads to `½` as part of the name of a symbol in the front end ( _e.g._ `d½[a_,b_]`). Will this lead to bad effects? I cannot find any documentation for this symbol.


title: how to use button in place of checkbox

text: I am novice to _Mathematica_ and want to ask how can I use `Button` in place of `Checkboxes`. I have used 4 `Checkboxes`, which does work accordingly when pressed. But I want there should be a button which when pressed shows actual plot and again pressed, shows mean plot.               With[{ae = {.65, .47, .54, .62, 1.14},     me = {.607, .434, .439, .505, .784},     as = {5.749, 4.359, 4.37, 4.837, 7.115},     ms = {5.466, 4.522, 4.403, 4.664, 6.423}},      Row[{Column[{Spacer[0] Text[Style["Earning per share-$", Bold, 18]],           Spacer[20],           Row[{Spacer[0] Text[Style["Click on/off ", Bold, 14]],             Labeled[Checkbox[Dynamic[q1]], Mean], Spacer[19],             Labeled[Checkbox[Dynamic[q2]], Actual], Spacer[19]}],           Column[{Dynamic@             ListPlot[              Accumulate[{ConstantArray[0, Length[ae]], If[q1, ae, 0],                 If[q2, me, 0]}], ImageSize -> {270, 450},               GridLines -> {None, Automatic},               PlotMarkers -> {Automatic, 6}]}]}], Spacer[10],         Column[{Spacer[0] Text[Style["Total sales-$ billion", Bold, 18]],       Spacer[20],       Row[{Spacer[0] Text[Style["Click on/off ", Bold, 14]],         Labeled[Checkbox[Dynamic[q3]], Mean], Spacer[19],         Labeled[Checkbox[Dynamic[q4]], Actual], Spacer[19]}],       Column[{Dynamic@         ListPlot[          Accumulate[{ConstantArray[0, Length[as]], If[q3, as, 0],             If[q4, ms, 0]}], GridLines -> {None, Automatic},           PlotMarkers -> {Automatic, 6},           ImageSize -> {270, 450}]}]}]}]]      I have three questions related to this:   1. how to use `Button` in place of `Checkboxes` here?   2. I am not able to resize the image by `ImageSize`. i.e. width=270 and height=450.   3. When I am deploying it in CDF, the `Text` are coming in quotes. How to removes this quotes. For more clarification, http://graphics.thomsonreuters.com/12/01/US_APPLEBREAK0112_VT.html Please help me.


title: Animate a triangle that follows a curve

text: Given:               r[t_] := {Sin[t], Sin[2 t]}     uT[t_] := Simplify[r'[t]/Norm[r'[t]], t \[Element] Reals]          Animate[Show[ParametricPlot[{r[t]}, {t, -\[Pi], \[Pi]}],     Graphics[{{Line[{{Sin[t], Sin[2 t]}, {-(Cos[t]/Sqrt[Cos[t]^2 + 4 Cos[2 t]^2]) +     Sin[t], -((2 Cos[2 t])/Sqrt[Cos[t]^2 + 4 Cos[2 t]^2]) +     Sin[2 t]}}]}}], PlotRange -> {{-2, 2}, {-2, 2}}], {t, 0, 2 \[Pi]},     AnimationRunning -> False]      ![enter image description here](http://i.stack.imgur.com/zNCkj.png) How do I replace the line with a triangle, to follow the curve as the picture below shows? ![enter image description here](http://i.stack.imgur.com/4I7nC.png)


title: How do I change the pressed button appearance?

text: On my system when a default button is pressed it turns light blue. This appearance can be changed using this code from the documentation: > Use a second element to get the appearance of a pressed button:               Table[Button["xxx", Null, Appearance -> {a, "Pressed"}], {a, {"DialogBox", "Palette"}}]      So in essence you change the _pressed_ button appearance by changing the button appearance. But if you want **no** appearance, i.e. Appearance->None, you are still stuck with the blue background:               Button["xxx", Null, Appearance -> {None, "Pressed"}]      ![enter image description here](http://i.stack.imgur.com/fBpYu.png) I can achieve what I want using `EventHandler`:               EventHandler[MouseAppearance["xxx", "LinkHand"],"MouseClicked" :> Print["X"]]      But it seems to me that I should be able to do this with `Button` options. Q. How can I set appearance to None for both the pressed and unpressed button? If this cannot be done with button options--and it would seem an oversight if it is not possible--I will use `EventHandler`.


title: Fourier Analysis: How to get rid of a discontinuity

text: When I compute the phase error of a spatial series data using `Fourier` analysis in _Mathematica_ there's a discontinuity @ parameter `c1 = 1.35`. However @ `c1 = 0.5` produces the correct result. Code:                   Clear[G, σ, ϕ];     G = -σ/2*((1 - Cos[ϕ])^2 + I*(3 - Cos[ϕ])*Sin[ϕ]);     Ztri = (1 + G + 1/2*G^2 + 1/6*G^3 + 1/24*G^4);     g[σ_Real, ϕ_Real] = -ArcTan[Re[Ztri], Im[Ztri]]/(σ*ϕ);     linecolors=Blue;     framecolors=Black;     c1 = 1.35     gp1 = Plot[g[σ, ϕ] /. {σ -> c1}, {ϕ, 0, Pi},         PlotRange -> {-2, 2.}, PlotStyle -> {linecolors, Thickness[0.006]},         PlotLegends -> Placed[{"CFL 1.35"}, {0.2, 0.4}],         AspectRatio -> Automatic];     c1 = 0.5;     gp2 = Plot[g[σ, ϕ] /. {σ -> c1}, {ϕ, 0, Pi},         PlotRange -> {-2, 2.}, PlotStyle -> {linecolors,Dotted, Thickness[0.006]},         PlotLegends -> Placed[{"CFL 0.5"}, {0.2, 0.4}],         AspectRatio -> Automatic];     BB = Show[gp1, gp2, Axes -> False, Frame -> True,        FrameStyle -> Directive[Thick, framecolors, 15],        FrameLabel -> {{"Phase error", ""}, {ω,           "Numerical dispersion"}}]      Plot after running code: ![enter image description here](http://i.stack.imgur.com/BDuft.png) The correct plot is like this ![Correct plot for c1=CFL=1.35](http://i.stack.imgur.com/Ycglz.png)