Version 8.0 integrates but Version 9.0.1 doesn't

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?


Opening notebooks from Workbench on Mac OS X?

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.


Including two ListLinePlots in a 3D graphic

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?


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

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


Taking Top K Occurrences

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.


Plotting spaces spanned by parameters

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.


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

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?


How to include automatic references to cells styled with DisplayFormulaNumbered

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.)


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

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.


Show only the outlines of graphic primitives

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.


How do I built a zoomable Koch curve?

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


Labeling a Plot with a Slash for Division Sign

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?


Reading periodic elements from a large file

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]


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

_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)


Generating lots of Examples in Polynomials Rings

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!


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

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.


Setting a lower limit on calculation time

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]


Size distribution of nanoparticles from a transmission electron microscopic image

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)


Matrix substitution

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.


Geometric Transformation not working - degenerate points?

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?


NDSolve two PDE plus one ODE, together

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


Opening cdf file from command line with arguments on windows

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.


professionalize/optimize my code that calls a function

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.


How to make the default table alignment "right"

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??


How to remove unwanted regions in a three-dimensional surface

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?


WhenEvent method with 3 conditions

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?


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

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?


Replace all elements of a list

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!


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

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.


Solar system simulation (n-body physics) with OpenCL

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.


Merging two held expressions into a held compound expression

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)] >


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

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!


Plotting error table in 3D

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 ?


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

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.


Export an image at 1000 dpi

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.


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

### 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.


Unit issues in Mathematica 9

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.)


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

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]]


Help in coding of differential equations

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.


Plotting data in a weird format

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}}}};


Is undocumented \.bd = ½ bad to use?

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.


how to use button in place of checkbox

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.


Animate a triangle that follows a curve

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)


