Use Mathematica to determine the falling law

We have a one-variable equation $\rho(R)$ where               ρ = (14656.4+277.526*R^2)/(45.9225+R^2)^{5/2} + 0.370036/(R*(0.25+R)^3)      This equations describes the evolution of a density distribution, and as the following plot shows, the value of $\rho$ decreases rapidly with increasing $R$. ![enter image description here](http://i.stack.imgur.com/HIAny.jpg) Usually density distributions drop following a law $R^{-k}$. So, is it possible to use _Mathematica_ in order to determine the falling law at large radii $R$ in this case? In other words, to determine the values of $k$. **EDIT** Following @Vitaliy Kaurov solution I got the desired value of $k$. At the following plot, the red line corresponds to $277.526/R^3$ and as we can see it fully coincides with $\rho(R)$. ![enter image description here](http://i.stack.imgur.com/Jkcue.jpg)


Defining a function that returns "undefined" if its value is outside of a specific range

I want to define a function f(x) which:   * $f(x)=x^3 +10x+ 5$ if $f(x) >0$   * $f(x)=Undefined$ if $f(x) <0$  I have a idea:               f = Function[x, ConditionalExpression[x^3 +10x+ 5, x^3 +10x+ 5 > 0]]      but if $f(x)$ is a complicated and long expression, then the code is very long. Any one have another idea?


Change character encoding for file read using OpenRead

I have a large bzipped file that I want to read using OpenRead on a pipe with UTF8 encoding. Doing the following does not give me UTF-8 encoding. My `$CharacterEncoding` is set to `"UTF8"`.               f = OpenRead["!bunzip2 -c " <> filename]      `OpenRead` does not have a `CharacterEncoding` option like `Import` does. So the following works:               txt = Import["!bunzip2 -c " <> filename, "Text", CharacterEncoding -> "UTF8"];      But `Import` forces me to load all the data before operating on it which I don't want. **UPDATE1** : For now I'm reading in the string as bytes and then converting to UTF8 manually               FromCharacterCode[ToCharacterCode[s], "UTF8"]      I notice _Mathematica_ UI has problems printing certain Unicode characters as others stackoverflowers have noticed.


Manipulates Behaving Badly--Why is it autoupdating?

In working on a simple simulation I came across the following Manipulate quirk (bug?) and I want to know how to get around it. Here is the first pass code, which acts as expected (but is incorrect):               simpleBrownianSimulation[] := Module[{vels, nPts},         Manipulate[             vels = Table[RandomReal[{-1, 1}, 2], {Length[pts]}];             nPts = Table[pts[[i]] + t*vels[[i]], {i, Length[pts]}];             Graphics[{Blue, PointSize[0.02], Point[nPts]},              PlotRange -> {{-5, 5}, {-5, 5}}],             {{pts, {{0, 0}}}, Locator, LocatorAutoCreate -> True, Appearance -> None},             {t, 0, 10, 0.05}     ]];     simpleBrownianSimulation[]      The idea is to use the slider to trigger updates to the particles (stored in pts) position. This code correctly updates only if the slider is moved, but contains an error, since the position is computed always from the initial position of the particle, and the current time value. So to fix this, I changed it to:               simpleBrownianSimulation[] := Module[{vels, nPts, isSet = False},         Manipulate[         If[!isSet, nPts = pts; isSet = True];         vels = Table[RandomReal[{-1, 1}, 2], {Length[pts]}];         nPts = Table[nPts[[i]] + vels[[i]], {i, Length[pts]}];         Graphics[{Blue, PointSize[0.02], Point[nPts]}, PlotRange -> {{-5, 5}, {-5, 5}}],         {{pts, {{0, 0}}}, Locator, LocatorAutoCreate -> True, Appearance -> None},         {t, 0, 10, 0.05}     ]];     simpleBrownianSimulation[]      This code is correct, but it ANIMATES! It updates on its own regardless of whether the slider is being moved or not. I know that here the value of the slider is not used, that is fine. I just want to use it as an update trigger, and NOT have maniuplate update otherwise. Why is manipulate doing this and how can I fix it? Note that this is Mathematica 9, but this occurs both on the Windows and Mac versions.


Getting MIDI SoundNote Pitches as Numeric Values

I'm trying to do some evaluation on notes (specifically the pitches) imported from a MIDI file. I've imported a list containing tracks of sound notes with `Import["path/to/midi.mid", "SoundNotes"]` and a track's sound notes look like the following:               { SoundNote["G4", {0., 0.5}, "Piano", SoundVolume -> 0.501961],        SoundNote["C5", {0.5, 1.}, "Piano", SoundVolume -> 0.501961],        SoundNote["D5", {1., 1.5}, "Piano", SoundVolume -> 0.501961],       ...     }      I'm attempting to get the pitch out of each SoundNote, treating each SoundNote as a list and grabbing the first value with `aNote[[1]]`. However, this returns a note string such as "C5". Is there a way to get a numeric representation of the pitch, in either MIDI scale (Middle C = 60) or Mathematica's scale (Middle C = 0)? I haven't seen any way to pull information from a SoundNote in the docs, unless I'm missing something.


Safely nesting RuleDelayed

Say I have the following, straightforward-seeming functions:               makeARuleDelayed[a_, b_] :=      With[{anotherRule = makeAnotherRuleDelayed[b]},       v : a[b] :> ((v == 1 - v) /. anotherRule)];          makeAnotherRuleDelayed[x_] :=       v : h_[x] :> foo[h, x];      If I use them to create a `RuleDelayed`, I get an error message: > >     a[b] /. makeARuleDelayed[a, b] >   > > RuleDelayed::rhs: Pattern v$:h$_[b] appears on the right-hand side of rule > v$:a[b]:>(v$==1-v$/. v$:h$_[b]:>foo[h$,b]) . Examining the result indicates the problem:               v$ : a[b] :> (v$ == 1 - v$ /. v$ : h$_[b] :> foo[h$, b])      Using this rule fails in about the way you'd expect it to. The only workaround I could think of is adding a `Module` to the body of `makeAnotherRule`:               makeAnotherRuleDelayed[x_] :=      Module[{v},       v : h_[x] :> foo[h, x]]      This doesn't help at all; evidently there must be some sort of magical renaming going on somewhere inside of `RuleDelayed` that truncates the `$nnn` part of the name of the symbol generated by `Module`. Without being able to nest rules without name clashes, I'm not sure how to go about creating nontrivial rules programmatically.


How can I change label colors in a colored chart?

I am trying to make a chart with labels, but I would like for the labels on the chart to be white for purposes of visibility. I am aware of the `Style[expression, White]` option, but when I apply it, my labels go away entirely. ![Bad Image](http://i.stack.imgur.com/IQ96A.png) Code is thus:               snp = Log10[Delete[data[[All, 4]], 1]];     BarChart[snp,        PlotLabel -> "Plot of Single Nucleotide Polymorphisms",        ChartLabels -> Placed[names, Center, Rotate[#, 90 Degree] &],        ChartStyle -> "LightTemperatureMap",        ChartLegends -> names]


How can I control the number format of exported data?

I'm having issues while exporting a tables of numerical values to "*.dat" data files. Here's the thing, **sometimes** when I export a table, I get _more_ decimals on some **random values**. The problem is that they weren't even there in the first place. Now, for the sake of illustration, here's a **very simple** example on the issue. I tried constructing the following table :               Table[t, {t, 0, 0.4, 0.1}]      Which provides with the following list :               {0., 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1, 0.11, \     0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.2, 0.21, 0.22, \     0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29, 0.3, 0.31, 0.32, 0.33, \     0.34, 0.35, 0.36, 0.37, 0.38, 0.39, 0.4}      Now, I just tried to export it using the `Export`command like this :               Export["t.dat", Table[t, {t, 0, 0.4, 0.1}], "Table"]      and everything should be fine, but when you try to read what's in "t.dat" using `FilePrint` :               FilePrint["t.dat"]      I get the following : 0. 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1 0.11 0.12 0.13 0.14 0.15 0.16 0.17 0.18 0.19 0.2 0.21 0.22 0.23 0.24 0.25 0.26 0.27 0.28 0.29 0.3 0.31 0.32 0.33 0.34 0.35000000000000003 0.36 0.37 0.38 0.39 0.4 Note that the number 0.35 suddenly became 0.35000000000000003, which messes everything up. Is there something to solve this issue? I tried using the `NumberForm` function but it changes the structure of the exported list... What I intend to do is to export **t** list presented above, alongside with _another_ list in which I do operations using the values of the first one. For example :               time = Table[NumberForm[i, 6], {i, 0, 0.2, 0.01}];     op = Table[time[[i]]^2 + time[[i]], {i, 1, Length@time}];     Export["data.dat",Transpose@{time,op}, "Table"];     FilePrint["data.dat"];      Which returns :               0.  NumberForm[0., 6] + NumberForm[0., 6]^2     0.01    NumberForm[0.01, 6] + NumberForm[0.01, 6]^2     0.02    NumberForm[0.02, 6] + NumberForm[0.02, 6]^2     0.03    NumberForm[0.03, 6] + NumberForm[0.03, 6]^2     0.04    NumberForm[0.04, 6] + NumberForm[0.04, 6]^2     0.05    NumberForm[0.05, 6] + NumberForm[0.05, 6]^2     0.06    NumberForm[0.06, 6] + NumberForm[0.06, 6]^2     0.07    NumberForm[0.07, 6] + NumberForm[0.07, 6]^2     0.08    NumberForm[0.08, 6] + NumberForm[0.08, 6]^2     0.09    NumberForm[0.09, 6] + NumberForm[0.09, 6]^2     0.1 NumberForm[0.1, 6] + NumberForm[0.1, 6]^2     0.11    NumberForm[0.11, 6] + NumberForm[0.11, 6]^2     0.12    NumberForm[0.12, 6] + NumberForm[0.12, 6]^2     0.13    NumberForm[0.13, 6] + NumberForm[0.13, 6]^2     0.14    NumberForm[0.14, 6] + NumberForm[0.14, 6]^2     0.15    NumberForm[0.15, 6] + NumberForm[0.15, 6]^2     0.16    NumberForm[0.16, 6] + NumberForm[0.16, 6]^2     0.17    NumberForm[0.17, 6] + NumberForm[0.17, 6]^2     0.18    NumberForm[0.18, 6] + NumberForm[0.18, 6]^2     0.19    NumberForm[0.19, 6] + NumberForm[0.19, 6]^2      What I mean by "changes its structure" is the fact that I can no longer operate on the _time_ list and its values correctly...


How to simplify an expression into the sum of small fractions

I'm trying to simplify the following expression $$\frac{n.r \ p.q - (n.p + n.q) (p.r + q.r)}{(n.p + n.q)\ p.q}\to \frac{n.r}{n.p+p.q}-\frac{p.r+q.r}{p.q}$$ When I put it into _Mathematica_ and use `FullSimplify` nothing happens though. For me it would be "simpler" to express this as a sum of "small" fractions. I've tried using `Apart` but that also does nothing. Could anyone recommend a way for me to force _Mathematica_ to simplify an expression like this?


Module with "local functions"

I am trying to use a `Module` having "local functions", i.e., those which I need to define only inside this module. So I tried this:               norm[p_] := Module[{       fun1[p_] := p^2 + p - 1;       fun2[p_] := p^3 - p^2 + p + 1      },      Max[fun1[p], fun2[p]]     ];      The function is compiling, but when I try to evaluate it--say, I try:               norm[2]      Its giving me an error telling: > `Module::lvsym`: Local variable specification > `{fun1[p_]:=p^2+p-1;fun2[p_]:=p^3-p^2+p+1}` contains > `fun1[p_]:=p^2+p-1;fun2[p_]:=p^3-p^2+p+1`, which is not a symbol or an > assignment to a symbol How do we avoid this error? I want to give functions in the space between { ... }.


Does the syntax coloring I see indicate a real problem?

I need a behaviour provided by:               x = 2;     Block[{x = HoldForm[x]}, x]      > >     x >   `FrontEnd` marks this syntax as not quite correct. > ![enter image description here](http://i.stack.imgur.com/WViV3.png) It has not caused me any troubles so far so my question is: **could it be a problem?**


How avoid white space and tags in CDF on web page

A CDF manipulate made in Mathematica 8 works fine and looks fine in a web page except for unsightly notebook tags and white space around the outside of and below the panel. What can be done? http://faculty.unlv.edu/gbp/mma/VisualComplexAnalysis/complexInversion.html Mathematica 9 is available, but not yet downloaded. Will it provide better web deployment? Code added on June 29, 2014               Clear["Global`*"]          Style[Pane[Framed[Manipulate[          (* GRAPHICS AND PLOTS COMBINED USING SHOW; LAST ITEM IN TRUMPS PREVIOUS *)     Show[{     circleK,     circleAPlot[offset oCircA],     circleBPlot[offset oCircA],invLineGraphics[offset oCircA],invAVGrPts[offset oCircA],     invLVGrPts[offset oCircA],     qPt,lineR,     labels[offset oCircA],     caption     },Axes->False,PlotRange->{xBnds,yBnds},Background->LightGray],     {{offset,2,Style["origin A multiplier",White,Bold]}, {3,2.5,2,1.5, 1, .5, 0,-.5}},     Initialization :> (          (* CONSTANTS *)          radCircA = 1/4; (* Radius of A *)          oCircA = (1+I)/(4 Sqrt[2]); (* Center of A *)          radR = 1; (* Radius of K *)          q = 0; (* Center of K *)          invAngles = Range[Pi/4, 3Pi/4, Pi/8];          (* PLOTTING BOUNDARIES *)          bnds = 4;          xBnds = {-bnds,bnds};          yBnds = {-bnds,bnds};          (* FUNCTIONS *)          (* THE POINT OF THE PLOT IS TO DEMONSTRATE THE BEHAVIOR OF THIS FUNCTION, Subscript[I, k](z), R = 1 *)          zInv[z_,q_,R_]:=(q Conjugate[z] + (R^2 - Abs[q]^2)/(Conjugate[z]-Conjugate[q]));          (* CONVERT COMPLEX TO VECTOR w REAL ELEMENTS *)          v[z_]:={Re[z],Im[z]};          (* CIRCLE WITH ORIGIN AT q AND RADIUS OF radR *)          circleK := Graphics[Circle[v[q],radR]];          (* CALCULATE COMPLEX POINTS OF CIRCLE A AND USE TABLE TO CREATE LIST OF POINTS *)          circleATable[centerA_] := Table[radCircA Exp[I \[Theta]]+centerA, {\[Theta], 0, 2Pi, .01}];          (* INVERT COMPLEX POINTS OF CIRCLE A BY MAPPING zInv[] TO LIST OF COMPLEX POINTS; RETURNS A LIST *)          circleBTable[centerA_] := zInv[#,q,radR]&/@circleATable[centerA];          (* MAP LISTS OF COMPLEX POINTS TO LISTS OF VECTORS *)          circleAVectors[centerA_] := v[#]&/@circleATable[centerA];          circleBVectors[centerA_] := v[#]&/@circleBTable[centerA];          (* CREATE LINE PLOTS FROM LISTS OF VECTORS *)          circleAPlot[centerA_] := ListLinePlot[circleAVectors[centerA],AspectRatio->1,PlotStyle->{Blue}];          circleBPlot[centerA_] := ListLinePlot[circleBVectors[centerA],AspectRatio->1,PlotStyle->{Blue}];          (* INVERSION POINTS IN A, SHOWN WITH RED DOTS AND ARROWS *)          invACPts[centerA_] := (radCircA Exp[I (#-Pi/4)]+centerA)&/@invAngles;          invLCPts[centerA_] := zInv[#,q,radR]&/@invACPts[centerA];          invAVGrPts[centerA_] :=Graphics[{Red,Point[v[#]]}&/@invACPts[centerA]];          invLVGrPts[centerA_]:= Graphics[{Red,Point[v[#]]}&/@invLCPts[centerA]];          invLineObjs[centerA_] := {Gray, Dashed,Arrowheads[.02],Arrow[{v[0],v[#]}]}&/@invLCPts[centerA];          invLineGraphics[centerA_] := Graphics[invLineObjs[centerA]];          (* OTHER *)          qPt = Graphics[Point[v[q]]];          lineR = Graphics[{Dashed,Gray,Line[{v[q],v[radR Exp[I (Pi/2+Pi/4)]]}]}];          (* LABELS *)          labelK=Text[Style["K", Bold, 12], v[-.5-.5I]];          labelA[centerA_] := {Blue,Text[Style["A", Bold, 8], v[centerA]]};          labelB[centerA_] :={Blue,Text[Style[If[Abs[centerA] == Abs[oCircA], "B = L","B"], Bold, 8], v[zInv[centerA +radCircA Exp[I  Pi/4],q,radR]+.2+.2I]]};          labelq = Text[Style["q", Bold, 12], v[0]-{.1,.1}];          labelR = Text[Style["R", Bold, 10], v[(1/2)Exp[I(Pi/2+Pi/4)]]-{.1,.1}];          (* CONVERT TEXT PRIMITIVES TO GRAPHICS OBJECTS *)          labels[centerA_] := Graphics[{labelK, labelA[centerA], labelB[centerA],labelq,labelR}];          caption = Graphics[{Text[Style["Complex inversion of circle A in unit circle K\nto circle B or to line L if center q of K in A\nSubscript[I, k](z) =(q Overscript[z, _] + ((R^2)-|q|^2) )/(Overscript[z, _]-Overscript[q, _]), R=1", Bold,12], v[-2.2I]]}])     ],Background->Black],{395,430},Alignment->Left],Background->LightGray]


Two-way locator & slider controls

I was wondering whether it was possible to have a two way control system, whereby one could click and drag both the locator (which would in turn move the sliders), AND click & drag the sliders (which in turn would move the locator). Here is an image of what I would like to achieve: ![enter image description here](http://i.stack.imgur.com/uyUAK.gif) The code below controls the locator only:               f[x_] := x^2;     Manipulate[n, {n, 1, 20, 1}]     Manipulate[With[{x0 = Clip[p[[1]], {0., 10}]},      Plot[f[x], {x, 0, 10}, ImagePadding -> 20, LabelStyle -> (FontFamily -> "Ariel"),     Epilog -> {PointSize[Large], Red,     Tooltip[Point[#], #] &@{x0, f[x0]}}]], {{p, {0, 0}}, Locator, Appearance -> None},     AppearanceElements -> None]      for which I must credit Michael E2 and Timothy Wofford :-)


Forcing optimal solution for FindShortestTour

I use `FindShortestTour` as explained here and it works nicely for a small number of cities. However when I try this with as little as 16 cities, the given tour isn't optimal anymore. I've tried using different `Methods` but none of them gave me the optimal tour (solutions within a 5% to 400% range of the optimal solution). How can I force Mathematica to give me the optimal solution? **Edit** : This is my code (pretty much copy-paste from the link above as I'm very new to Mathematica)               dim = 16;     max = 100;          (* create symmetric matrix with random integers *)     d = RandomInteger[max, {dim, dim}];     d = Table[If[i > j, d[[i, j]], d[[j, i]]], {i, 1, Length[d[[1]]]}, {j, 1,Length[d[[1]]]}];     (d[[#, #]] = Infinity) & /@ Range[dim];     d // Grid          (* find tour *)     {len, tour} = FindShortestTour[Range[dim], DistanceFunction -> (d[[#1, #2]] &),        Method -> "TwoOpt"]          (* display tour *)     HighlightGraph[ WeightedAdjacencyGraph[d, DirectedEdges -> False,        GraphStyle -> "SmallNetwork", EdgeLabels -> "EdgeWeight"],       Style[UndirectedEdge[#1, #2], Thickness[.01], Red] & @@@ Partition[tour, 2, 1, 1]]


Normal lines to surfaces or planes in a 3D plot

How do I make the normal line to a plane actually look perpendicular?               cc = Plot3D[2 x + y, {x, -2, 2}, {y, -2, 2}, PlotRange -> {-4, 4}]          bb = ParametricPlot3D[{2 t, t, -t}, {t, -1, 1}, PlotStyle -> Thick]          Show[cc, bb]      ![Mathematica graphics](http://i.stack.imgur.com/jzmwt.png) The line doesn't look even close to perpendicular to the plane.


Select parts of Input Cell

One of my cells contains some Text and Input:               some text 3+5,      so the expression underlying this looks like               Cell[  TextData[{          "some text ",          StyleBox["3+5", "Output"]             }],   "Text"]      I now wish to select only the "3+5", using commands, as to be able to evaluate that part _in place_ , as if one uses the command "Evaluate in Place" of the Evaluation menu (and using the notebook end to manually select 3+5). I've tried using Cases[ ... , StyleBox[__]], but this gives an empty set. What am I missing here? Once again, thanks for all help!


How to make a function with its own options as well as passing options to other functions

I have a function with many of its own options, but I would also like to pass options to subfunctions using the `FilterRules` function. Here's a simple example:               Options[pfunc] = {"test" -> True};     pfunc[x0_, plotopts : OptionsPattern[]] := Module[{},       Plot[x^2, {x, -x0, x0},         PlotStyle -> If[OptionValue["test"], Red, Blue],         Evaluate[FilterRules[{plotopts}, Options[Plot]]]]]      When I just try to use the options of the `pfunc` it works just fine               pfunc[7]     pfunc[7, "test" -> False]      ![enter image description here](http://i.stack.imgur.com/ZroPz.png) ![enter image description here](http://i.stack.imgur.com/rHzyX.png) But if I try to use an internal argument for `Plot`, it produces the figure as expected but gives error messages.               pfunc[7, "test" -> False, Frame -> True, Axes -> False]     (*     OptionValue::nodef: Unknown option Frame for pfunc. >>          OptionValue::nodef: Unknown option Axes for pfunc. >>          OptionValue::nodef: Unknown option BaseStyle for pfunc. >>          General::stop: Further output of OptionValue::nodef will be suppressed during this calculation. >>     *)      ![enter image description here](http://i.stack.imgur.com/EkxAy.png) Why does it give these errors? Furthermore, what if I need to pass options to different subfunctions?


Avoiding overcomplicated structure of groups, masks and splited text on vector format plot export

I'm trying to generate a template for exporting figures and plots in a consistent way that will allow easy editing in any vector based drawing software (such as illustrator). My problem is that exported figures in vector format have an (apparently) unnecessarily cumbersome structure. For instance               p = Plot[x, {x, 0, 1}       , Frame -> True       , FrameLabel -> {"Abscissa [unit]", "Ordinate [a.u]"}       , BaseStyle -> {FontSize -> 11, FontFamily -> "Helvetica",          FontTracking -> "Plain", TextJustification -> 0,          PrivateFontOptions -> {"OperatorSubstitution" -> False}}       ]     Export["test.svg",p,"SVG"]      will generate an SVG file which code look like this:               <g transform='matrix(1.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000)' clip-path='url(#cp98)'>     <clipPath id='cp98'><polygon points='74,13 74,252 434,252 434,13 ' /></clipPath>     <polyline fill='none' stroke-opacity='1' stroke-width='0.2px' stroke='rgb(0%,0%,0%)' points='431.898,20 428.122,20 ' />     </g>     <g transform='matrix(1.000000, 0.000000, 0.000000, 1.000000, 235.948980, 236.753659)' clip-path='url(#cp99)'>     <clipPath id='cp99'><polygon points='-1.94898,-1.75366 -1.94898,15.2463 73.051,15.2463 73.051,-1.75366 ' /></clipPath>     <text x='0' y='11' font-family='Arial' font-size='11px' fill='rgb(0%,0%,0%)'>Abscissa</text>     <text x='49' y='11' font-family='Arial' font-size='11px' fill='rgb(0%,0%,0%)'>[</text>     <text x='52' y='11' font-family='Arial' font-size='11px' fill='rgb(0%,0%,0%)'>unit</text>     <text x='69' y='11' font-family='Arial' font-size='11px' fill='rgb(0%,0%,0%)'>]</text>     </g>      See how each piece of text, and tick stroke has a group, a clipping mask and the text is split in several text instances. That code also is cumbersome to manipulate when opened in Illustrator ![Screenshot layers and groups seen in Illustrator](http://i.stack.imgur.com/IkVDX.png) The described problem also exists in PDF and EPS formats, but is easier to see in the SVG code. Is it possible to control this behaviour? At least I would like to remove any clipping masks AND groups, and force all the text in a label to be a single object. Ideally I would like to have a group for traces, another for axis and another for labels I tried making `TextJustification -> 0,FontTracking -> "Plain"` hoping at least the text split could be solved, but with no consequence. **Edit** Based on this question one strategy would be to parse back the SVG file (that is XML mark-up) , join all text that is in the same group. and then remove groups and clipping paths. That was not the kind of solution I was expecting, but it may work. Any help on how to do this string or XML translation?               <g (random options 1)>     <clipPath (random options 2) /></clipPath>     <text (random options 3)> A</text>     <text (random options 3)> B</text>     <text (random options 3)> C</text>     </g>      into               <text (same options 3)> ABC</text>      **Edit 2** A very preliminary and partially failed _solution_ is to create the SVG and parse it back as XML, and take what is inside the groups (g) and clips (clipPath), and export it back as text.               p = Plot[x, {x, 0, 1}       , Frame -> True       , FrameLabel -> {"Abscissa [unit]", "Ordinate [a.u]"}       , BaseStyle -> {FontSize -> 11, FontFamily -> "Helvetica",          FontTracking -> "Plain", TextJustification -> 0,          PrivateFontOptions -> {"OperatorSubstitution" -> False}}       ]          Export["test2.svg",       ExportString[       ImportString[ExportString[p, "SVG"], "XML"] /.         XMLElement["g", __, {XMLElement["clipPath", __], x_}] -> x,        "XML"], "Text"]      But the problem is that some groups have transform definitions that redefine the coordinate system and that information is currently lost. Also not all the groups are removed, i don't understand why. I would appreciate some help on this XML substitution rules and data parsing.


How can I style a cell frame with rounded corners?

I'd like use rounded rectangles for my cell style, but I'm not sure if this is possible. Perhaps it can be faked with an image as a background for it?


Mathematica regex equvalent of \l

In normal RegEx `\l` will make the character to the right lowercase. However, it seems like the RegEx in Mathematica does not have this functionality. For example               StringCases["Abba", RegularExpression["(.).*?\\l\\1"]]      will return the following error message               RegularExpression::msg37: "Mathematica does not support \\L, \\l, \\N, \\P, \\p, \\U, \\u, or \\X in RegularExpression[\!\(\"(.).*?\\\\l\\\\1\"\)]."      Is there some workaround that I can use? Note that `(?i)` is not sufficient as I need the character to be lowercase _only_. Thanks


Expected Value: Strange/unexpected result

Assume $X$ is an exponential random variable with unit mean ($f_X(x)=e^{-x}$, $x>0$). I want to calculate the expected value of $\frac{1}{X}$. Since $X>0$, I am expecting that $\mathbb{E}(\frac{1}{X})>0$, but _Mathematica_ gives some negative value. I tried the following input: `Expectation[1/x, {x \\[Distributed] ExponentialDistribution[1]}]` and _Mathematica_ 's answer is: `-EulerGamma` Is it possible? Am I doing some mistakes?


Simplifying just parts of an expression

I'm having trouble with the simplifications of certain expressions.   A typical example of this is the following (all my variables are positive real numbers):               k1 = Exp[-t1/al];     et2 = 1 + Exp[-t6/al];     xi2 = 1 + Exp[-t6/al] + Exp[-(t4 + t6)/al];     Log[k1] Log[et2/xi2]      This produces $$ \log\left(e^{-t1/\alpha}\right) \log\left(\dfrac{1+e^{-t6/\alpha}}{1+e^{-(t4+t6)/\alpha} + e^{-t6/\alpha}}\right)$$ Now, I want to get rid of that trivial $\log(\exp)$, so I used `Simplify`               Simplify[%, Element[{t1, t4, t6, al}, Reals] && al != 0]      which gives $$ -\dfrac{t1}{\alpha}\log\left(\dfrac{e^{t4/\alpha}(1+e^{t6/\alpha})}{ 1 + e^{t4/\alpha}+e^{(t4 + t6)/\alpha}}\right)$$ This is right, of course, but unfortunately it produces an undesired effect: inside the second logarithm, Mathematica has factored $e^{-t4/\alpha}$ and $e^{-(t4+t6)/\alpha}$, turning negative powers in positive ones.   At the end of the day, I will let $\alpha\to0$, so really I'm more comfortable with negative powers of $e$ (it is apparent which terms will be negligible in the limit). **How can I tell Mathematica not to touch the argument of the second logarithm?**


Export Plot from Table to $\LaTeX$ -- conform with pgfplots

## General purpose My intension is to use data created by Mathematica as in   * Export Plots to $\LaTeX$,   * $\LaTeX$ and Mathematica, or   * How to export multiple Barcharts from Mathematica to $\LaTeX$ but with a nicer $\LaTeX$ conform font style and similar stuff. This is the reason why I am using the $\LaTeX$ package pgfplots. This package also allows me to add further information and fancy graphical stuff (by using TikZ) to the plot at later time. ## Issue Now I do not get Mathematica to write me a data-file which can be read by the $\LaTeX$ package pgfplots. The current data (and export) has the following structure:               DataTable = {{9/50, 5.00251*10^9, 3.02252*10^9, 2.17472*10^9, 1.97472*10^9},<<1000>>};     Export["Energy.csv", DataTable];      The idea is to plot in the end something like               \documentclass{standalone}     \usepackage{pgfplots}     \pgfplotsset{compat=newest}          \begin{document}         \begin{tikzpicture}         \begin{axis}[%             xlabel={xlabel},             ylabel={ylabel}]         \addplot[color=blue,mark=none]              table [x expr=\thisrowno{0}, y expr=\thisrowno{1}, col sep=space] {data.dat};         \addplot[color=blue,mark=none]              table [x expr=\thisrowno{0}, y expr=\thisrowno{2}, col sep=space] {data.dat};         \end{axis}         \end{tikzpicture}         \end{document}      ## EDIT: The $\LaTeX$ routine pgfplots uses the following data structure (where the option `col sep=space|tab|comma|colon|semicolon|braces|&|ampersand` defines the separation character - same is also vaid for the column separation `row sep=newline|\\\`):               Field,Energy1,    Energy2,    Energy3,    Energy4     9/50, 5.00251e+09,3.02252e+09,2.17472e+09,1.97472e+09     ... (all data like this first row of data)      You might want to check out chapter 4.3.2 (Reading Coordinates From Tables) in the pgfplots manual which contains all important informations. By the way the header is not necessary but helps other readers to understand your data.


How to change color in the plot for a given table expression?

H[t_] = {{0, 1}, {1, t}};     tmax=5;     fun[X_?ArrayQ, t_] := -I (H[t].X - X.H[t]);          sol = NDSolve[{σ'[t] == fun[σ[t], t], σ[0] ==      Table[If[i == 1 \[And] j == 1, 1, 0], {i, 1, 2}, {j, 1,        2}]}, σ[t], {t, 0, tmax}]          Flatten[Evaluate[σ[t] /. sol /. {t -> tmax/100}], 1] // MatrixForm           Plot[Table[Flatten[Evaluate[σ[t] /. sol], 1][[i, i]], {i, 1, 2}], {t, 0,tmax}, PlotRange -> All]      ![Table plot](http://i.stack.imgur.com/qwRif.jpg) How to change the color of two lines in plot... and why               Flatten[Evaluate[σ[t] /. sol], 1][[1, 1]]       gives               t      while                Flatten[Evaluate[σ[t] /. sol], 1][[2, 2]]       gives                {InterpolatingFuction[{{0.,5.}},<>}[t]}[[2,2]]


Rectangle wave OK in calculations, wrong in Plot

I have a Piecewise function consisting of two rectangle waves with different duty cycles:               dc1 = 0.7; dc2 = 0.3; period = 1; maxt = 15;      rectangleWave[t_, period_, duty_] := UnitBox[Mod[t/period, 1.]/(2. duty)];      pwm1[t_] := rectangleWave[t, period, dc1];      pwm2[t_] := rectangleWave[t, period, dc2];      pwm[t_, tsplit_] := Piecewise[{{pwm1[t], t < tsplit}, {pwm2[t], t >= tsplit}}];     Plot[pwm[t, 5], {t, 0, maxt}, Exclusions -> None, PlotRange -> All]      ![enter image description here](http://i.stack.imgur.com/9b4Kk.png) but if I increase my Plot interval beyond 16 I get ![enter image description here](http://i.stack.imgur.com/vCNCx.png) Looks like there's an error in my definition of `rectangleWave`. However, when I use the Piecewise function in a differential equation it is interpreted correctly:               dc1 = 0.7; dc2 = 0.3; period = 1; y0 = 0.65; maxt = 18;      rectangleWave[t_, period_, duty_] := UnitBox[Mod[t/period, 1.]/(2. duty)];     pwm1[t_] := rectangleWave[t, period, dc1];      pwm2[t_] := rectangleWave[t, period, dc2];      pwm[t_, tsplit_] := Piecewise[{{pwm1[t], t < tsplit}, {pwm2[t], t >= tsplit}}];     c1 = 1; r1 = 2;      s = NDSolve[{r1 c1 y'[t] + y[t] == pwm[t, 5], y[0] == y0}, y, {t, 0, maxt}];     Plot[{pwm[t, 5], Evaluate[y[t] /. s]}, {t, 0, maxt},              Exclusions -> None, PlotRange -> All]      ![enter image description here](http://i.stack.imgur.com/z1iHg.png) Ideas anyone?


How to align the output of MatrixPlot with the output of Plot

I am trying to figure out how to align different types of plots into one image. For example in the following code, it plots two lines on top of a `MatrixPlot`. I want the lines to pass through the corners of the red squares in the overlaid image.                Overlay[{          MatrixPlot[Table[Mod[i^2 + j^2, 3], {i, 20}, {j, 20}],               ColorRules -> {0 -> Red, 1 -> White, 2 -> White}, AspectRatio -> Full],          Plot[{y = x, y = -x/1 + 1}, {x, 0, 1}, AspectRatio -> Full]},           ImageSize -> Full]      How can I create the image so the lines and squares fit together better?


Importing parts of Packages

Some programming languages offer the possibility of importing a single function from a library, as in               from x import y      I'm looking to import only one function (`GraphCoordinates`) from the `GraphUtilities` package. The following commands do not work:               << GraphUtilities`GraphCoordinates          Needs["GraphUtilities`", "GraphCoordinates"]      The former gives an error, while the latter loads the entire `GraphUtilities` package. How should I proceed?


Definitions inside ParallelTable?

How can I make definitions inside `ParallelTable` to use them outside? For example, if I execute:               ParallelTable[a[i] = i, {i, 1, 3}]      and after that, I try to access the value of `a[1]`, I don't get `1` as I'd expect. Is there a way to make definitions inside `ParallelTable` so that I can access to them outside? Note that what I want to do is more sophisticated than the trivial example above. Though there would probably be a way to do it without making definitions inside `ParallelTable`, it would really make my life easier if I could do it.


Defining a recursive integral sequence

I have a recursive integral sequence as follows: $$y_0(x)=1+r,$$ $$y_1(x)=-\frac{1}{\Gamma(a)}\int_0^x (x-t)^{a-1} y_0(t) dt,$$ $$\vdots$$ $$y_n(x)=-\frac{1}{\Gamma(a)}\int_0^x (x-t)^{a-1} y_{n-1}(t) dt,\quad 0<a<1.$$ I wrote the following code but the output answer isn't correct. I know this problem is caused by the change of variables($t\leftrightarrow x$ ) in $y_n(x)$. How to modify this problem?               Y[0, x_] = 1 + r;     Y[k_, x_] :=       Y[k, x] =FullSimplify[-(1/Gamma[a])*Integrate[(x - t)^(a - 1)*(Y[k - 1, t]), {t, 0, x}]]     For[i = 0, i <= 10, i++, Print["Y", i, "[x]=", Simplify[Y[i, x]]]]


Making nice code: choosing one of several procedures

Happy new year mathematica gurus of stack exchange! As I see it one of the major obstacles in getting decent at programming mathematica is that, not only do you need to learn how certain commands work, but rather that you mainly need to understand how to write your syntax. This is a typical such situation, I was hoping that someone might shine some light on how to do it. I run this piece of code:               For[i = 1, i <= samples, i++,      AppendTo[fList,        f1[randomSeeds[[1 + (n - 1) (i - 1)]][[1]],          randomSeeds[[1 + (n - 1) (i - 1)]][[2]], 0, 0, 0, 0, 0, 0]];      ]          For[i = 1, i <= samples, i++,      AppendTo[fList,        f1[randomSeeds[[1 + (n - 1) (i - 1)]][[1]],          randomSeeds[[1 + (n - 1) (i - 1)]][[2]],          randomSeeds[[2 + (n - 1) (i - 1)]][[1]],          randomSeeds[[2 + (n - 1) (i - 1)]][[2]], 0, 0, 0, 0]];      ]          For[i = 1, i <= samples, i++,      AppendTo[fList,        f1[randomSeeds[[1 + (n - 1) (i - 1)]][[1]],          randomSeeds[[1 + (n - 1) (i - 1)]][[2]],          randomSeeds[[2 + (n - 1) (i - 1)]][[1]],          randomSeeds[[2 + (n - 1) (i - 1)]][[2]],          randomSeeds[[3 + (n - 1) (i - 1)]][[1]],          randomSeeds[[3 + (n - 1) (i - 1)]][[2]], 0, 0]];      ]          For[i = 1, i <= samples, i++,      AppendTo[fList,        f1[randomSeeds[[1 + (n - 1) (i - 1)]][[1]],          randomSeeds[[1 + (n - 1) (i - 1)]][[2]],          randomSeeds[[2 + (n - 1) (i - 1)]][[1]],          randomSeeds[[2 + (n - 1) (i - 1)]][[2]],          randomSeeds[[3 + (n - 1) (i - 1)]][[1]],          randomSeeds[[3 + (n - 1) (i - 1)]][[2]],          randomSeeds[[4 + (n - 1) (i - 1)]][[1]],          randomSeeds[[4 + (n - 1) (i - 1)]][[2]]]];      ]      As you can see most of the stuff is identical in the for loops, it's just the number of zeroes that varies in the end. In fact, I only wish to run one of these for loops at the time. Just above these for loops I specify the number of dimensions I'm working in (n in the code), for n=2 I want to run the first loop, for n=3 I want to run the second etc. At the moment I comment an uncomment the undesired parts of the code, but that seems like a very ugly solution to me. So my question is this: is there a simple way of reducing these for copies of code into one copy? It seems to me as though this is a quite ineffective way of doing things. Edit: Small clarification: Ideally I want something like this: I give the program "2" as input and it chooses the first for loop above etc. Cheers, David


(Efficiently) Generating graphs with vertex degree 3 for all vertices

I'm working on a graph theory problem, and given $n$ vertices, I would like to be able to generate all non-isomorphic connected graphs (not necessarily simple) with $n$ vertices, each having degree 3. Currently I'm doing the graph finding in Sage, but the included graph packages have given me problems, so I've used dictionaries instead. My approach is to generate graphs with vertex degree at most three, and recurse on previous such lists, increasing edge number by 1 each time. This is not optimal, and is really time-intensive, mostly because of my primitive isomorphism-checking function. So, I would like to know if it is possible to generate this type of list (connected graphs with maximal degree at most 3) in Mathematica, because I can actually plot them there easily as well. I've been using a converter (line 46 here) that gives the Mathematica command to plot the graphs from Sage, for example,               {GraphPlot[{1 -> 2, 1 -> 1, 2 -> 3, 2 -> 3}],       GraphPlot[{1 -> 2, 1 -> 1, 2 -> 3, 2 -> 4}],       GraphPlot[{1 -> 2, 1 -> 1, 2 -> 3, 3 -> 3}],       GraphPlot[{1 -> 2, 1 -> 1, 2 -> 3, 3 -> 4}],       GraphPlot[{1 -> 2, 1 -> 2, 1 -> 3, 2 -> 3}],       GraphPlot[{1 -> 2, 1 -> 2, 1 -> 3, 2 -> 4}],       GraphPlot[{1 -> 2, 1 -> 2, 1 -> 3, 3 -> 4}],       GraphPlot[{1 -> 2, 1 -> 3, 1 -> 4, 2 -> 3}],       GraphPlot[{1 -> 2, 1 -> 3, 1 -> 4, 2 -> 5}],       GraphPlot[{1 -> 2, 1 -> 3, 2 -> 4, 3 -> 4}],       GraphPlot[{1 -> 2, 1 -> 3, 2 -> 4, 3 -> 5}]}      gives all the graphs with 4 edges and vertices of degree at most 3. Any help in this regard would be appreciated. For the past two hours Sage has been computing all such graphs with 5 edges, and I would like at least 9-edge graphs, so things are not looking hopeful in that direction. Maybe there are nice packages to do this with? I've looked at Combinatorica, but the graph-manipulating functions don't seem well-suited to my needs, though that is from a cursory inspection.


Page breaks appearing as thick line on actual print-out

I'm using Insert->Page Break to do just that, but thick black lines are appearing on the actual printed copy wherever I indicated a break. Can this be turned off?


Solve a total derivative - independent vs. dependent variables

I am trying to force mathematica to solve a generally defined function for d lp: In a reduced version, `w` depends on `l2`, `lp` and `t`. `l2` and `lp` depend on `t`. Furthermore, `w` is constant with respect to `t`. So, I did               Solve[Dt[w[l2, lp, t], t] == 0, Dt[lp, t]]      which works. The problem is that the dynamics of `l2` do not depend on `w`, so they can be defined by:               l2[t_] := l20*E^(p*t)      where l20 is a constant. So, I tried the following:               l2[t_] := l20*E^(p*t)     Solve[Dt[w[l2, lp, t], t, Constants -> {l20, p}] == 0, Dt[lp, t]]      which did not help. Second try was this one,               Solve[Dt[w[l20*E^(p*t), lp, t], t, Constants -> {l20, p}] == 0, Dt[lp, t]]      which did not help either. Does anybody have an idea?


How to replace every possible $A+B$ and $AB$ in expansion of $(A+B)^{10}-A^{10}-B^{10}$ with $x$ and $y$, respectively?

I would like to replace every possible $A+B$ and $AB$ in expansion of $(A+B)^{10}-A^{10}-B^{10}$ with   $x$ and $y$, respectively. How to do it with the simplest code in _Mathematica_? For example, \begin{align*} (A+B)^3-A^3-B^3 &= 3AB(A+B)\\ &= 3xy \end{align*} In other words, having $A+B=x$ and $AB=y$, how do I express $(A+B)^{10}-A^{10}-B^{10}$ in terms of $x$ and $y$. ## Bonus question Rather than creating a new question for it, I think I should ask here. If I want to find $a^{10}+b^{10}$ in terms of $x$ and $y$, why does               Simplify[(a + b)^10 - Expand[(a + b)^10 - a^10 - b^10],a b == x && a + b == y]       not produce the expected result?


Efficient method for factor expressions with square roots

Inspired from this, I tried factor following expressions, Mathematica takes a long time, I couldn't even wait for it to finish. Maple calculating it takes about 5 sec. Can you recommend an efficient method? To get the factored result please click here(generated by Maple 16).               Factor[1 - 216 x^2 - 192 x^3 + 16140 x^4 + 18816 x^5 - 547528 x^6 -        687168 x^7 + 8960886 x^8 + 12394752 x^9 - 67518888 x^10 -        108989760 x^11 + 178031596 x^12 + 374357376 x^13 + 61149384 x^14 -        96214464 x^15 + 3999249 x^16,       Extension -> {Sqrt[2], Sqrt[3], Sqrt[5], Sqrt[6], Sqrt[11]}]


Notebook formatting - easier descriptions for equations and results?

When I do computations in mathematica, I generally try to make it readable for myself-in-the-future. This can be a cumbersome task in mathematica, where it often requires me to switch betwee a text cell, then back to an equation cell (or two), over and over again, to be able to label what a given equation/result is. e.g.               (text:) This is the equation for ... .... ...     In[517]:= 2 + 2     Out[517]= 4      over and over again. Is there anyway to make mathematica produce output like the following?               In[517]:= 2 + 2  This is the ... Equation     Out[517]= 4      The resulting value ...


How to generate random directed connected graph? I need to create graph which will pass:               ConnectedGraphQ[^]


Calculate mean and standard deviation from ImageHistogram

I am doing my PhD in Clinical Neuropsychology; I had someone helping me analyse images (.jpg pictures) in _Mathematica_ , but it turns out this person made some really bad decisions, and well, now I have to do it myself. But, I have no idea. Basically, what I want is to analyze the JPEG image, get a RGB histogram, and get the values for the mean and standard deviation of this histogram. Using `ImageHistogram [[*image*], Appearance, -> "Separated"]` works fine, but I can't figure out the next step, turning the histogram plot into numbers. How can I do that? Thank you for helping!


Why does GridLines option fail with Function?

The `Plot` option `GridLines` can be specified either as a list of explicit values at which to draw the lines, or as a **function** that calculates the grid lines based on the maximum and minimum values along each axis. In _Mathematica_ version 8, I was able to specify this function for `GridLines` in two equivalent ways:               Clear[gridLineFunction];     gridLineFunction[xmin_, xmax_] := {.1, .2, .5};          Plot[Sin[x], {x, 0, 1}, GridLines -> gridLineFunction]      ![lines](http://i.stack.imgur.com/tuluz.png) This follows the example in the documentation, but for simplicity it returns a fixed list of numbers without doing any calculations at all. However, now I rewrite the above by passing it directly to `GridLines` as a `Function`:               Plot[Sin[x], {x, 0, 1},       GridLines -> Function[{xmin, xmax}, {.1, .2, .5}]]      ![no lines](http://i.stack.imgur.com/Jb44u.png) This last line is what I get in **version 10** on OS X. It _used to work_ in version 8. And the equivalent construct _still works_ for the `Ticks` option:               Plot[Sin[x], {x, 0, 1}, Ticks -> Function[{xmin, xmax}, {.1, .2, .5}]]      ![ticks](http://i.stack.imgur.com/UknOh.png) Is there any reason I'm overlooking why this `Function` approach no longer works in `GridLines`, or is this a bug?


2D grid as a 2D polygonal or smooth domain

I have a series of points, as a list of pairs of real numbers, each multiple of a base value. So they represent a subset of a grid.   Given that this list, when represented with `ListPlot`, seems to delimit a 2D domain, I would like to know if there is a way to represent the boundaries of such a domain with polygonal or smooth interpolation functions. Here is a sample image of my data: ![enter image description here](http://i.stack.imgur.com/iPVn3.jpg) These are my sample data:               {{0.02, 0.64}, {0.04, 0.64}, {0.06, 0.64}, {0.08, 0.64}, {       0.08, 0.66}, {0.1, 0.64}, {0.1, 0.66}, {0.12, 0.64}, {0.12, 0.66}, {         0.14, 0.64}, {0.14, 0.66}, {0.14, 0.68}, {       0.16, 0.64}, {0.16, 0.66}, {0.16, 0.68}, {0.18, 0.64}, {0.18, 0.66}, {0.18, \     0.68}, {0.2, 0.66}, {0.2, 0.68}, {       0.2, 0.7}, {0.22, 0.66}, {0.22, 0.68}, {0.22, 0.7}, {0.24, 0.66}, {         0.24, 0.68}, {0.24, 0.7}, {0.26, 0.66}, {0.26, 0.68}, {0.26, 0.7}, {0.28,        0.66}, {0.28, 0.68}, {0.28, 0.7}, {0.28, 0.72}, {0.3,        0.66}, {0.3, 0.68}, {0.3, 0.7}, {0.3, 0.72}, {0.32, 0.66}, {0.32,          0.68}, {0.32,        0.7}, {0.32, 0.72}, {0.34, 0.66}, {0.34, 0.68}, {0.34, 0.7}, {0.34,          0.72}, {0.34,        0.74}, {0.36, 0.66}, {0.36, 0.68}, {         0.36, 0.7}, {0.36, 0.72}, {0.36, 0.74}, {0.38, 0.66}, {0.38, 0.68}, \     {0.38, 0.7}, {0.38, 0.72}, {0.38, 0.74}, {0.4, 0.66}, {0.4,        0.68}, {0.4, 0.7}, {0.4, 0.72}, {0.4, 0.74}, {0.42,        0.66}, {0.42, 0.68}, {0.42, 0.7}, {0.42, 0.72}, {0.42,        0.74}, {0.42, 0.76}, {       0.44, 0.66}, {         0.44, 0.68}, {0.44, 0.7}, {0.44, 0.72}, {0.44, 0.74}, {0.44, 0.76}, \     {0.46, 0.66}, {0.46, 0.68}, {0.46, 0.7}, {       0.46, 0.72}, {         0.46, 0.74}, {0.46, 0.76}, {0.48, 0.66}, {0.48, 0.68}, {0.48, 0.7}, \     {0.48, 0.72}, {0.48, 0.74}, {0.48, 0.76}, {0.48, 0.78}, {0.5, 0.66}, {         0.5, 0.68}, {0.5, 0.7}, {0.5, 0.72}, {0.5, 0.74}, {0.5, 0.76}, {0.5,        0.78}, {0.52, 0.66}, {0.52, 0.68}, {0.52, 0.7}, {0.52,        0.72}, {0.52, 0.74}, {0.52,        0.76}, {0.52, 0.78}, {0.54, 0.66}, {0.54, 0.68}, {0.54, 0.7}, {         0.54, 0.72}, {0.54, 0.74}, {0.54, 0.76}, {0.54,          0.78}, {0.56, 0.68}, {0.56, 0.7}, {0.56, 0.72}, {0.56, 0.74}, {0.56,        0.76}, {0.56, 0.78}, {0.56, 0.8}, {0.58, 0.68}, {0.58,        0.7}, {0.58, 0.72}, {0.58, 0.74}, {0.58, 0.76}, {0.58,        0.78}, {0.58, 0.8}, {0.6, 0.68}, {0.6,          0.7}, {0.6, 0.72}, {0.6, 0.74}, {0.6, 0.76}, {0.6, 0.78}, {         0.6, 0.8}, {0.62, 0.68}, {0.62, 0.7}, {0.62, 0.72}, {         0.62, 0.74}, {0.62, 0.76}, {0.62, 0.78}, {0.62, 0.8}, {0.62, 0.82}, \     {0.64, 0.68}, {0.64, 0.7}, {0.64, 0.72}, {0.64, 0.74}, {0.64, 0.76}, {0.64, \     0.78}, {0.64, 0.8}, {       0.64, 0.82}, {         0.66, 0.68}, {0.66, 0.7}, {0.66, 0.72}, {0.66, 0.74}, {0.66, 0.76}, \     {0.66, 0.78}, {0.66, 0.8}, {0.66, 0.82}, {0.68, 0.68}, {0.68,          0.7}, {0.68, 0.72}, {0.68, 0.74}, {0.68, 0.76}, {0.68, 0.78}, {0.68,        0.8}, {0.68, 0.82}, {0.68, 0.84}, {0.7,          0.68}, {0.7, 0.7}, {0.7, 0.72}, {0.7, 0.74}, {0.7, 0.76}, {         0.7, 0.78}, {0.7, 0.8}, {0.7, 0.82}, {0.7, 0.84}, {         0.72, 0.68}, {0.72, 0.7}, {0.72, 0.72}, {0.72, 0.74}, {         0.72, 0.76}, {0.72, 0.78}, {         0.72, 0.8}, {0.72, 0.82}, {0.72, 0.84}, {0.74, 0.7}, {0.74, 0.72}, {0.74,          0.74}, {0.74, 0.76}, {0.74, 0.78}, {0.74,        0.8}, {0.74, 0.82}, {0.74, 0.84}, {0.76, 0.7}, {0.76, 0.72}, {0.76, 0.74}, {       0.76, 0.76}, {0.76, 0.78}, {       0.76, 0.8}, {0.76, 0.82}, {0.76, 0.84}, {0.76, 0.86}, {0.78, 0.7}, {         0.78, 0.72}, {0.78, 0.74}, {0.78, 0.76}, {0.78, 0.78}, {0.78, 0.8}, {0.78,        0.82}, {0.78, 0.84}, {0.78, 0.86}, {0.8, 0.7}, {0.8,        0.72}, {0.8, 0.74}, {0.8, 0.76}, {0.8, 0.78}, {0.8, 0.8}, {0.8, 0.82}, {0.8,        0.84}, {0.8, 0.86}, {0.82,        0.7}, {0.82, 0.72}, {0.82, 0.74}, {0.82, 0.76}, {0.82, 0.78}, {0.82, 0.8}, {       0.82, 0.82}, {0.82, 0.84}, {0.82, 0.86}, {0.82, 0.88}, {0.84,          0.7}, {0.84, 0.72}, {0.84, 0.74}, {0.84, 0.76}, {0.84, 0.78}, {0.84, \     0.8}, {0.84, 0.82}, {0.84, 0.84}, {0.84, 0.86}, {       0.84, 0.88}, {         0.86, 0.72}, {0.86, 0.74}, {0.86, 0.76}, {0.86, 0.78}, {0.86, 0.8}, \     {0.86, 0.82}, {0.86, 0.84}, {0.86, 0.86}, {0.86, 0.88}, {0.88, 0.72}, {0.88, \     0.74}, {0.88, 0.76}, {0.88, 0.78}, {0.88, 0.8}, {0.88, 0.82}, {       0.88, 0.84}, {0.88, 0.86}, {       0.88, 0.88}, {0.88, 0.9}, {0.9, 0.72}, {0.9, 0.74}, {0.9, 0.76}, {         0.9, 0.78}, {0.9, 0.8}, {0.9, 0.82}, {0.9,        0.84}, {0.9,          0.86}, {0.9, 0.88}, {0.9, 0.9}, {0.92, 0.72}, {0.92, 0.74}, {0.92, 0.76}, \     {0.92, 0.78}, {0.92, 0.8}, {0.92, 0.82}, {0.92, 0.84}, {0.92, 0.86}, {       0.92, 0.88}, {         0.92, 0.9}, {0.94, 0.74}, {0.94, 0.76}, {0.94, 0.78}, {0.94, 0.8}, {       0.94, 0.82}, {0.94, 0.84}, {0.94, 0.86}, {0.94, 0.88}, {       0.94, 0.9}, {0.96, 0.74}, {0.96, 0.76}, {0.96, 0.78}, {0.96, 0.8}, {         0.96, 0.82}, {0.96, 0.84}, {0.96, 0.86}, {       0.96, 0.88}, {0.96, 0.9}, {0.96, 0.92}, {         0.98, 0.74}, {0.98, 0.76}, {0.98, 0.78}, {0.98, 0.8}, {0.98, 0.82}, {       0.98, 0.84}, {0.98, 0.86}, {0.98, 0.88}, {0.98, 0.9}, {         0.98, 0.92}, {1., 0.74}, {1., 0.76}, {1.,        0.78}, {1., 0.8}, {1., 0.82}, {1., 0.84}, {1., 0.86}, {1.,          0.88}, {1., 0.9}, {1., 0.92}, {1.02,        0.76}, {1.02, 0.78}, {1.02, 0.8}, {1.02, 0.82}, {1.02,          0.84}, {1.02, 0.86}, {1.02, 0.88}, {1.02, 0.9}, {1.02, 0.92}, {1.02,          0.94}, {1.04, 0.76}, {1.04,          0.78}, {1.04, 0.8}, {1.04, 0.82}, {1.04, 0.84}, {1.04, 0.86}, {1.04, \     0.88}, {1.04, 0.9}, {1.04, 0.92}, {1.04, 0.94}, {1.06, 0.76}, {1.06,          0.78}, {1.06, 0.8}, {1.06, 0.82}, {1.06, 0.84}, {1.06, 0.86}, {1.06, \     0.88}, {1.06, 0.9}, {1.06, 0.92}, {1.06, 0.94}, {1.08, 0.76}, {1.08, 0.78}, \     {1.08, 0.8}, {1.08, 0.82}, {1.08, 0.84}, {1.08, 0.86}, {1.08, 0.88}, {1.08, \     0.9}, {1.08, 0.92}, {1.08, 0.94}, {1.08, 0.96}, {1.1, 0.76}, {1.1, 0.78}, \     {1.1, 0.8}, {1.1, 0.82}, {1.1, 0.84}, {1.1, 0.86}, {       1.1, 0.88}, {1.1, 0.9}, {1.1, 0.92}, {1.1, 0.94}, {1.1,        0.96}, {1.12, 0.78}, {1.12, 0.8}, {1.12, 0.82}, {1.12,        0.84}, {1.12, 0.86}, {1.12, 0.88}, {1.12, 0.9}, {1.12,        0.92}, {1.12, 0.94}, {1.12, 0.96}, {1.12, 0.98}, {1.14,        0.78}, {1.14, 0.8}, {1.14, 0.82}, {1.14, 0.84}, {1.14, 0.86}, {1.14,          0.88}, {1.14, 0.9}, {1.14, 0.92}, {1.14, 0.94}, {1.14, 0.96}, {1.14, \     0.98}, {1.16, 0.78}, {1.16, 0.8}, {1.16, 0.82}, {1.16, 0.84}, {1.16,          0.86}, {1.16, 0.88}, {1.16,          0.9}, {1.16, 0.92}, {1.16, 0.94}, {1.16, 0.96}, {1.16, 0.98}, {1.18, \     0.78}, {1.18, 0.8}, {1.18, 0.82}, {1.18, 0.84}, {1.18, 0.86}, {1.18,          0.88}, {1.18, 0.9}, {1.18, 0.92}, {1.18, 0.94}, {       1.18, 0.96}, {1.18, 0.98}, {1.18, 1.}, {1.2, 0.8}, {1.2, 0.82}, {1.2, \     0.84}, {1.2, 0.86}, {1.2, 0.88}, {1.2, 0.9}, {1.2, 0.92}, {1.2, 0.94}, {1.2, \     0.96}, {1.2, 0.98}, {1.2, 1.}, {1.22, 0.8}, {1.22, 0.82}, {1.22, 0.84}, \     {1.22, 0.88}, {1.22, 0.9}, {1.22, 0.92}, {1.22, 0.94}, {1.22, 0.96}, {1.22, \     0.98}, {1.22, 1.}, {1.24, 0.8}, {       1.24, 0.82}, {         1.24, 0.84}, {1.24, 0.86}, {1.24, 0.88}, {1.24, 0.9}, {1.24, 0.92}, \     {1.24, 0.94}, {1.24, 0.96}, {1.24, 0.98}, {1.24, 1.}, {1.24, 1.02}, {         1.26, 0.8}, {1.26, 0.82}, {1.26, 0.84}, {1.26, 0.86}, {1.26,        0.88}, {1.26, 0.9}, {1.26,        0.92}, {1.26, 0.94}, {1.26, 0.96}, {1.26, 0.98}, {1.26, 1.}, {1.26,          1.02}, {1.28, 0.82}, {1.28, 0.84}, {1.28, 0.86}, {         1.28, 0.9}, {1.28, 0.92}, {1.28, 0.94}, {1.28, 0.96}, {         1.28, 0.98}, {1.28, 1.}, {1.28, 1.02}, {1.3, 0.82}, {1.3, 0.84}, {1.3,        0.86}, {1.3, 0.88}, {1.3,        0.9}, {1.3, 0.92}, {1.3,        0.94}, {1.3, 0.96}, {1.3, 0.98}, {1.3, 1.}, {1.3, 1.02}, {1.3,          1.04}, {1.32, 0.82}, {1.32, 0.84}, {1.32, 0.86}, {1.32,          0.88}, {1.32, 0.92}, {1.32, 0.94}, {1.32, 0.96}, {1.32, 0.98}, {1.32,        1.}, {1.32, 1.02}, {1.32, 1.04}, {         1.34, 0.82}, {1.34, 0.84}, {1.34, 0.86}, {1.34, 0.88}, {1.34, 0.92}, \     {1.34, 0.94}, {1.34, 0.96}, {1.34, 0.98}, {1.34, 1.}, {         1.34, 1.02}, {1.34, 1.04}, {1.34, 1.06}, {1.36, 0.84}, {         1.36, 0.86}, {1.36, 0.88}, {1.36, 0.94}, {1.36, 0.96}, {         1.36, 0.98}, {1.36, 1.}, {1.36, 1.02}, {1.36, 1.04}, {         1.36, 1.06}, {1.38, 0.84}, {1.38, 0.86}, {1.38, 0.88}, {         1.38, 0.9}, {1.38, 0.94}, {1.38, 0.96}, {1.38, 0.98}, {1.38, 1.}, {1.38, \     1.02}, {1.38, 1.04}, {1.38, 1.06}, {1.4, 0.84}, {1.4, 0.86}, {1.4,          0.88}, {1.4,        0.9}, {1.4, 0.94}, {1.4, 0.96}, {1.4, 0.98}, {1.4, 1.}, {1.4, 1.02}, {         1.4, 1.04}, {1.4, 1.06}, {1.4, 1.08}, {1.42, 0.86}, {         1.42, 0.88}, {1.42, 0.9}, {1.42, 0.96}, {       1.42, 0.98}, {1.42, 1.}, {1.42, 1.02}, {1.42, 1.04}, {1.42, 1.06}, {         1.42, 1.08}, {1.44, 0.86}, {1.44, 0.88}, {       1.44, 0.9}, {1.44, 0.96}, {1.44, 0.98}, {         1.44, 1.}, {1.44, 1.02}, {1.44, 1.04}, {1.44, 1.06}, {1.44, 1.08}, {1.44, \     1.1}, {1.46, 0.86}, {       1.46, 0.88}, {1.46, 0.9}, {1.46, 0.92}, {1.46, 0.98}, {1.46, 1.}, {         1.46, 1.02}, {1.46, 1.04}, {1.46, 1.06}, {1.46, 1.08}, {         1.46, 1.1}, {1.48, 0.86}, {1.48, 0.88}, {1.48, 0.9}, {         1.48, 0.92}, {1.48, 0.98}, {1.48, 1.}, {1.48, 1.02}, {         1.48, 1.04}, {1.48, 1.06}, {1.48, 1.08}, {1.48, 1.1}, {         1.5, 0.88}, {1.5, 0.9}, {1.5, 0.92}, {1.5,        1.}, {1.5,          1.02}, {1.5, 1.04}, {1.5, 1.06}, {1.5, 1.08}, {1.5, 1.1}, {1.5, 1.12}, \     {1.52, 0.88}, {1.52, 0.9}, {1.52, 0.92}, {1.52, 1.}, {1.52, 1.02}, {         1.52, 1.04}, {1.52, 1.06}, {1.52, 1.08}, {1.52, 1.1}, {1.52, 1.12}, \     {1.54, 0.78}, {1.54, 0.8}, {1.54, 0.82}, {1.54, 0.84}, {1.54, 0.9}, {         1.54, 0.92}, {1.54, 0.94}, {1.54, 1.02}, {1.54, 1.04}, {1.54, 1.06}, \     {1.54, 1.08}, {1.54, 1.1}, {1.54, 1.12}, {1.54,        1.14}, {1.56, 0.76}, {1.56, 0.78}, {         1.56, 0.8}, {1.56, 0.82}, {1.56, 0.84}, {1.56, 0.86}, {1.56, 0.9}, {1.56,        0.92}, {1.56, 0.94}, {1.56,        1.02}, {1.56, 1.04}, {1.56, 1.06}, {         1.56, 1.08}, {1.56, 1.1}, {1.56, 1.12}, {1.56, 1.14}, {1.58, 0.76}, \     {1.58, 0.78}, {1.58, 0.8}, {1.58, 0.82}, {1.58, 0.84}, {1.58, 0.86}, {         1.58, 0.88}, {1.58, 0.9}, {1.58, 0.92}, {1.58, 0.94}, {1.58, 1.04}, \     {1.58, 1.06}, {1.58, 1.08}, {1.58, 1.1}, {1.58, 1.12}, {1.58,        1.14}, {1.58, 1.16}, {1.6, 0.76}, {1.6, 0.78}, {1.6,        0.8}, {1.6,          0.82}, {1.6, 0.84}, {1.6, 0.86}, {1.6, 0.88}, {1.6, 0.9}, {1.6, 0.92}, {       1.6, 0.94}, {1.6, 1.04}, {       1.6, 1.06}, {1.6, 1.08}, {1.6, 1.1}, {1.6, 1.12}, {1.6,        1.14}, {1.6, 1.16}, {1.62, 0.76}, {1.62, 0.78}, {1.62,        0.8}, {1.62, 0.82}, {1.62, 0.84}, {1.62, 0.86}, {1.62,        0.88}, {1.62, 0.9}, {1.62, 0.96}, {1.62, 1.06}, {1.62,        1.08}, {1.62, 1.1}, {1.62, 1.12}, {1.62, 1.14}, {1.62, 1.16}, {1.64,          0.78}, {1.64, 0.8}, {1.64, 0.82}, {         1.64, 0.84}, {1.64, 0.86}, {1.64, 0.88}, {1.64, 0.9}, {       1.64, 0.92}, {1.64, 0.98}, {1.64, 1.}, {1.64, 1.14}, {       1.64, 1.16}, {1.64, 1.18}, {       1.66, 0.78}, {         1.66, 0.8}, {1.66, 0.82}, {1.66, 0.84}, {1.66, 0.86}, {1.66, 0.88}, \     {1.66, 0.9}, {1.66, 0.92}, {1.66, 0.98}, {1.66, 1.}, {       1.66, 1.02}, {         1.66, 1.04}, {1.66, 1.06}, {1.66, 1.16}, {1.66, 1.18}, {1.66, 1.52}, \     {1.66, 1.54}, {1.66, 1.56}, {1.68, 0.8}, {1.68, 0.82}, {1.68, 0.84}, {1.68, \     0.86}, {1.68, 0.88}, {1.68, 0.9}, {1.68, 0.92}, {1.68, 1.}, {       1.68, 1.02}, {         1.68, 1.04}, {1.68, 1.06}, {1.68, 1.16}, {1.68, 1.18}, {1.68, 1.2}, \     {1.68, 1.52}, {1.68, 1.54}, {1.68, 1.56}, {1.68, 1.58}, {1.68, 1.6}, {1.68, \     1.62}, {1.68, 1.64}, {1.68, 1.66}, {1.68, 1.68}, {1.68, 1.7}, {1.68, 1.72}, \     {1.7, 0.8}, {1.7, 0.82}, {1.7, 0.84}, {1.7, 0.86}, {         1.7, 0.88}, {1.7, 0.9}, {1.7, 0.92}, {1.7,        0.94}, {1.7, 1.}, {1.7, 1.02}, {1.7, 1.04}, {1.7, 1.06}, {1.7, 1.08}, {         1.7, 1.18}, {1.7, 1.2}, {1.7, 1.52}, {1.7, 1.54}, {1.7, 1.56}, {1.7, \     1.58}, {1.7, 1.6}, {1.7, 1.62}, {1.7, 1.64}, {1.7, 1.66}, {1.7,        1.68}, {1.7, 1.7}, {1.7, 1.72}, {1.7, 1.74}, {1.7, 1.76}, {1.7,        1.78}, {1.7, 1.8}, {1.72, 0.82}, {1.72, 0.84}, {1.72,        0.86}, {1.72, 0.88}, {1.72, 0.9}, {1.72, 0.92}, {1.72, 0.94}, {         1.72, 1.}, {1.72, 1.02}, {1.72, 1.04}, {1.72, 1.06}, {1.72, 1.08}, {1.72, \     1.2}, {1.72, 1.22}, {1.72, 1.52}, {1.72, 1.54}, {1.72, 1.56}, {         1.72, 1.58}, {1.72, 1.6}, {1.72, 1.62}, {1.72, 1.64}, {1.72, 1.66}, {       1.72, 1.68}, {1.72, 1.7}, {1.72, 1.72}, {1.72, 1.74}, {1.72, 1.76}, {         1.72, 1.78}, {1.72, 1.8}, {1.72, 1.82}, {1.72, 1.84}, {1.74, 0.82}, {       1.74, 0.84}, {1.74, 0.86}, {       1.74, 0.88}, {1.74, 0.9}, {1.74, 0.92}, {1.74, 0.94}, {1.74, 1.02}, {         1.74, 1.04}, {1.74, 1.06}, {1.74, 1.08}, {1.74, 1.1}, {         1.74, 1.2}, {1.74, 1.22}, {1.74, 1.52}, {1.74, 1.54}, {         1.74, 1.56}, {1.74, 1.58}, {1.74, 1.6}, {1.74, 1.62}, {1.74, 1.64}, {       1.74, 1.66}, {1.74, 1.68}, {1.74, 1.7}, {1.74, 1.72}, {1.74, 1.74}, {1.74, \     1.76}, {1.74, 1.78}, {1.74, 1.8}, {1.74, 1.82}, {1.74, 1.84}, {1.74, 1.86}, \     {1.74, 1.88}, {1.76, 0.84}, {1.76, 0.86}, {1.76, 0.88}, {1.76, 0.9}, {1.76, \     0.92}, {1.76, 0.94}, {1.76, 0.96}, {1.76, 1.02}, {1.76, 1.04}, {1.76, 1.06}, \     {1.76, 1.08}, {1.76, 1.1}, {1.76, 1.22}, {1.76, 1.24}, {       1.76, 1.52}, {1.76, 1.54}, {       1.76, 1.56}, {         1.76, 1.58}, {1.76, 1.6}, {1.76, 1.62}, {1.76, 1.64}, {1.76, 1.66}, \     {1.76, 1.68}, {1.76, 1.7}, {1.76, 1.72}, {1.76, 1.74}, {       1.76, 1.76}, {1.76, 1.78}, {       1.76, 1.8}, {1.76, 1.82}, {1.76, 1.84}, {         1.76, 1.86}, {1.76, 1.88}, {1.76, 1.9}, {1.78, 0.86}, {1.78, 0.88}, {       1.78, 0.9}, {1.78, 0.92}, {1.78, 0.94}, {1.78, 0.96}, {1.78, 1.02}, {         1.78, 1.04}, {1.78, 1.06}, {1.78, 1.08}, {1.78, 1.1}, {1.78, 1.12}, {       1.78, 1.24}, {1.78, 1.52}, {1.78, 1.54}, {1.78, 1.56}, {       1.78, 1.58}, {         1.78, 1.6}, {1.78, 1.62}, {1.78, 1.64}, {1.78, 1.66}, {1.78, 1.68}, \     {1.78, 1.7}, {1.78, 1.72}, {1.78, 1.74}, {1.78, 1.76}, {1.78, 1.78}, {1.78, \     1.8}, {1.78, 1.82}, {1.78, 1.84}, {1.78, 1.86}, {1.78, 1.88}, {1.78, 1.9}, \     {1.78, 1.92}, {1.8, 0.86}, {1.8, 0.88}, {1.8, 0.9}, {1.8, 0.92}, {         1.8, 0.94}, {1.8, 0.96}, {1.8, 1.04}, {1.8,        1.06}, {1.8,          1.08}, {1.8, 1.1}, {1.8, 1.12}, {1.8, 1.24}, {1.8, 1.52}, {1.8, 1.54}, \     {1.8, 1.56}, {1.8, 1.58}, {1.8, 1.6}, {1.8, 1.62}, {1.8, 1.64}, {       1.8, 1.66}, {1.8, 1.68}, {1.8, 1.7}, {1.8, 1.72}, {1.8, 1.74}, {1.8, 1.76}, \     {1.8, 1.78}, {1.8, 1.8}, {1.8, 1.82}, {1.8, 1.84}, {       1.8, 1.86}, {1.8, 1.88}, {1.8, 1.9}, {1.8, 1.92}, {1.8, 1.94}, {1.82, \     0.88}, {1.82, 0.9}, {1.82, 0.92}, {1.82, 0.94}, {1.82, 0.96}, {1.82,          0.98}, {1.82,        1.04}, {1.82, 1.06}, {1.82, 1.08}, {1.82, 1.1}, {1.82, 1.12}, {         1.82, 1.14}, {       1.82, 1.26}, {1.82, 1.52}, {1.82, 1.54}, {1.82, 1.56}, {1.82, 1.58}, {1.82,        1.6}, {1.82, 1.62}, {1.82, 1.64}, {1.82, 1.66}, {1.82,        1.68}, {         1.82, 1.7}, {1.82, 1.72}, {1.82, 1.74}, {1.82, 1.76}, {1.82, 1.78}, \     {1.82, 1.8}, {1.82, 1.82}, {1.82, 1.84}, {1.82, 1.86}, {1.82, 1.88}, {         1.82, 1.9}, {1.82, 1.92}, {1.82, 1.94}, {1.82, 1.96}, {1.84, 0.88}, \     {1.84, 0.9}, {1.84, 0.92}, {1.84, 0.94}, {1.84, 0.96}, {1.84,        0.98}, {1.84, 1.06}, {1.84, 1.08}, {         1.84, 1.1}, {1.84, 1.12}, {1.84, 1.14}, {1.84, 1.52}, {1.84, 1.54}, \     {1.84, 1.56}, {1.84, 1.58}, {1.84, 1.6}, {1.84, 1.62}, {1.84,        1.64}, {1.84, 1.66}, {1.84, 1.68}, {1.84, 1.7}, {1.84,        1.72}, {1.84, 1.74}, {1.84, 1.76}, {1.84, 1.78}, {1.84, 1.8}, {1.84,          1.82}, {1.84, 1.84}, {1.84, 1.86}, {1.84, 1.88}, {1.84, 1.9}, {1.84,        1.92}, {1.84, 1.94}, {1.84, 1.96}, {1.86, 0.9}, {1.86,        0.92}, {1.86, 0.94}, {1.86, 0.96}, {1.86, 0.98}, {1.86,        1.06}, {1.86, 1.08}, {1.86,        1.1}, {1.86,          1.12}, {1.86, 1.14}, {1.86, 1.16}, {1.86, 1.52}, {1.86, 1.54}, {1.86, \     1.56}, {1.86, 1.58}, {1.86, 1.6}, {1.86, 1.62}, {1.86, 1.64}, {         1.86, 1.66}, {1.86, 1.68}, {1.86, 1.7}, {1.86, 1.72}, {1.86, 1.74}, {       1.86, 1.76}, {1.86, 1.78}, {1.86, 1.8}, {1.86, 1.82}, {1.86,          1.84}, {1.86, 1.86}, {1.86, 1.88}, {1.86,        1.9}, {1.86, 1.92}, {1.86, 1.94}, {1.88, 0.9}, {1.88, 0.92}, {         1.88, 0.94}, {1.88, 0.96}, {1.88, 0.98}, {1.88, 1.}, {1.88, 1.08}, {1.88,          1.1}, {1.88, 1.12}, {1.88, 1.14}, {1.88, 1.16}, {1.88,          1.18}, {1.88, 1.52}, {1.88, 1.54}, {1.88, 1.56}, {1.88, 1.58}, {1.88,        1.6}, {1.88, 1.62}, {1.88, 1.64}, {1.88, 1.66}, {1.88,        1.68}, {1.88, 1.7}, {1.88, 1.72}, {1.88, 1.74}, {1.88,        1.76}, {1.88, 1.78}, {1.88, 1.8}, {1.88, 1.82}, {1.88, 1.84}, {         1.88, 1.86}, {1.88, 1.88}, {1.88, 1.9}, {1.88, 1.92}, {         1.88, 1.94}, {1.9, 0.92}, {1.9, 0.94}, {1.9, 0.96}, {1.9, 0.98}, {1.9,        1.}, {1.9,          1.08}, {1.9, 1.1}, {1.9, 1.12}, {1.9, 1.14}, {1.9, 1.16}, {1.9, 1.18}, \     {1.9, 1.52}, {1.9, 1.54}, {1.9, 1.56}, {1.9, 1.58}, {1.9, 1.6}, {1.9, 1.62}, \     {1.9, 1.64}, {1.9, 1.66}, {1.9, 1.68}, {1.9, 1.7}, {1.9, 1.72}, {1.9, 1.74}, {         1.9, 1.76}, {1.9, 1.78}, {1.9, 1.8}, {1.9, 1.82}, {1.9, 1.84}, {1.9,        1.86}, {1.9, 1.88}, {1.9, 1.9}, {1.9, 1.92}, {1.92, 0.92}, {1.92,          0.94}, {1.92, 0.96}, {1.92, 0.98}, {1.92, 1.}, {1.92, 1.02}, {1.92,        1.1}, {1.92, 1.12}, {1.92, 1.14}, {1.92, 1.16}, {       1.92, 1.18}, {1.92, 1.2}, {1.92, 1.32}, {1.92, 1.5}, {1.92, 1.52}, {1.92, \     1.54}, {1.92, 1.56}, {1.92, 1.58}, {1.92, 1.6}, {1.92,        1.62}, {1.92, 1.64}, {1.92, 1.66}, {1.92, 1.68}, {1.92, 1.7}, {         1.92, 1.72}, {       1.92, 1.74}, {1.92, 1.76}, {1.92, 1.78}, {1.92, 1.8}, {1.92, 1.82}, {1.92,        1.84}, {1.92, 1.86}, {1.92,        1.88}, {1.92, 1.9}, {1.94, 0.94}, {1.94, 0.96}, {1.94, 0.98}, {1.94,        1.}, {1.94, 1.02}, {1.94, 1.1}, {1.94, 1.12}, {1.94,        1.14}, {1.94, 1.16}, {1.94, 1.18}, {         1.94, 1.2}, {1.94, 1.34}, {1.94, 1.5}, {1.94, 1.52}, {1.94, 1.54}, {1.94,        1.56}, {1.94, 1.58}, {1.94,        1.6}, {1.94, 1.62}, {1.94, 1.64}, {1.94, 1.66}, {1.94,          1.68}, {1.94, 1.7}, {1.94, 1.72}, {1.94, 1.74}, {1.94, 1.76}, {         1.94, 1.78}, {1.94, 1.8}, {1.94, 1.82}, {1.94, 1.84}, {1.94, 1.86}, \     {1.94, 1.88}, {1.96, 0.94}, {1.96, 0.96}, {         1.96, 0.98}, {1.96, 1.}, {1.96, 1.02}, {1.96, 1.14}, {1.96, 1.16}, {1.96, \     1.18}, {1.96, 1.2}, {1.96,        1.22}, {1.96, 1.34}, {1.96, 1.36}, {         1.96, 1.5}, {1.96, 1.52}, {1.96, 1.54}, {1.96, 1.56}, {1.96, 1.58}, \     {1.96, 1.6}, {1.96, 1.62}, {1.96,        1.64}, {1.96, 1.66}, {1.96, 1.68}, {         1.96, 1.7}, {1.96, 1.72}, {1.96, 1.74}, {1.96, 1.76}, {1.96, 1.78}, \     {1.96, 1.8}, {1.96, 1.82}, {1.96, 1.84}, {1.98, 0.96}, {1.98,        0.98}, {1.98, 1.}, {1.98, 1.02}, {1.98, 1.04}, {1.98,        1.12}, {1.98,          1.18}, {1.98, 1.2}, {1.98, 1.22}, {1.98, 1.36}, {1.98, 1.38}, {1.98, \     1.48}, {1.98, 1.5}, {1.98,        1.52}, {1.98, 1.54}, {1.98, 1.56}, {1.98, 1.58}, {1.98, 1.6}, {         1.98, 1.62}, {       1.98, 1.64}, {         1.98, 1.66}, {1.98, 1.68}, {1.98, 1.7}, {1.98, 1.72}, {1.98, 1.74}, \     {1.98, 1.76}, {1.98, 1.78}, {1.98, 1.8}, {2., 0.98}, {2., 1.}, {2.,          1.02}, {2., 1.04}, {2., 1.14}, {2., 1.26}, {2., 1.28}, {2., 1.3}, {2.,        1.32}, {2., 1.34}}


Statistical analysis of a data file and its Plot

As the title says, I have an external data file which contains thousands lines of data. The data file contains eight columns and here is what I would like to plot: Let's assume that the length of the file is $N_0$.               N0=Length[data];      Now, some statistical analysis: if the seventh column is non zero (in other words, either 1 or 2), plot $\rm log_{10}(N/N_0)$ as a function of $n$, where $n$ is the integer of the eight column and $N$ is the number of lines inside the date file that have non zero seventh column and the respective values $n$ of the eight column. This is a rather complicated aspect, so I hope I explained correctly and clear what I want to plot. Nevertheless, if there is any confusing issue, please ask for additional details. Here is a small sample of the data file:               data1={{-0.63, -0.05, 0.607293, -1.01899, 244.7, 8.9221*10^-10, 2, 33},      {-0.63, -0.04, 0.750888, -0.914848, 99.06, 0.00192017, 2, 13},      {-0.63, -0.03, 0.866068, -0.807778, 240.9, 8.3753*10^-11, 2, 30},      {-0.63, -0.02, 0.5362, -1.05766, 105.95, 0.0000915176, 2, 14},      {-0.63, -0.01, 0.818972, -0.85418, 109.99, 7.34825*10^-8, 2, 14},      {-0.63, 0., 0.644631, 0.994565, 75.04, 0.0000214851, 1, 10},      {-0.63, 0.01, 0.678989, 0.972796, 131.81, 0.000396984, 1, 19},      {-0.63, 0.02, 0.572168, 1.03831, 212.27, 2.26474*10^-9, 1, 31},      {-0.63, 0.03, 0.593172, 1.02434, 125.65, 0.000119734, 1, 18},      {-0.63, 0.04, 0.620368, 1.00784, 80.25, 0.302882, 1, 11},      {-0.07, 0.47, 0.687758, 0.963341, 2.71, 1.07464, 1, 0},       {-0.07,0.48, 0.680021, 0.973429, 2.76, 1.10912, 1, 0},       {-0.07, 0.49, 0.668844, 0.980709, 2.81, 1.1496, 1, 0},       {-0.07, 0.5, 0.654742, 0.989591, 2.87, 1.19496, 1, 251},       {-0.07, 0.51, 0.636733, 0.999036, 2.94, 1.24555, 0, 72},       {-0.07, 0.52, 0.614364, 1.01248, 3.03, 1.29982, 1, 0},       {-0.07, 0.53, 0.586779, 1.03184, 3.15, 1.35616, 1, 0},      {-0.07, 0.54, 0.552593, 1.05116, 3.3, 1.41155, 0, 30},       {-0.07, 0.55, 0.512858, 1.06758, 3.5, 1.33486, 1, 0},      {-0.07, 0.56, 0.48694, 1.08078, 3.84, 1.17199, 1, 27}}      The complete data file can be obtained from here: data. Many thanks in advance. I have not tried anything, simply because I have no idea where and how to start. This however, should be quiet easy for a list- manipulation guru! **EDIT** Let me explain more what I want to plot. The seventh column has three options 0,1,2 and the last column contains only integers whose values go from zero to an unknown maximum value. I want to plot $\rm log_{10}(N/N_0)$ as function of $n$, in other words how $\rm log_{10}(N/N_0)$ evolves for every value of $n$ $(n = 1, n = 2, n = 3, ....., n = n_{max})$ when the corresponding seventh column is non zero (1 or 2). **EDIT 2** The final plot should be look like the following plot. The data file correspond to the darker green line (0.20). ![enter image description here](http://i.stack.imgur.com/uExGr.png)


How do I fill the area from 0 to pi in my Sine wave and in the process get the area value?

I am new to Mathematica and I tried searching the docs but no specific examples there. This is what I have achieved so far, returns an error, probably wrong syntax.               Plot[ Sin[x], {x, 0, 2 Pi}, Filling -> Range {x, 0, Pi}]


Replacing product expressions - named vs. unnamed pattern?

Suppose I have an expression of the form               a b c d + x y z      The `FullForm` of this is               Plus[Times[a,b,c,d], Times[x,y,z]]      Now suppose I want to set all expressions containing the product b*c to zero. The naive way of doing this is               a b c d + x y z /. Times[___, b, c, ___] -> 0      However, this doesn't work - nothing is replaced. (Background info: I'm expanding some term using `Series`, and would like to cancel out all products dx*dy, so that only first-order terms remain.) Even more confusing: if I don't use `Times` but a generic function `f` it works - even when I assign all the attributes of `Times` to `f`!               f;     SetAttributes[f, #]& /@ Attributes[Times];     Attributes[f]     f[a, b, c, d] /. f[___, b, c, ___] -> 0          ==>     {Flat, Listable, NumericFunction, OneIdentity, Orderless, Protected}     0      (If you evaluate this use a new kernel, as `f` will be `Protected`.) So: how do I replace expressions containing some product*? *: Assuming the order of the arguments is known. Don't worry about the fact that the expression for b might be on the left of the one for a; solving this would be another question.


Dialog inside Dynamic Module

The following doesn't appear to work:               DynamicModule[{}, Button["Press Me", ChoiceDialog["OK or Cancel?"]]]      When I press the button labelled "Press Me", a dialog window appears, but without buttons, and then Mathematica hangs. Is this a bug, or am I attempting something that can't or shouldn't be done inside a Dynamic Module? In either case, does anyone know of a workaround? ( In my real code, I have a button-initiated process inside a dynamic module for which I want to get user confirmation ).


How to define a differential operator?

I have a linear differential operator, for instance, $L\left (\partial _{t} \right )=\partial _{tt} - 3\partial _{t} + 2$. I use it in 2 different ways:   * apply the operator to a function: $L\left (\partial _{t} \right )\sin(t)=-\sin(t)-3\cos(t)+2\sin(t)=\sin(t)-3\cos(t)$   * find roots of the polynomial $L(p)=0$, in this case $p=1,p=2$ What is the best way to define such operator?


Optimization of vector manipulation

I'm trying to implement an upwind scheme for solving transport equation (at first, I work with no right hand side and the simpliest case possible - velocity is constant, initial data is smooth, etc). I have $$\partial_tf+\frac 1\varepsilon\partial_x f=0,\quad t>0,\quad x\in (0,1)$$ with initial and boundary data $$f(0,x)=f_{in}(x), \quad f(t,0)=0.$$ The classic explicit upwind scheme writes $$f(n+1,0)=0.$$ $$f(n+1,j)=f(n,j)\left(1-\frac{\Delta t}{\varepsilon \Delta x}\right)f(n,j)+\frac{\Delta t}{\varepsilon \Delta x}f(n,j-1)$$ With CFL (stability) condition $0\le \frac{\Delta t}{\varepsilon \Delta x}<1 $. So, I write               HatFunction[x_] := If[Abs[x] < 1, Exp[1/(x^2 - 1)], 0];     InitialFunction[x_] := HatFunction[(x - 1/2)*6];(*initial data*)          n = 100;(*epsilon = 1/n; dx = 1/n, dt = 1/2n^2 , we want to have 2n^2 \     iterations*)     dx = 1/n;     eps = 1/n;     dt = 1/2/n^2;          InitData = ConstantArray[0, n + 1];     For[i = 1, i <= n + 1, i++,        InitData[[i]] = InitialFunction[(i - 1)/n]];          ccenter = ConstantArray[1 - dt/dx/eps, n + 1];     coffset = ConstantArray[dt/eps/dx, n + 1]; (*coefficients in the numerical scheme. *)     (*Here they're constant, but that will change in more complex models*)          Points = InitData;     For[i = 1, i <= n + 1, i++, Points[[i]] = (i - 1)/n]; (*coordinates of points in our mesh*)          Fp = InitData; (*Fp is the numerical solution*)               Niter = 10; (*number of iterations*)     Do[       Fp = Fp*ccenter+RotateRight[Fp]*coffset;Fp[[1]]=0,           {Niter}];     ListPlot[{Transpose[{Points, Fp}]}, Joined -> True]      The problem arises when I want to increase the number of iterations (after all, in order to get an approximate solution at time $T=1$ we want to make $2n^2$ iterations). If I set `Niter=10`, then everything works fine and the final plot is built instantly (didn't time it). However, if I set `Niter=20` (or something bigger), then the evaluation wouldn't finish (I waited 5 minutes then aborted it), while the common sense suggests that the execution time should be linear with respect to the number of iterations. Is there a way to improve the performance of this code? To optimize the list manipulation? I'll be glad to hear all suggestions.


Multiple ListLogLogPlot from two data sets

I am trying to show the full plots from two set of data on the graph, but as can be seen the lower limit of one plot is chopped off![enter image description here](http://i.stack.imgur.com/XOT9U.png). How do you get full view of both plots, with x minimum placed at 0.02?               Show[ListLogLogPlot[data2, PlotStyle -> {Blue, Thick},        PlotTheme -> "Detailed", Joined -> True,        LabelStyle -> Directive[Bold, Large], AxesOrigin -> {0.02, 0},        Frame -> True, PlotRange -> {Full, All}],         ListLogLogPlot[data1, PlotStyle -> {Blue, Thick},        PlotTheme -> "Detailed", Joined -> True,        LabelStyle -> Directive[Bold, Large], AxesOrigin -> {0.02, 0},        Frame -> True, PlotRange -> {Full, All}]]      data1= {{0.020024338, 0.0006898460868074602}, {0.022380134, 0.0008222211281134352}, {0.024735928, 0.0009798403395959478}, {0.027091718, 0.0011277386823632257}, {0.029447506, 0.001287650013883181}, {0.031803289, 0.0014408678900920552}, {0.034159069, 0.0016160163501166731}, {0.036514845, 0.0017849655926368134}, {0.038870616, 0.0019609711155541072}, {0.041226383, 0.002163665248453372}, {0.043582144, 0.002348722618246531}, {0.0459379, 0.002494118081198361}, {0.048293651, 0.0027189360726542905}, {0.050649396, 0.002890344109549366}, {0.053005134, 0.00308609501146371}, {0.055360866, 0.0032756176392236772}, {0.057716592, 0.0034527839522427227}, {0.06007231, 0.0036393851282367053}, {0.062428021, 0.003814914813351725}, {0.064783725, 0.003991495211267792}, {0.06713942, 0.004193356042611242}, {0.069495108, 0.004347850320821656}, {0.071850787, 0.004558769934960127}, {0.074206457, 0.004709256362951678}, {0.076562119, 0.004907805739612362}, {0.078917771, 0.005021310792831887}, {0.081273413, 0.005215178112302661}, {0.083629045, 0.005339973505995938}, {0.085984668, 0.005528800593303607}, {0.08834028, 0.005668827916130827}, {0.090695881, 0.0057706688742881415}, {0.093051471, 0.005949966432781134}, {0.09540705, 0.00604459764249459}, {0.097762617, 0.006197882035914605}, {0.10011817, 0.006271995639457581}, {0.10247372, 0.006405720497387288}, {0.10482925, 0.006479920911483725}, {0.10718476, 0.00660650821981006}, {0.10954027, 0.006672242838959252}, {0.11189576, 0.006817059539222547}, {0.11425124, 0.006907264305529506}, {0.1166067, 0.007002603109893158}, {0.11896215, 0.007081107878571615}, {0.12131759, 0.007151235578737916}, {0.12367301, 0.007228141122266792}, {0.12602842, 0.007292298578139804}, {0.12838381, 0.0073299493627207385}, {0.13073918, 0.00739858167168394}, {0.13309454, 0.007510978536398175}, {0.13544988, 0.00760847199922202}, {0.13780521, 0.007544074863000653}, {0.14016052, 0.0076105707308896375}}; data2 = {{0.020024338, 0.007685848099917109}, {0.022380134, 0.008013449957524992}, {0.024735928, 0.008306098008526386}, {0.027091718, 0.008560896029885981}, {0.029447506, 0.00880745615391358}, {0.031803289, 0.009248339043114036}, {0.034159069, 0.009782487939313599}, {0.036514845, 0.010345832941871655}, {0.038870616, 0.011113809369050385}, {0.041226383, 0.011874557973390829}, {0.043582144, 0.012872539519762381}, {0.0459379, 0.013835602111955498}, {0.048293651, 0.014887746343237473}, {0.050649396, 0.015785394779266458}, {0.053005134, 0.0165642067516995}, {0.055360866, 0.016999450787037237}, {0.057716592, 0.017014052764149582}, {0.06007231, 0.016734562545381238}, {0.062428021, 0.016069682185080734}, {0.064783725, 0.015031834901125234}, {0.06713942, 0.013839656266037103}, {0.069495108, 0.01257969547079863}, {0.071850787, 0.011491569688389006}, {0.074206457, 0.010510929745291489}, {0.076562119, 0.009686346759612252}, {0.078917771, 0.008863853826819992}, {0.081273413, 0.008156681447299127}, {0.083629045, 0.007561007783617579}, {0.085984668, 0.0070605580695412}, {0.08834028, 0.006621329915210725}, {0.090695881, 0.006275814238247226}, {0.093051471, 0.006000914851069818}, {0.09540705, 0.0057212432986298856}, {0.097762617, 0.005553674274131074}, {0.10011817, 0.005357777593168054}, {0.10247372, 0.005229874217954748}, {0.10482925, 0.005105247381949845}, {0.10718476, 0.005074708465411825}, {0.10954027, 0.0049336308402372795}, {0.11189576, 0.004871110936303876}, {0.11425124, 0.004871859818927847}, {0.1166067, 0.0048258933894099075}, {0.11896215, 0.004768585775053847}, {0.12131759, 0.0047833895145830896}, {0.12367301, 0.004721254232423347}, {0.12602842, 0.004760666810956435}, {0.12838381, 0.004693520058931346}, {0.13073918, 0.004739975744110606}, {0.13309454, 0.004693899534401102}, {0.13544988, 0.004672903298580988}, {0.13780521, 0.004719793331953254}, {0.14016052, 0.004704144869921119}};


Graphics can't be live and editable

Is there a way to construct an interface so that the Code and the Graphics remain in sync? For example I would like to be able to drag/drop and move around different shapes in Graphic while seeing the code change. Then I would like to edit the code so the graphic changes. **Updated image to clarify interface** ![enter image description here](http://i.stack.imgur.com/ts4uX.png) I'm aware that you can see the graphics source by hitting `Ctrl`+`Shift`+`E`, but this isn't ideal because the graphics source code is often in the displayform and much more verbose. Additionally it doesn't allow me to see how the code changes while I am editing the code. I'm working on some code that uses dynamic currently, but I'm not sure of the right technique just yet. **EDIT:** **Both the`InputField` and the `Graphics` should be live and editable. The problem currently is that the the `Graphics` elements can't seem to be Dynamic. If you set it as Dynamic it is impossible to re size and move the elements around.**


Integration of DiracDelta

I just came across the following curiosity and I'm not sure whether it's a bug or just me missing something. Here's a minimal example: I defined the following "function" ` In[1]:= S[x_, y_, z_] := DiracDelta[x^2 + y^2 + z^2 - 1]; ` which is supposed to parametrize the surface of a unit sphere. However, when I integrate over the entire space (x,y,z $\in$ [-2,2] should do) I get $2\pi$ as a result ` In[2]:= Integrate[S[x, y, z], {x, -2, 2}, {y, -2, 2}, {z, -2, 2}] Out[2]:= 2 Pi ` Shouldn't this be rather 4$\pi$?


Cannot install prebuilt cddmathlink on mathematica

I'm trying to use some functions from cddlib in _Mathematica_. I downloaded the prebuilt file `cddmathlink2` and `cddmathlink2gmp` from $\quad \quad$http://www.cs.mcgill.ca/~fukuda/download/cdd/cddlibml_binary/ and followed the instructions to install it. But evaluation never stops. I tried some simple prebuilt examples given by _Mathematica_ itself and they worked for me. Any suggestions? P.S. I'm not good at programming. I also tried to build a mathlink program by myself from cddlib, but I failed. So suggestions on the prebuilt files are most welcome.


How to obtain sheared text label effects?

How to make the text labels of 3D plots look always like coplanar with the specific axes planes no matter how the viewpoint/view angle changes? Here is an example of such effect: ![example](http://i.stack.imgur.com/GDYiI.png)


Use Euler method to solve differential equation

1. Use _Euler's Method_ or the _Modified Euler's_ to solve the differential equation ${dy/dt=y^2+t^2-1, y(-2)=-2}$ on $[- 2, 2]$. Take `h = 0.2` (`n = 20` iterations).   2. See if _Mathematica_ will give an analytic solution to this problem.  If it does compare the analytic solution found in Problems 1 and 2. If _Mathematica_ will not give an analytic solution, compare your solutions to the numerical solution on $[-2, 2]$ given by _Mathematica_. For the first problem, I am confused of the interval is not $[0,2]$ but $[-2,2]$ I have no idea with these two problems, can anyone help me?


Pack Solve results into a vector

I am currently using a really easy function to get the eigenvectors of a corresponding eigenspace:               Eigenspace[mat_, ev_] :=         Solve[            (mat - IdentityMatrix[Part[Dimensions[mat], 1]] * ev) .                Table[Subscript[x, i], {i, Part[Dimensions[mat], 1]}]            == Table[0, {i, Part[Dimensions[mat], 1]}        ]     ]      where `ev` is the representation of one eigenvalue $\lambda$ of the matrix $A$. So this is basically my first function I ever wrote based on the knowledge that $E_\lambda=\ker(A-I_n\cdot\lambda)$. My example matrix is $$C=\frac{1}{49}\cdot \left( \begin{array}{ccc} 9 & -48 & 4 \\ 36 & 4 & -33 \\ 32 & 9 & 36 \\ \end{array} \right)$$ and I can compute `Eigenspace[C, 1]` and get $\left\{\left\{x_1\to \frac{x_3}{2},x_2\to -\frac{x_3}{3}\right\}\right\}$ and I do substitute $x_3$ as it is a free parameter with `Eigenspace[C, 1] /. Subscript[x, 3] -> 1` and get $\left\{\left\{x_1\to \frac{1}{2},x_2\to -\frac{1}{3}\right\}\right\}$. How can I now return with my function the appropriate eigenvector $(1/2,\;-1/3,\; 1)^T$?


What is the proper way to operate on interpolating functions?

I am trying to multiply an interpolating function by -1. If I do this Mathematica does not seem to allow any further operations. Bear with me while I generate the Interpolating Function in question. It is a derivative of the output of NDSolve.               Clear["Global`*"];     Remove["Global`*"];     center = Rectangle[{-.1, -.1}, {.1, .1}];     shield = Rectangle[{-1, -1}, {1, 1}];     reg = RegionDifference[shield, center];     uif = NDSolveValue[{\!\(         \*SubsuperscriptBox[\(\[Del]\), \({x, y}\), \(2\)]\(u[x, y]\)\) == 0,         DirichletCondition[u[x, y] == 0, x^2 + y^2 >= .5],         DirichletCondition[u[x, y] == 1, x^2 + y^2 < .5]},u, {x, y} \[Element] reg]          partialx = Derivative[1, 0][uif];     NIntegrate[partialx[.5, y], {y, -.5, .5}, AccuracyGoal -> 3]     Plot[partialx[x, -.5], {x, -1, 1}]      At this point everything is fine. NIntegrate and Plot work. However, this code does not work.               partialxneg = -1*Derivative[1, 0][uif];     NIntegrate[partialxneg[.5, y], {y, -.5, .5}, AccuracyGoal -> 3]     Plot[partialxneg[x, -.5], {x, -1, 1}]      NIntegrate fails with > The integrand (-InterpolatingFunction[{{-1., 1.}, {-1., 1.}}, {4, 4225, 0, > {1320, 0}, {3, 3}, {1 ,0}, 0, 0, 0, Automatic, {}, {}, False}, > {NDSolve`FEM`ElementMesh[{{-1., -1.}, {-1., -0.875}, <<47>>, {0.875, -1.}, > <<1270>>}, <<2>>, {<<24>>[{{<<1>>}, <<49>>, <<94>>}]}]}, {0., 0., 0., 0., > 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., > 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., > 0., 0., 0., 0.,0., 0., 0., 0., <<1270>>}, {Automatic}])[<<1>>] has evaluated > to non-numerical values for all sampling points in the region with > boundaries {{-0.5, 0.5}}. >> Also, Plot does not plot anything. All I did was multiply the derivative by -1.


How to split a list with respect to its nested sublists?

I have a problem with the following task: having some nested list               list = {{k6},{k1,k3,k5},{k7}}      I would like to replace all sublists by their permutations and then split original list w.r.t. these permutations. So I started with permutations               list1 = {{{k6}},{{k1,k3,k5},{k1,k5,k3},{k3,k1,k5},{k3,k5,k1},{k5,k1,k3},{k5,k3,k1}},{{k7}}}      but I got stuck at this point - how to split this list w.r.t. sublists, i.e. to get:               list2 = {{{{k6}},{{k1,k3,k5}},{{k7}}},{{{k6}},{{k1,k5,k3}},{{k7}}},...}      Then I would like also to obtain a list of the form               {{k6,k1,k3,k5,k7},{k6,k1,k5,k3,k7},...}      Perhaps there is a simpler method to do this? Obviously, if e.g.               list = {{k6},{k1,k3},{k2,k5},{k7}}      then the splitting should give list with all combinations of permutations of `{k1,k3}` and `{k2,k5}` taken into account preserving original order.


How can I enhance ImageCompose to blend multiple layers?

Blend modes (or Mixing modes) in digital image editing are used to determine how two layers are blended into each other. Version 8 has functionality to perform binary and basic alpha blending but nothing for the other standard blend modes (ImageCompose only works with two layers). So the question is: How can I extend ImageCompose to work with multiple layers with masks in any the standard modes such as Dissolve, Darken, or Soft Light... etc?


What is a good coding style for setting and changing application level constants?

Background: Every application has user-definable constants. The Java language has the Properties class to handle them. Question: What is a good and re-usable coding style for setting and changing application level constants in Mathematica?


How can I customize arrowhead shape to match common LaTeX styles?

How do I control the shape of my arrow heads? LaTeX's TikZ package has a wide variety of predefined arrowhead styles, some of which I'd like to try to match for Mathematica figures I'm importing into a LaTeX document: ![LaTeX arrow examples](http://i.stack.imgur.com/U0b9m.png) But Mathematica's default arrowhead style comes nowhere near any of these. For example,               Graphics[{Thick, Arrow[{{0, 0}, {-50, 0}}]}]       yields ![Default Mathematica arrow](http://i.stack.imgur.com/ZFjHH.png) Earlier versions of Mathematica had options for controlling arrowhead shape, but those seem to be gone in 8.0. How can I get the shape of my Mathematica arrowheads to match the LaTeX TikZ arrowhead styles?


CDF, Player, PlayerPro, or something else?

I have a notebook, which contains a dozen or so custom functions all leading to the production of a simple static report, something like this: ![enter image description here](http://i.stack.imgur.com/TDMNM.png) I want to distribute this to a single user who will run (or execute) it a couple of times a day. I can get them a copy of Mathematica, but that seems overkill for this. They want something very simple. The notebook as it stands gets computable data via FinancialData[] for a single instrument and has hard code for all other required inputs. It requires only a single interaction with the user: pushing the "Run report" button (or some equivalent means of evaluating the code). The code for the actual report uses some proprietary functions, which I want to protect and hide from the user. Ideally, the end user should only see the latest report and the "Run report" button. So, can anyone suggest the best solution for distributing such a computable but otherwise non-interactive report? It doesn't have any need for a Manipulate[] as I see it, so at first thought CDF seems the wrong fit. Should I go with Player or Player Pro and simply hide the cells with functions? Does CDF make more sense? CDF, Player Pro, Notebook comparison I think you can see that I want simple, robust, and secure for this. Just a simple stand alone app. Thx. P.S., We don't seem to have a tag for "player".


Can Mathematica help a theorem to be alive?

We are used to do limits by means of $\epsilon, \delta$. This is the first step an student encounters limits. Using $\epsilon$ and $\delta$ leads him to be familiar to Logic. I have taught limits and other basic similar concepts and I did that by using Maple instead of Mathematica. Because of that, writing a program in which we can probe a real function like sin$(x)$ has a limit has been my old wish. This needs a computer-assisted analytic approach in which we are able to define $\epsilon, \delta$ randomly in $\mathbb R$ and then verify if a certain well-behaved function has a limit. Here, I am not intended to use packages. Thanks.


How can I extend BinCounts to work on Times and Dates?

I want to extend BinCounts to work on a list of times or dates, binning them by Day, Week, Hour of the Month, Day of the Year, etc... So given a list of times and a time bin spec, I need to calculate the bin counts. One example might be if I have list of times I've been on Facebook and I want to to plot these times on a 2D Histogram where the Y axis is "MinuteOfTheDay" and the x axis is "DayOfTheWeek". Alpha can already do this (but not with arbitrary time bins) ![enter image description here](http://i.stack.imgur.com/RvvRU.png) To clarify my question I made a prototype:               d = RandomDates[1000];     Timing[TimeBinCounts[d, {"Day", "Week"}]]      gives the proper counts {157, 150, 136, 147, 149, 129, 132}, (e.g. Count[DayOfWeek /@ d, Monday] == 157). And queries like               Timing[TimeBinCounts[d, {"Month", "Year"}]]      work too, but I'm not sure how to handle an arbitrary time bin spec like "HoursOfTheWeek"               Timing[TimeBinCounts[d, {"Hour", "Week"}]]      Will not work...               <<Calendar`     TimeBinCounts::badspec = "The time bin spec `1` is not acceptable.";     DaysOfTheWeek = {Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday};     daysNum = Thread[Rule[DaysOfTheWeek, Range[7]]];     RandomDateList[] := {RandomInteger[{1800, 2100}], RandomInteger[{1, 12}], RandomInteger[{1, 28}], RandomInteger[{0, 23}], RandomInteger[{0, 59}], RandomInteger[{0, 59}]};     RandomDates[n_] := Table[RandomDateList[],{n}]          TimeSpecHelper[spec_] := Module[         {types, convert, result},         types = {"Second", "Minute", "Hour", "Day", "Week", "Month", "Year"};         convert = {60, 60, 24, 7, 4.345, 12};         result = Range[Times @@ Part[convert, Most[Range @@ Flatten[             First[Position[types, #]]& /@ spec]]]];         If[MatchQ[spec[[1]], "Second"|"Minute"|"Hour"],             result - 1,             result         ]     ]          TimeBinCounts[times_List, spec_] := Module[         {dayorder, bins, minDate, maxDate, order},              minDate = Min[times[[All, 1]]];         maxDate = Max[times[[All, 1]]];              order = Thread[Rule[{"Second", "Minute", "Hour", "Day", "Week", "Month", "Year"}, Range[7]]];         If[Greater @@ (spec /. order),             Message[TimeBinCounts::badspec, spec];             Return[$Failed];         ];              Switch[spec,         {"Day","Week"} | "Day",             With[{days = DayOfWeek /@ times /. daysNum},             BinCounts[days, {1, 8, 1}]],         {"Hour", "Day"}|"Hour",             BinCounts[times[[All, 4]], {0, 24, 1}],         {"Day", "Month"},             BinCounts[times[[All, 3]], {1, 32, 1}],         {"Month", "Year"}|"Month",             BinCounts[times[[All, 2]], {1, 13, 1}],         "Year",             With[{interval = Range[minDate[[1]], maxDate[[1]]]},                 Count[times[[All, 1]], #]& /@ interval             ],         _,               order = Thread[Rule[{"Second", "Minute", "Hour", "Day", "Month", "Year"},                  Range[6]]];             With[{interval = TimeSpecHelper[spec]},                 Count[Mod[times[[All, 6 - (spec[[1]] /. order) + 1]], Length[interval]], #]& /@ TimeSpecHelper[spec]         ]     ]     ]


How to specify a StyleSheet of a newly programmatically-created notebook?

I would like to make a button that opens a notebook upon pressing. The point is that I would like the notebook to be made according to a specified StyleSheet. To be more specific, here is a simple example of such a button:                   Button["Show",      CreateDocument[       Column[{         TextCell["Some text" , "Text", FontSize -> 20],         ExpressionCell[Plot[Sin[x], {x, 0, 2 \[Pi]}]]         }],       WindowTitle -> "Some title", WindowSize -> {450, 300}],       ImageSize -> {50, 18}, BaseStyle -> {"GenericButton", Bold}]      The button is then copy-pasted into any line of any TextCell of the main notebook and serves for the referencing purposes: when the reader meets the text discussing this plot this button in embedded in such a text, and he may press the button. This will generate the notebook with the plot, and the reader may see the plot in question on the spot. Now, I would like the notebook that will be open that way to be created according to the JournalArticle StyleSheet. Is it possible to specify? This edit I am making after having received the answers of Mike Honeychurch and m_goldberg. After all corrections here is the code I had in mind:                   Clear[x, y, z];     Button["Show a JournalArticle Notebook",      CreateDocument[{        (* This makes a Section title *)        TextCell["A section", "Section", FontSize -> 40],        (* This makes a text *)        TextCell["Some text", "Text", FontSize -> 20],        (* This makes a numbered formula *)        TextCell[y == Sin[x^2] // TraditionalForm,          "DisplayFormulaNumbered", FontSize -> 20, TextAlignment -> Center],        (* This makes a plot *)        ExpressionCell[Plot[Sin[x], {x, 0, 2 \[Pi]}], "Figure"],        (* This makes a caption for illustration *)        TextCell["Some caption", "FigureCaption", FontSize -> 14],        (* This makes another numbered formula *)        TextCell[z == Exp[-x^2] // TraditionalForm,          "DisplayFormulaNumbered", FontSize -> 20, TextAlignment -> Center]        },       StyleDefinitions ->         FrontEnd`FileName[{"Article"}, "JournalArticle.nb",          CharacterEncoding -> "UTF-8"], WindowTitle -> "Some title",        WindowSize -> {750, 500}, Background -> LightYellow],       ImageSize -> {200, 18}, BaseStyle -> {"GenericButton", Bold}]      It creates a button. The latter opens the notbook. That's how it looks like: ![enter image description here](http://i.stack.imgur.com/Wx1gb.jpg)


Log-log scale smooth histogram

How can I create a smooth histogram with a log-log scale? I can use `Histogram[data, "Log", "LogCount"]` to get a log-log histogram, or I can use `SmoothHistogram[data]` to get a smooth histogram, but is there a way to combine these two functionalities?


quadratic constraint feasibility

Suppose that $A$ is an $n \times n$ matrix, and I have observed some entries of $A$, say, $A_S$ ($A$ restricted on $S$) for some subset $S$ in $\{1,...,n\} \times \{1,...,n\}$. I want to know if it's possible that $A$ has rank $1$. So this can be reformulated as the following question: does there exist vectors $x$ and $y$ such that $xy^T$ restricted on $S$ equal to the observed values $A_S$? Is there a good way to test this in Mathematica? (the dimension $n$ could be large, but the set $S$ would be a set of a relatively small size in comparison with $n^2$)


Kernel crash after idle in version 10.0

In version 10.0, when I leave the Mathematica section idle for some time (of order an hour), the kernel quit automatically. The syntax highlighting is gone and the variables that has defined before lost their values. There is no error message (tried to launch from terminal and still no error message). This behavior has been noticed on my computer for many times. No operation is performed. Simply launch Mathematica 10 and wait (or define a variable and watch it gone). Mathematica 9 is installed side by side and has no such problem. I am using Linux (CentOS 7). Anyone has the same problem, or any suggestions to further debug?               $Version      > 10.0 for Linux x86 (64-bit) (June 29, 2014)               uname -a      > Linux localhost.localdomain 3.10.0-123.el7.x86_64 #1 SMP Mon Jun 30 12:09:22 > UTC 2014 x86_64 x86_64 x86_64 GNU/Linux **Update:** I unchecked `Preference -> Internet Conectivity -> Allow the Wolfram System to access the Internet`. The kernel hasn't crashed since this change is made.


Mixed product identity between tensors in Mathematica 9

How can we simplify tensor expressions in _Mathematica 9_ using the mixed- product identity $(A\otimes B)(C \otimes D) \equiv AC \otimes BD$ ? Is it possible to implement this kind of evaluations using the new _Mathematica 9_ tensor capabilities? The following expression is false:               TensorProduct[a, b].TensorProduct[c, d] === TensorProduct[ a.c, b.d]      I don't really need to prove this identity, but rather to use it for simplifying some expressions. In my case, $a$ and $c$ are some (unknown) symbolic matrices, while $b$ and $d$ are explicit integer $2\times 2$ matrices. I'd like _Mathematica_ to evaluate the matrix product between $b$ and $d$ explicitly. For instance, when               b=PauliMatrix[1]; d=PauliMatrix[3];      as the product of two Pauli matrices gives another Pauli matrix, I'd like to obtain the simplified result               TensorProduct[a.c, -I PauliMatrix[2]]


Labeling a three-dimensional plot

As the title says, I want to add some text in a three-dimensional plot, thus labeling specific parts of it. Here is the corresponding Mathematica code               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;          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] <= 4]]      which gives this output ![plot3D](http://i.stack.imgur.com/UNJhm.jpg) This surface contains eight symmetrical openings (holes) which I want to label using numbers 1, 2, ...., 8. Any suggestions how to do that? Would it be possible to "reduce" and project this surface into a two-dimensional plot in order to insert the labels? I suppose this would be interpreted more easily.


How to find valleys of data using new function in V10 PeakDetect

One of the great new function in V10 is PeakDetect. It can detect peaks according to desired sharpness as shown in this example:               data = Table[{x, (Sin[10 x] + 2) Exp[-x^2]}, {x, -4, 4, .01}];     peaks = Pick[data, PeakDetect[data[[;; , 2]], .01, .0005], 1];     ListPlot[{data, peaks},       PlotStyle -> {Automatic, Directive[Red, PointSize[0.02]]}]      ![enter image description here](http://i.stack.imgur.com/3taDV.jpg) The question is how to find valleys of the such data using this new function?


Compute ratios of elements in two lists

I have two lists, say `a` and `b`, both of length `n`. I'd like to compute the following:   * minimum of $a[i]/b[i]$ where $i=1, 2, ...n$ and $b[i]>0$ I'd also like to know the index of the element where the min occurs.


How to align dynamic graphics and an image within an Overlay?

I have dynamic graphics over an image but they won't line up, what am I doing wrong?               img = ExampleData[ExampleData["TestImage"][[1]]];     d = ImageDimensions@img;     pt1=d/4;pt2={d[[1]]3/4,d[[2]]1/4};pt3=3d/4;pt4={d[[1]]1/4,d[[2]]3/4};          MultiContourPolygon[polys_List] := Module[{contours = Append[#, First[#]]&/@polys},          {Polygon@Join[Join@@contours,Reverse[First/@contours]],Line[contours]}     ]          LocatorPane[         Dynamic[{pt1,pt2,pt3,pt4}],         Overlay[{img,             Graphics[{Orange, Opacity[.4],                  Dynamic @ MultiContourPolygon[{{pt1,pt2,pt3,pt4}, {{0,0}, {d[[1]],0},d,{0,d[[2]]}}}]},                 ImagePadding -> 0, ImageMargins -> 0, ImageSize -> d             ]             }, Alignment -> {Left,Bottom}, ImageSize -> d         ]     ]      ![enter image description here](http://i.stack.imgur.com/f4P3q.png)


Imposing a Periodic Boundary Condition in Nearest Neighbour Search

I am trying to find first nearest neighbour distributions of randomly dispersed point-like objects in an infinite system. To do this I make a finite sized box unit cell with a chosen concentration of points which are allocated X and Y coordinates, however it is clear that any points along the edge of the box do not see neighbours on the "outside" of the unit cell, skewing their nearest neighbour data. To avoid this I can repeat the box 8 times around the edges, artificially inducing a boundary condition whereby the top points on the box can "see" the bottom ones. As the system is randomly generated and can be made quite large, this seems to work well. The only drawback with my method is that it seems to take a long time to run, I would think as 9N*N, as the nearest neighbour search function in mathematica must run through the list of ALL points in the system, that is the X and Y coordinates of all points in the original cell plus the 8 neighbouring cells. Is it possible to introduce a boundary condition more directly (so without repeating the unit cell box), thereby reducing the computation to N*N?