How do I change the pressed button appearance?

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`.


Fourier Analysis: How to get rid of a discontinuity

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)


Precision problem with numerical solution of a differential equation

I want solve $$ 2\sqrt{|\gamma|}x = \int_{1}^{t} dy \sqrt{\frac{1+2|\gamma_2|y}{y^2(1-y)}} $$ where $0<t\leq $1. I'm using a for cycle to evaluate t, calculate the integral and the assign the $x$.               SfereDure = {};      For[t = 0.1, t <= 1, t = t + 0.1,         x = Integrate[Sqrt[(1 + 2*0.4*y)/(y^2*(1 - y))], {y, 1, t}];       (*Print["t=",t]      Print["x=", x]*)           SfereDure = Prepend[SfereDure, {x/2, N[t, 1]}];          SfereDure = Prepend[SfereDure, {-x/2, N[t, 1]}]]      I aspect $x=0$ at the last value of $t$ (i.e t=1), instead it isn't. I think that the problem is the precision of the calculus, in fact in the list "SfereDure"               {{-0.108449, 1.}, {0.108449, 1.}, {0.435952, 0.9}, {-0.435952, 0.9}, {0.635334, 0.8},      {-0.635334, 0.8}, {0.804738, 0.7}, {-0.804738, 0.7}, {0.965468, 0.6}, {-0.965468, 0.6},      {1.12849,0.5}, {-1.12849, 0.5}, {1.30375, 0.4}, {-1.30375, 0.4}, {1.50526, 0.3},      {-1.50526, 0.3}, {1.76102, 0.2}, {-1.76102, 0.2}, {2.15692, 0.1}, {-2.15692, 0.1}}      there is "1." that is 0.9999999999999999` and thus the integral $$ \int_{1}^{0.9999999999999999`}... $$ is not $0$.


Are there any openCL test suites?

I have a new ATI gpu that I have been trying on 3 different distributed computing projects. I get errors on each work unit. The errors indicate _No Protocol_ which could be caused by a bad environment variable that doesn't point to the correct path. On Linux, Mathematica returns $Failed for this:               Environment["ATISTREAMSDKROOT"]      So, I was wondering if there is a test suite that would validate the calculations of such a card?               {1->{Version->OpenCL 1.2 AMD-APP (923.1),Name->AMD Accelerated Parallel   Processing,Vendor->Advanced Micro Devices, Inc.,Extensions->{cl_khr_icd,cl_amd_event_callback,cl_amd_offline_devices},1->{Type->GPU,Name->Cypress,Version->OpenCL 1.2 AMD-APP (923.1),Extensions->{cl_khr_fp64,cl_amd_fp64,cl_khr_global_int32_base_atomics,cl_khr_global_int32_extended_atomics,cl_khr_local_int32_base_atomics,cl_khr_local_int32_extended_atomics,cl_khr_3d_image_writes,cl_khr_byte_addressable_store,cl_khr_gl_sharing,cl_ext_atomic_counters_32,cl_amd_device_attribute_query,cl_amd_vec3,cl_amd_printf,cl_amd_media_ops,cl_amd_popcnt},Driver Version->CAL 1.4.1741,Vendor->Advanced Micro Devices, Inc.,Profile->FULL_PROFILE,Vendor ID->4098,Compute Units->18,Core Count->1440,Maximum Work Item Dimensions->3,Maximum Work Item Sizes->{256,256,256},Maximum Work Group Size->256,Preferred Vector Width Character->16,Preferred Vector Width Short->16,Preferred Vector Width Integer->4,Preferred Vector Width Long->2,Preferred Vector Width Float->4,Preferred Vector Width Double->2,Maximum Clock Frequency->765,Address Bits->32,Maximum Memory Allocation Size->134217728,Image Support->True,Maximum Read Image Arguments->128,Maximum Write Image Arguments->8,Maximum Image2D Width->8192,Maximum Image2D Height->8192,Maximum Image3D Width->2048,Maximum Image3D Height->2048,Maximum Image3D Depth->2048,Maximum Samplers->16,Maximum Parameter Size->1024,Memory Base Address Align->2048,Memory Data Type Align Size->128,Floating Point Precision Configuration->{Infinity,NaNs,Round to Nearest,Round to Infinity,Round to Zero,IEEE754-2008 Fused MAD},Global Memory Cache Type->None,Global Memory Cache Line Size->0,Global Memory Cache Size->0,Global Memory Size->536870912,Maximum Constant Buffer Size->65536,Maximum Constant Arguments->8,Local Memory Type->Local,Local Memory Size->32768,Error Correction Support->False,Profiling Timer Resolution->1,Endian Little->True,Available->True,Compiler Available->True,Execution Capabilities->{Kernel Execution},Command Queue Properties->Profiling Enabled},2->{Type->CPU,Name->AMD Phenom(tm) II X6 1100T Processor,Version->OpenCL 1.2 AMD-APP (923.1),Extensions->{cl_khr_fp64,cl_amd_fp64,cl_khr_global_int32_base_atomics,cl_khr_global_int32_extended_atomics,cl_khr_local_int32_base_atomics,cl_khr_local_int32_extended_atomics,cl_khr_int64_base_atomics,cl_khr_int64_extended_atomics,cl_khr_byte_addressable_store,cl_khr_gl_sharing,cl_ext_device_fission,cl_amd_device_attribute_query,cl_amd_vec3,cl_amd_printf,cl_amd_media_ops,cl_amd_popcnt},Driver Version->2.0 (sse2),Vendor->AuthenticAMD,Profile->FULL_PROFILE,Vendor ID->4098,Compute Units->6,Core Count->6,Maximum Work Item Dimensions->3,Maximum Work Item Sizes->{1024,1024,1024},Maximum Work Group Size->1024,Preferred Vector Width Character->16,Preferred Vector Width Short->16,Preferred Vector Width Integer->4,Preferred Vector Width Long->2,Preferred Vector Width Float->4,Preferred Vector Width Double->0,Maximum Clock Frequency->3314,Address Bits->64,Maximum Memory Allocation Size->4215913470,Image Support->True,Maximum Read Image Arguments->128,Maximum Write Image Arguments->8,Maximum Image2D Width->8192,Maximum Image2D Height->8192,Maximum Image3D Width->2048,Maximum Image3D Height->2048,Maximum Image3D Depth->2048,Maximum Samplers->16,Maximum Parameter Size->4096,Memory Base Address Align->1024,Memory Data Type Align Size->128,Floating Point Precision Configuration->{Denorms,Infinity,NaNs,Round to Nearest,Round to Infinity,Round to Zero,IEEE754-2008 Fused MAD},Global Memory Cache Type->Read Write,Global Memory Cache Line Size->64,Global Memory Cache Size->65536,Global Memory Size->16863653880,Maximum Constant Buffer Size->65536,Maximum Constant Arguments->8,Local Memory Type->Global,Local Memory Size->32768,Error Correction Support->False,Profiling Timer Resolution->1,Endian Little->True,Available->True,Compiler Available->True,Execution Capabilities->{Kernel Execution,Native Kernel Execution},Command Queue Properties->Profiling Enabled}}}        EDIT: when I run an example I get: OpenCLMemoryAllocate::invdev: OpenCLLink device is invalid. Since the information in the scroll-bar above seems to be complete, I don't have any idea what to fix. **Coda** I solved this by running as root. It seems the AMD Linux driver has a slight permissions problem accessing the libaries.


Making time-index dependent state-space models - where has the Kalman filter gone?

How does one now implement a discrete set of state space models? I had used `KalmanFilter` in the old TimeSeries application, but was keen on trying to do all this in the "new paradigm" of StateSpaceModel[] in _Mathematica_ 10. _Mathematica_ 's own docs for the TimeSeries package has a section on state- space form and the Kalman Filter. Fundamentally I want to make F and G time-index dependent lists of matrices. Ultimately I want to implement a time-varying CAPM model as described in Tsay using _Mathematica_ 10. Ideas?


BitShiftRight produces incorrect results in Version 10

With Mathematica 10 for Mac, `BitShiftRight` works properly on lists of up to 100000 numbers, but appears to give incorrect results when threaded over lists of 100001 or more:               v1 = Table[i, {i, 1, 100000}];     v2 = Table[i, {i, 1, 100001}];     s1 = BitShiftRight[v1];     s2 = BitShiftRight[v2];     s1[[1 ;; 10]]     s2[[1 ;; 10]]      > >     Out[1070]= {0, 1, 1, 2, 2, 3, 3, 4, 4, 5} >   >     Out[1071]= {2, 4, 6, 8, 10, 12, 14, 16, 18, 20} >   The error seems to occur for any `BitShiftRight[n,k]` whenever n is a list exceeding 100000 values. Mathematica 9 gives correct output:               v1 = Table[i, {i, 1, 100000}];     v2 = Table[i, {i, 1, 100001}];     s1 = BitShiftRight[v1];     s2 = BitShiftRight[v2];     s1[[1 ;; 10]]     s2[[1 ;; 10]]      > >     Out[799]= {0, 1, 1, 2, 2, 3, 3, 4, 4, 5} >   >     Out[800]= {0, 1, 1, 2, 2, 3, 3, 4, 4, 5} >   I have several notebooks that apply `BitShiftRight[n,k]` to very large lists. The only Mathematica 10 workaround seems to be the equivalent `IntegerPart[n/2^k]` that continues to work on very large lists, but is slower and requires rewriting previously working code. Otherwise I would need to stick with MM 9 for these notebooks. Can anyone confirm this anomalous MM 10 output? Does it affect other platforms? Am I missing something simple, or is this a true MM 10 bug? Thanks


Solve for $a$ as a function of $\beta$?

I am trying to solve this equation: $$\beta^{-a} \Gamma(a) \sin(a \pi) + e^\beta \beta^{2 a - 1} \Gamma(1 - a) \sin(a \pi) = 0$$ I tried the following:               Solve[β^-a Gamma[a] Sin[a π] + E^β β^(2 a - 1) Gamma[1 - a] Sin[a π] == 0, {a, β}]      However this is not working. Can you help me?


Monospaced fonts are not monospaced

I'm using Linux-x86-64 as operating system. Can someone explain this behaviour and maybe give a hint how to resolve it? Here are two lines of exact the same number of letters of a monospaced font:               Style["ZZZZZZZZZZ\n__________", 20, FontFamily -> "Courier"]      As output I get (here with 30 Z and 30 _) ![monospaced](http://i.stack.imgur.com/99xYc.png) But what I expect from a _monospaced_ font like Courier is to have the same size for every letter (and why is the line dashed anyway?). @Oleksandr was so kind to give me mental support and tried the things on his Windows machine. There the output seems ok: ![monospaced win](http://i.stack.imgur.com/mu26W.png) ## More detailed question What I really want is an image of arbitrary resolution of every letter. I thought when I use a combination of `Style` and `Rasterize` I can get equally sized images of them in exact the same form as they appear in text. But there is (at least here) a clear difference between an assembled image from rasterized letters and a rasterized version of the string               ImageAssemble[      Rasterize[Style[#, 30, FontFamily -> "Courier"], "Image"] & /@        CharacterRange["A", "Z"]]          Rasterize[      Style[StringJoin[CharacterRange["A", "Z"]], 30,        FontFamily -> "Courier"], "Image"]      ![Mathematica graphics](http://i.stack.imgur.com/u3F4g.png) ![Mathematica graphics](http://i.stack.imgur.com/cgGrA.png) What I noticed is that the height of the letters is always the same, only the width varies. Looking at how many letters have which width gives here               Sort@Tally@First@        Transpose[         ImageDimensions[            Rasterize[Style[#, 30, FontFamily -> "Courier"], "Image"]] & /@           CharacterRange["A", "z"]]     (*       Out[138]= {{18, 25}, {19, 16}, {20, 8}, {21, 8}, {24, 1}}     *)      This is a mess. Any ideas about this issue would be very welcome.


Why does TraditionalForm[Inactivate[x y]] show x * y ? instead of x y?

Given that both `x` and `y` are expressions, in my case `x` is `Transpose[A]` and `y` is `B`, I thought that the `TraditionalForm` for multiplication was juxtaposition with a space between. Why is the `Output` for `TraditionalForm[Inactivate[x y]]` displayed with `*` visible? I am working in _Mathematica_ **V10**. Thanks for your help.


How to draw block diagrams as Graph objects?

In the documentation ClosedLoopResponsesWithAPIDController, There is a very nice block diagram. I want to create my own block diagrams similar to this. I clicked on the diagram and pressed "command-shift-E" to show the underlying expression. I found the expression below. While this is explicit and reasonably easy to modify and extend, For really big graphs (which I have) it will rapidly become too difficult to manage by hand. I wonder if there is an easier way to produce such graphics? Is there a tool I just don't know about for drawing and / or automatically laying out such things?               Graph[{1, 2, 3, 4, 5, 6, 7, 8,              9}, {{{1, 2}, {2, 3}, {3, 4}, {4, 5}, {5, 6}, {6, 7}, {6,          2}, {8, 4}, {9, 6}}, Null}, {             EdgeLabels -> {DirectedEdge[8, 4] -> Placed[                      Style["+", {FontFamily -> "Helvetica",                           GrayLevel[0, 1], 12}], {1, {-0.8, 0.2}}],          DirectedEdge[3, 4] -> Placed[                      Style["+", {FontFamily -> "Helvetica",                           GrayLevel[0, 1], 12}], 0.9],          DirectedEdge[9, 6] -> Placed[                      Style["+", {FontFamily -> "Helvetica",                           GrayLevel[0, 1], 12}], {1, {-0.8, 0.2}}],          DirectedEdge[5, 6] -> Placed[                      Style["+", {FontFamily -> "Helvetica",                           GrayLevel[0, 1], 12}], 0.9],          DirectedEdge[6, 2] -> Placed[                      Style["-", {FontFamily -> "Helvetica",                           GrayLevel[0, 1], 12}], {0.965, {-0.7, 0}}],          DirectedEdge[1, 2] -> Placed[                      Style["+", {FontFamily -> "Helvetica",                           GrayLevel[0, 1], 12}], 0.9]},               EdgeShapeFunction -> {},               EdgeStyle -> {                  GrayLevel[0, 1]}, Epilog -> {                  Text[                    Style["u", {FontFamily -> "Helvetica",                         GrayLevel[0, 1], 12}], {2.5, 0.1}]},        ImageSize -> 500,               VertexCoordinates -> {{0., 0.}, {0.7, 0.}, {1.8, 0.}, {2.9,           0.}, {3.9, 0.}, {5., 0.}, {5.6, 0.}, {                  2.9, 0.66}, {5., 0.66}}, VertexLabels -> {1 -> Placed[                      Style["r", {FontFamily -> "Helvetica",                           GrayLevel[0, 1], 12}], Center], 6 -> Placed[                      Style["", {FontFamily -> "Helvetica",                           GrayLevel[0, 1], 12}], Center], 9 -> Placed[                      Style["m", {FontFamily -> "Helvetica",                           GrayLevel[0, 1], 12}], Center], 2 -> Placed[                      Style["", {FontFamily -> "Helvetica",                           GrayLevel[0, 1], 12}], Center], 8 -> Placed[                      Style["d", {FontFamily -> "Helvetica",                           GrayLevel[0, 1], 12}], Center], 7 -> Placed[                      Style["y", {FontFamily -> "Helvetica",                           GrayLevel[0, 1], 12}], Center], 3 -> Placed[                      Style["PID controller", {FontFamily -> "Helvetica",                           GrayLevel[0, 1], 12}], Center], 4 -> Placed[                      Style["", {FontFamily -> "Helvetica",                           GrayLevel[0, 1], 12}], Center], 5 -> Placed[                      Style["linear system", {FontFamily -> "Helvetica",                           GrayLevel[0, 1], 12}], Center]},               VertexShapeFunction -> {                 3 -> "Square", 4 -> "Circle", 7 -> "Square",          5 -> "Square", 9 -> "Square", 1 -> "Square", 6 ->                   "Circle", 8 -> "Square", 2 -> "Circle"},               VertexSize -> {8 -> {0.1, 0.1}, 3 -> {0.6, 0.2},          2 -> {0.125, 0.125}, 1 -> {0.1, 0.1}, 9 -> {0.1, 0.1},                   4 -> {0.125, 0.125}, 6 -> {0.125, 0.125},          5 -> {0.6, 0.2}, 7 -> {0.1, 0.1}},               VertexStyle ->        {2 -> Directive[GrayLevel[1],            EdgeForm[{GrayLevel[0], AbsoluteThickness[1]}]],          1 -> Directive[Opacity[0], EdgeForm[{}]],         8 -> Directive[Opacity[0], EdgeForm[{}]],         7 -> Directive[Opacity[0], EdgeForm[{}]],         5 -> Directive[GrayLevel[1],            EdgeForm[{GrayLevel[0], AbsoluteThickness[1]}]],         6 -> Directive[GrayLevel[1],            EdgeForm[{GrayLevel[0], AbsoluteThickness[1]}]],         4 -> Directive[GrayLevel[1],            EdgeForm[{GrayLevel[0], AbsoluteThickness[1]}]],         9 -> Directive[Opacity[0], EdgeForm[{}]],         3 -> Directive[GrayLevel[1],            EdgeForm[{GrayLevel[0], AbsoluteThickness[1]}]]         }}]


How to generate this fractal-like 3D distribution of points in Mma 7.0?

I would like to produce some **3D** distributions of points using **_Mathematica 7.0_** , that **look like** the picture below : ![A 3D fractal-like/percolation-like distribution of random points in 3D space](http://i.stack.imgur.com/CEajz.png) How could I do that ? What are your suggestions ? What Mma 7 codes could do a distribution of points which is _approximately_ like this ? I'm not specifically looking for a diffusion limited aggregation method. Any other method would be interesting, if it's reasonably fast. Ideally, the code should compile very fast. Adding some color shades to the distribution would be a nice option. **EDIT :** The picture above was taken from this topic : Distribution of random points in 3D space to simulate the Crab Nebula which is about filaments and sub-structures in the Crab nebula.


Animation is jerky, but slider is not

When I do the following simple animation (from the book _Mathematica Navigator_ , p. 316) the slider control changes the image smoothly, but when I play the animation it is jerky. Is there anything that can be done to make the animation smooth? ![enter image description here](http://i.stack.imgur.com/CNwa8.png) The code for the plot is as follows:               Manipulate[Plot[Cos[a x], {x, 0, 3 \[Pi]}], {a, 1, 10, 0.3}]      UPDATE: Changing the step value does not help; also, sometimes the animation stops completely, just gets stuck. Something appears to be seriously wrong with the animate function. _The main problem, the jerkiness, appears to be caused by Windows "User Account Control" (UAC) (see answer below). This "security" feature is present in Windows 7, 8 and Windows Vista. It can be avoided by either running Mathematica as Administrator or by turning off Windows UAC altogether._


Plotting a transformed region only works with integer inputs

I can't figure out why the following code only works with integers.               r1 = TransformedRegion[Cuboid[{-1, -1, -1}, {1, 1, 1}], TranslationTransform[{0, 1, 0}]]     RegionPlot3D[r1]     DiscretizeRegion[r1]     RegionQ[r1]      ![enter image description here](http://i.stack.imgur.com/nZsVV.png)![enter image description here](http://i.stack.imgur.com/5TiZz.png) now, If I replace every "1" with a "1.", I get an error message.               r1 = TransformedRegion[Cuboid[{-1., -1., -1.}, {1., 1., 1.}], TranslationTransform[{0, 1,0}]]     RegionPlot3D[r1]     DiscretizeRegion[r1]     RegionQ[r1]      ![enter image description here](http://i.stack.imgur.com/DRpA6.png) The problem seems to extend to most of mathematica's new region functions, as demonstrated below with RegionMeasure. A possible work around is to symbolically evaluate the expression first.               r1 = TransformedRegion[Cuboid[{-1., -1., -1.}, {1, 1, 1}],TranslationTransform[{0, 1, 0}]];     RegionMeasure[r1]          r1 = TransformedRegion[Cuboid[{-a, -a, -a}, {a, a, a}], TranslationTransform[{0, 1, 0}]];     RegionMeasure[r1] /. a -> 1.0      ![enter image description here](http://i.stack.imgur.com/KTPx4.png) ![enter image description here](http://i.stack.imgur.com/HxPv8.png) Has anybody else experimented with this issue?


Dual graph of an arbitrary (planar) graph

Every planar graph has a dual. How can I obtain it with _Mathematica_? I know that `GraphData` provides the `DualGraph` property for its named graphs, but I have found no method for computing the dual of an arbitrary (non-named) graph. Even _Combinatorica_ seems to lack it.


LogLikelihood function with Multivariate State Space Models

I load the packadge TimeSeries. Depending on the running Mathematica release, one should preliminary remove some built-in function with the same name, e.g.KalmanFilter, I used the following commands:               ClearAttributes[KalmanFilter, {Protected, ReadProtected}];     Clear[KalmanFilter];     Needs["TimeSeries`TimeSeries`"]      I consider the following Bi-variate State Space Model (the symbols F, G, Q, R, c, d for the matrices of my model follow Mathematica Structural Models and the Kalman Filter (http://reference.wolfram.com/applications/timeseries/UsersGuideToTimeSeries/StructuralModelsAndTheKalmanFilter/index.en.html)               (F = {{-0.5, f12}, {0., -0.3}; Q={{1., 0.}, {0., 1.}}; G={{g11, 1.}, {0., g22}}; R={{1., 0.}, {0., 1.}}; c = {0., 0.}; d = {d1, 0.};)      I build the state covariance function               getP[X_, Y_] :=          Partition[     Inverse[IdentityMatrix[#^2] -         Flatten[Map[Flatten, Transpose /@ Outer[Times, X, X], {2}],          1]].Flatten[Y], #] &[Length[X]]     P = getP[F, Q];      Note that one could also get P as the solution of the equation P==FPTranspose[F]+Q. I use a Bi-dimensional data vector               data = RandomVariate[BinormalDistribution[1/2], 10];      I define the functions f and if as prescribed (the absence of d1 in P seems to be irrelevant)               Clear[f, if];     if = Function[Evaluate[P /. {f12 -> #1, g11 -> #2, g22 -> #3, d1 -> #4}]];     f[f12_?NumericQ, g11_?NumericQ, g22_?NumericQ, d1_?NumericQ] :=       -LogLikelihoodFunction[data, {{0, 0}, if[f12, g11, g22, d1]}, F, G, Q, R, c, d]      I define starting points               {f120 = RandomReal[{0.00, 1.00}], g110 = RandomReal[{-5.00, 5.00}],      g220 = RandomReal[{-5.00, 5.00}], d10 = RandomReal[{-5.00, 5.00}]};      I try to compute the LogLikelihoodFunction (this is the correct name of the documented LogLikelihood function in the packadge Time Series) at the given points               SP = {f12, g11, g22, d1} //.      {f12 -> f120, g11 -> g110, g22 -> g220, d1 -> d10};     f[f12, g11, g22, d1]     Thread::tdlen: Objects of unequal length in {{0.,0.},{1.53649,-0.102148},<<6>>,       {1.30567,-0.121967},{1.84233,0.269059}}+<<1>> cannot be combined. >>          MapThread::mptd: Object {-3.38954,0.}+{{0.,0.},<<8>>,{-<<19>>,-<<19>>}}+       {{0.320751,0.790727},<<8>>,{0.27184,0.60035}} at position {2, 1} in        MapThread[#1.Inverse[#2].#1&,<<1>>] has only 0 of required 1 dimensions. >>          Thread::tdlen: "Objects of unequal length in 35.9506 +(#1.Inverse[#2].#1&)+{-<<18>>,       <<3>>}+{<<1>>}+{{0.320751,0.790727},<<8>>,{0.27184,0.60035}} cannot be combined. >>      I get the above two types of error messages. Surprisingly, despite the red color of some arguments (too many arguments given) the KalmanFilter function seems to work!                KalmanFilter[data, {{0, 0}, if[f12, g11, g22, d1]}, F, G, Q, R, c, d] // MatrixForm      Of course the minimum of the LogLikelihoodFunction cannot be computed. I tried with different matrices for R also with the null matrix. No differences. I've no problems with Uni-variate State State models. I hope that Somebody can help me! thank you in advance for your kind attention.


How can I find ,Which InputField was recently updated?

I have 4 `InputFields`.I want to find which `InputField` was recently Updated out of all `InputFields`.For that purpose I wrote the following code.                fValues = {Null, Null, Null, Null};      {       Table[         With[             {i = i},             (                     InputField[                                 Dynamic[Part[fValues, i]],                                 Number,                                 ContinuousAction -> True                             ]                 )             ],         {i, 1, 4}     ],     Dynamic[fValues]     }      How can I resolve this? Can anyone help me? Thank you