Skip to main content

Posts

Showing posts from February, 2016

special functions - Why do these two different zetas produce the same value?

Zeta[-13] == Zeta[-1] == -1/12 Why do these two different zetas produce the same value? Answer In order to understand the issue, we should provide the underlying definitions. Mathematica helps in verifying appropriate relations and definitions. The main functional equation relating Riemann's zeta function $\zeta\;$, to Euler's $\Gamma\;$, established in Riemann's famous paper Über die Anzahl der Primzahlen unter einer gegebener Grösse (1859, English translation here ), where he formulated the Riemann hypothesis, can be simply written and evaluated with the system: Through @ { HoldForm, FullSimplify}[ Zeta[z] == 2^z Pi^(z - 1) Sin[Pi z/2] Gamma[1 - z] Zeta[1 - z]]// Column // TraditionalForm $$\begin{align*}&\zeta(z)=2^z\pi^{-1+z}\Gamma(1-z)\sin\left(\frac{\pi z}{2}\right)\zeta(1-z)\\ &\text{True}\end{align*}$$ Similarly we can exploit the definition of Zeta for Re[z] > 1 (see SumConvergence[1/n^z, n] ): Sum[ 1/n^z, {n, Infinity}] == Defer[ Sum

algebraic manipulation - InverseSeries of multiple variables and multiple equations

CONTEXT Let us consider a bit of the Universe in which we draw spheres (see a high resolution image here ). Astronomers have shown that the density within these spheres could be predicted quite accurately: here is the measured (in red) and predicted (in green) distribution of the density within $50^3$ such spheres at half the age of the Universe: . Our next purpose is to extend the theory to concentric two or more shells. In practice, in order to estimate the mildly nonlinear cosmic density of the Universe within concentric shells, I need to find perturbatively the Legendre Transform of a function of two variables in a singular regime (see below). $$\phi(\lambda_1,\lambda_2)={\rm LT}(\psi(\rho_1,\rho_2))\equiv \sup_{\rho_1,\rho_2}\left[\lambda_1 \rho_1+\lambda_2 \rho_2-\psi(\rho_1,\rho_2)\right]$$ which in turns involves inverting the system $$\partial_\rho \psi =\lambda \quad \quad \quad (1) $$ for $\rho_1,\rho_2$ , and integrating for $\phi(\lambda_1,\lambda_2)$ the system $$ \quad

list manipulation - Part extraction vs functions like First, Last?

There are many ways to extract different parts of lists in Mathematica. For example, the first part of a list v can be accessed either as v[[1]] or First[v] or Take[v,1] . Likewise the last element can be accessed as v[[-1]] , Last[v] or Take[v,-1] . Similarly v[[2;;]] is equivalent to Rest[v] and to Drop[v,1] , and v[[;;-2]] is equivalent to Most[v] and Drop[v,-1] . The more specialized functions First , Last , Rest and Most are marginally more efficient. On the other hand, it makes sense to use the more general Part ( [[ ]] ) or Take / Drop if it is part of a calculation that also requires parts to be accessed that do not have a specialist function. Beyond these considerations, are there any reasons to prefer Part over Take / Drop or the more specialized functions, other than personal preferences over coding style?

manipulate - Assign Locator points to a specific plot

Result on the left is not what I intended to do: it has two sets of Locator points. Trying to determine why two sets of Locator points are appearing. I only intended to have one set. Result on the right is what I am trying to do: it has one set of Locator points. Suspect that I am making some fundamental mistake or misunderstanding something. Could someone point out why the results are different? Also, what is an appropriate way to implement this? Below is the code for the result on the left. Switch the comments to produce the result on the right. Note these results are for Version 11.0.1.0 Similar, though not always identical, results are obtained for version 10. Manipulate[ ptsExtended = Prepend[Append[Sort[ptsAll], {1.5, 1}], {-2, 0}] ; fpts = Interpolation[ptsExtended, InterpolationOrder -> 1]; dfpts = Derivative[1][fpts]; plotf = Plot[fpts[x], {x, 0, 1}, PlotRange -> {{-0.1, 1.1}, {-0.1, 1.1} }, PlotLabel -> Style["f(x)", Bold, 12]]; plotdf = Plot[

bugs - NotebookImport fails for code split over multiple lines

Bug introduced in 10.4 or earlier and fixed in 11.2 I've found that NotebookImport[file,"Input" -> "HeldInterpretedCell"] doesn't seem to cope when the closing bracket of a command is on the following line of an input cell. So if I save a notebook test.nb with the following input cell (as one cell): Plot[x, {x, 0, 1} ] Then NotebookImport["test.nb","Input" -> "HeldInterpretedCell"] gives a Failure[] box instead of the expected HoldComplete[Plot[x,{x,0,1}]] . With multiple different cells with different permutations: Plot[x, {x, 0, 1} ] Plot[x, {x, 0, 1}] Plot[x, {x, 0, 1}] Plot[ x, {x, 0, 1}] the first and last will fail, but the middle two are fine. It looks like it is related to the square brackets of the outmost command being the end/start of a line. Is this a bug? Answer Wolfram Support emailed me to let me know that this has been fixed in v11.2, which I've confirmed.

function construction - How to find (numerical) value of a derivative at point?

I have the following function: f[0, 0] = 0 f[x_, y_] := Exp[-(x^2 + y^2)^(-1)] How do I find its partial derivatives at any given point, including $(0,0)$? This doesn't work (obviously, I guess): point={0,0} D[f[x, y], x] /. x -> point[[1]] /. y -> point[[2]] Answer In case you have any problems, I recommend using the Derivative operator instead of D , since the latter works on expressions, while the former one can work on pure functions. {Derivative[1, 0][f][x, y], Derivative[0, 1][f][x, y]} // TraditionalForm The subtlety here is that one cannot use it to find partial derivatives of f at {0,0} , e.g. Derivative[0, 1][f][0, 0] Power::infy: Infinite expression 1/0 encountered. >> Infinity::indet: Indeterminate expression E^ComplexInfinity encountered. >> Power::infy: Infinite expression 1/0^2 encountered. >> Indeterminate however, you can use Limit instead of Derivative : Limit[ #, h -> 0] & /@ {( f[0 + h, 0] - f[0, 0] )/ h, ( f[0, 0 + h] - f[0,

plotting - Inaccurate plot

Could someone please tell me how I can increase the accuracy of this plot, please? Or is there some other reason the lines are breaking up? m = 60; ContourPlot[{Re[Table[BernoulliB[n, (x + I y)], {n, m, m}]], Im[Table[BernoulliB[n, (x + I y)], {n, m, m}]]}, {x, -5, 6}, {y, -10, 10}, AspectRatio -> Automatic] Answer As you already know from the comments, increasing MaxRecursion or PlotPoints helps, where I would prefer the first one. In the case of your function, you can gain some speed by compiling the expression. Then, you can set MaxRecursion to a higher value and the plot is still reasonable fast. The code below runs in about 3 seconds here m = 60; With[{cf = (Compile[{{x, _Real, 0}, {y, _Real, 0}}, #, RuntimeOptions -> "Speed", CompilationTarget -> "C"] & /@ Flatten[{Re[Table[BernoulliB[n, (x + I y)], {n, m, m}]], Im[Table[BernoulliB[n, (x + I y)], {n, m, m}]]}])}, (#1[args__?NumericQ] := #2[args]) & @@@ Transpo

probability or statistics - Why the results of FindDistribution and DistributionFitTest are not consistent?

data = {0.180723, 0.181208, 0.182213, 0.1875, 0.1875, 0.1875, 0.1875, 0.1875, 0.1875, 0.190476, 0.191041, 0.19174, 0.192308, 0.192513 0.193038, 0.194118, 0.194858, 0.195172, 0.196141, 0.196507, 0.196911, 0.19717, 0.199725, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.204804, 0.204887, 0.206148, 0.207435, 0.208861, 0.211034, 0.213389, 0.214286, 0.214286, 0.214286, 0.215247, 0.218447, 0.22028, 0.221334, 0.221519, 0.222222, 0.224227, 0.224359, 0.225352, 0.226485, 0.230769, 0.230769, 0.230769, 0.230769, 0.230769, 0.230769, 0.231561, 0.23622, 0.239075, 0.24, 0.24, 0.241667, 0.241758, 0.246269, 0.247842, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.254902, 0.26087, 0.26087, 0.264706, 0.269461, 0.272727, 0.273684, 0.277778, 0.287576, 0.28934, 0.295775, 0.298013, 0.3, 0.3, 0.3, 0.3, 0.304124, 0.305085, 0.310345, 0.333333, 0.333333, 0.333333, 0.333333, 0.333333, 0.333333, 0.333333, 0.333333, 0.333333, 0.333333, 0.333333, 0.357143, 0.36, 0.375, 0.375, 0.375, 0.375, 0.375

version 10 - Partitioning a list in n sublists with constrains in their sums

Is there a way to put cluster level limits on clusters? For example, if I run: FindClusters[{1, 2, 3, 4, 4, 6, 7, 10}] I get back two lists, {{1, 2, 3, 4, 4}, {6, 7, 10}} . But lets say I only want each cluster to have a sum of 15 or fewer and potentially get {{2, 3, 10}, {6, 3, 1}, {7, 4, 4}} As far as I can tell, this is not possible to express with a distance function, so maybe clustering is the wrong tool for the job? Is there a way to do that? Answer Quiet[<< Combinatorica`;] l = {1, 2, 3, 4, 4, 6, 7, 10}; f[l_, n_, min_, max_] := Module[{part, s}, While[(s = (Tr /@ (part = RandomKSetPartition[l, n])); Not[And @@ Thread[min < s < max]])]; part] f[l, 3, 5, 15] (* {{1, 10}, {2, 4, 7}, {3, 4, 6}} *)

plotting - Why Plot3D shows differently with almost the same data

I really can't understand this. I wrote two functions, one with Compile called funcom , one with librarylink to link a fortran subroutine called funcfortran . And they do exactly the same thing! So I Plot the result first plotfor=Plot3D[funcfortran[w, 0.06, -1, 1, 1, \[Pi]/2., 2., 3., ky], {w, 0, 10}, {ky, -0.1, 0.1}, PlotRange -> All, MaxRecursion -> 7, Mesh -> All] This is output from topview Well, this may not seem that wrong, But look at the plot result of funcom with exactly the same parameter plotcom=Plot3D[funcom[w, 0.06, -1, 1, 1, \[Pi]/2., 2., 3., ky], {w, 0, 10}, {ky, -0.1, 0.1}, PlotRange -> All, MaxRecursion -> 7, Mesh -> All] different !!! They contains almost the same point data, this can be verified after we extract the data and compared the difference Sort[DeleteDuplicates@ Abs@Flatten[ Cases[%58, x_GraphicsComplex :> x[[1]]][[1]] - Cases[%66, x_GraphicsComplex :> x[[1]]][[1]]], Greater][[1 ;; 3] ] The top three

export - Is Compress[] compatible between different Mathematica versions?

Compress[] was introduced in version 6 of Mathematica. It gives a compressed version of expressions represented as a string of ASCII characters. It preserves more information than the InputForm of expressions (for example it keeps packed arrays packed). Are the strings returned by Compress compatible between versions? Can a compressed expression created using version 6 be uncompressed in version 8? What about the reverse (reading a version-8-compressed expression in 6 or 7)? What happens if a version 8 specific object such as Graph is uncompressed in version 6 or 7? Answer Compress[expr] will take an expression, convert it to a string, using some form, which would allows to recover the expression later on (most likely InputForm is used) and compress the string. If the resulting compressed expression is uncompressed in an earlier version of Mathematica , the result is going to be an expression, which has no code associated with it, so it will, most likely, just remain unevaluate

plotting - Problems with region-related functions

For a demonstration project, I am calculating certain geometric properties of a region (an isosceles triangle in this example), as follows: baseshape = SASTriangle[2, Pi/6, 2]; cbs0 = RegionCentroid[baseshape]; baseshape = TransformedRegion[baseshape, TranslationTransform[-cbs0]]; This calculates the centroid, and moves the region so its centroid is at the origin. Now I am going to rotate the region, move it down by depth , and define the part of the region that lies below y=0 as a new region, as follows: rrs[\[Theta]_?NumericQ, depth_?NumericQ] := RegionIntersection[ TransformedRegion[ TransformedRegion[baseshape, RotationTransform[\[Theta]]], TranslationTransform[{0, -depth}]], ImplicitRegion[y <= 0, {x, y}]]; However, I get an error message when I try to plot this: Plot[Area[rrs[0, depth]], {depth, -0.7, 1.4}] Area::reg: rrs(0,d,{0,0}) is not a correctly specified region. The plot looks fine, but I don't understand the reason for the error message. What am I

replacement - Replace custom functions, leave built in functions untouched?

I have three expressions a[x, y], b[x, y], c[x, y] that act as placeholders for functions of two variables x,y . Consider the following substitution: a[x, y]/(b[x, y] c[x, y]) /. f_[x1_, y1_] :> f[2 x1, 3 y1] a[2 x, 3 y]/(64 b[x, y]^3 c[x, y]^3) In the output we see that the numerator expression was substituted properly, but in the denominator the pattern f_ registered for the head Power instead of looking for my own expressions. Of course I can fix this by: a[x, y]/(b[x, y] c[x, y]) /. a[x1_, y1_] :> a[2 x1, 3 y1] /.b[x1_, y1_] :> b[2 x1, 3 y1] /. c[x1_, y1_] :> c[2 x1, 3 y1] a[2 x, 3 y]/(b[2 x, 3 y] c[2 x, 3 y]) which gives the desired output. But this amounts to writing three times as many substitution directives and is therefore inconvenient. To fix the first example, I tried using /. f_Symbol[x1_, y1_] :> f[2 x1, 3 y1] or /. f_[x1_, y1_]/;Head[f]===Symbol :> f[2 x1, 3 y1] , but this does not correct it. Is there a way to write a proper substitution that works

front end - Default styles for Exporting to PDF, EPS and SVG

By default for on-screen display, Rasterize and Export ing to raster formats FrontEnd uses styles defined on the Notebook level via StyleDefinitions option: SetOptions[EvaluationNotebook[], StyleDefinitions -> Notebook[{ Cell[StyleData[StyleDefinitions -> "Default.nb"]], Cell[StyleData["My"], FontColor -> Red, FontWeight -> Bold, FontSize -> 20, FontFamily -> "Times"] }, StyleDefinitions -> "PrivateStylesheetFormatting.nb"]] text = Style["Text", 20, "My"] Rasterize[text] ImportString[ExportString[text, "TIFF"], "TIFF"] But local styles do not affect Export ing to vector graphics formats: Export["temp.pdf", text] // SystemOpen Export["temp.svg", text] // SystemOpen What determines the styles used by default for Export ing to PDF, EPS and SVG? Is it possible to change the defaults? Answer According to the Documentation , DefaultStyleDefinitions i

differential equations - NDSolve does not respond

For some sets of constants, NDSolve gives me true solutions, but when I try for example, T = 1/(2*2200) , Mathematica does not respond. What can I do? The code below has no problem, but I need to change the constants defined at the beginning of the code and see the results. Any suggestions? Io = 3.38*10^-12 NS = 8 Cp = 90*10^-15 Cs = 30*10^-15 T = 1/(2*2100) ss = 51.23*10^-3 dV = 0.45 Cl = 1*10^-12 V = 0.3 \[Beta] = (2*Io)/((Cs + Cp)*ss) a = \[Beta]*T b = \[Beta]*T/2 c = Cl/((Cs + Cp)/(2 T)) d = Io/((Cs + Cp) /(2 T)) s = NDSolve[ {Vo[t] == V + Log[b/(E^((c*Vo'[t] + d)/ss) - 1)] ss + Log[(b* E^((dV + c*Vo'[t] + d)/ss))/(E^((c*Vo'[t] + d)/ss) - 1)] ss + Log[(a* E^((dV + c*Vo'[t] + d)/ss))/(E^((2*(c*Vo'[t] + d))/ss) - 1)] ss (NS-1), Vo[0] == 0.3 }, Vo, {t, -0.0001, 1}] Plot[Evaluate[Vo[t] /. s], {t, -0.0001, 1}, PlotRange -> All]

graphics - How can I generate and randomly assign color to annular sectors?

How can I generate such an image and fill every annular sector with a random colour? Answer With V10 came RandomColor and ColorSpace Using Michael E2 's wonderful solution plot = ParametricPlot[r {Cos[t], Sin[t]}, {r, 0, 12}, {t, 0, 2 Pi}, ImageSize -> 500, Mesh -> 13, MeshShading -> {{Red, Red}, {Red, Red}}, PlotRange -> {{-9, 9}, {-4, 4}}]; Grid @ Partition[Table[plot /. poly_Polygon :> {RandomColor[ColorSpace -> space], poly}, {space, {"RGB", "XYZ", "CMYK", "Grayscale"}}], 2]

import - How to extract sample values from an imported WAV file?

Suppose I read a file with B = Import["something.wav"] Now how can I obtain a list of sample values? Answer You want this: data = Import["test.wav", "Data"] This imports the raw data of sample values. For example, on a test file of approximately 10 seconds, stereo at 48000 Hz, data is an array of size 2 × 520192 (from which I can deduce that my recording was actually 10.84 seconds). See the documentation for WAV format import/export , as well as this answer on a related question for some more details. Going at it differently, if you already have imported your file as a Sound object (as in your example), you can still recover the sample data. Inside your Sound object is a SampledSoundList : In[25]:= Head@First@B Out[25]= SampledSoundList This in turn contains the raw data: In[26]:= Length@B[[1, 1]] Out[26]= 2 In[27]:= Table[Length@B[[1, 1, i]], {i, 1, 2}] Out[27]= {520192, 520192}

equation solving - How to get exact roots of this polynomial?

The equation $$ 64x^7 -112x^5 -8x^4 +56x^3 +8x^2 -7x - 1 = 0 $$ has seven solutions $x = 1$, $x = -\dfrac{1}{2}$ and $x = \cos \dfrac{2n\pi}{11}$, where $n$ runs from $1$ to $5$. With NSolve , I tried NSolve[64 x^7 - 112 x^5 - 8 x^4 + 56 x^3 + 8 x^2 - 7 x - 1 == 0, x, Reals] and I get {{x -> -0.959493}, {x -> -0.654861}, {x -> -0.5}, {x -> -0.142315}, \ {x -> 0.415415}, {x -> 0.841254}, {x -> 1.}} With Solve , I tried {{x -> -(1/2)}, {x -> 1}, {x -> Root[1 + 6 #1 - 12 #1^2 - 32 #1^3 + 16 #1^4 + 32 #1^5 &, 1]}, {x -> Root[1 + 6 #1 - 12 #1^2 - 32 #1^3 + 16 #1^4 + 32 #1^5 &, 2]}, {x -> Root[1 + 6 #1 - 12 #1^2 - 32 #1^3 + 16 #1^4 + 32 #1^5 &, 3]}, {x -> Root[1 + 6 #1 - 12 #1^2 - 32 #1^3 + 16 #1^4 + 32 #1^5 &, 4]}, {x -> Root[1 + 6 #1 - 12 #1^2 - 32 #1^3 + 16 #1^4 + 32 #1^5 &, 5]}} How to get exact solutions of the given equation? Answer Since we ask if the numbers $\;x_n = \cos(\frac{2n\pi}{11})\;$ are the actual roo

replacement - StringReplace, ReplaceAll and Rule interact in a bizarre way

I have the following pair of things: ClearAll[foo, labeledFoo]; labeledFoo = {"FooBarBazQuux", foo}; This works like you'd expect: labeledFoo /. hdr_String :> StringReplace[hdr, l_?LowerCaseQ ~~ U_?UpperCaseQ :> l <> " " <> U] (* {"Foo Bar Baz Quux", foo} *) So does this: labeledFoo /. hdr_String :> StringReplace[hdr, l_?LowerCaseQ ~~ U_?UpperCaseQ :> l <> " " <> U] /. {hdr_String, x_} :> (hdr -> x) (* "Foo Bar Baz Quux" -> foo *) Heck, even this works: labeledFoo /. {hdr_String, x_} :> (Rule @@ {StringReplace[hdr, l_?LowerCaseQ ~~ U_?UpperCaseQ :> l <> " " <> U], x}) (* "Foo Bar Baz Quux" -> foo *) This, though, doesn't work at all: labeledFoo /. {hdr_String, x_} :> (StringReplace[hdr, l_?LowerCaseQ ~~ U_?UpperCaseQ :> l <> " " <> U] -> x) (* "Fo" ~~ l <> " " <> U ~~ &q

Histogram from relative frequency data;

I've got a data set similar to the first and fourth column of this table http://mathworld.wolfram.com/FrequencyDistribution.html where the first column is the midpoint of a fixed range of values (although a solution with arbitrarily spaced segments would be great) and the second column is the corresponding relative frequency of that initial range of values being present. A = {{5, 0.0123445}, {15, 0.0342565}, {25, 0.0885784}, {35, 0.184694}, {45, 0.243735}, {55, 0.223433}, {65, 0.111512}, {75, 0.000000}, {85, 0.000000}, {95, 0.1014466}} I want to plot a histogram/discrete probability distribution. I've found solutions to plotting histograms from pre-binned data https://stackoverflow.com/questions/15117024/histogram-with-frequency-data but this only works on integer values. My probability data has ~6 significant digits and I would really prefer not to arbitrarily multiply my data by 10^6 to plot it then adjust the plot labels to divide by 10^6. Am I trying to force a function

programming - Is there a practical way to define a default value for missing keys in an Association?

Clarification Although I may be missing his point I currently feel that Leonid's comments below are misleading. I am not looking for anything that is not already a part of Association functionality other than a way to define what is returned for a missing key on a per-association basis. I thought that the Block example below made this clear but perhaps not. I am seeking a way to do something like this: asc = <|"a" -> 1, "b" -> 2, _ -> 0|>; asc["x"] (* desired output: 0 *) (* actual output: Missing["KeyAbsent", "x"] *) Critically I am not looking for general pattern matching of Key names however; I only want a way to define one default value for missing keys. Original ramblings It can be very useful to define background or default value for an object that can be incremented or otherwise modified. A simple (and for me, common) use is a counter: count[_] = 0; ++count[#] & /@ {"a", "a", &quo

finite element method - Swinging Beam example from Help. Not Understanding/Not Working

To help me understand finite element analysis with Mathematica I have been reading the Finite Element Method User Guide in Help and am stuck on the example in Coupled PDEs. Here there is a static beam problem and a swinging beam problem. I have taken the code from the static beam problem and this works nicely Needs["NDSolve`FEM`"] \[CapitalOmega] = ImplicitRegion[True, {x, y}]; mesh = ToElementMesh[\[CapitalOmega], {{0, 5}, {0, 1}}, "MaxCellMeasure" -> 0.1]; vd = NDSolve`VariableData[{"DependentVariable", "Space"} -> {{u, v}, {x, y}}]; sd = NDSolve`SolutionData["Space" -> ToNumericalRegion[mesh]]; bcDu0 = DirichletCondition[u[x, y] == 0, x == 0]; bcDv0 = DirichletCondition[v[x, y] == 0, x == 0]; bcNL = NeumannValue[-1, x == 5]; initBCs = InitializeBoundaryConditions[vd, sd, {{bcDu0}, {bcDv0, bcNL}}]; diffusionCoefficients = "DiffusionCoefficients" -> {{{{-(Y/(1 - \[Nu]^2)), 0}, {0, -((Y (1 - \[

programming - How to create a multi-selectable setterbar with colored buttons

Background: consider the following code-snippet. Dynamic@Grid[ Table[Setter[Dynamic[idx, (idx = #1) &], i*6 + j, Graphics[{Blue, Disk[]}, ImageSize -> 20]], {i, 0, 1}, {j, 6}]] This code creates two rows of clickable disk images. So if idx=10 is run, the 10th disk looks pressed. I want to make this control multi-selectable. So if idx={1,12} run, the first and last disks look pressed. ( In my application the disks may have different colors, edge properties and opacity. ) - See also: What is an efficient way of selecting multiple colors via Manipulate? Question: How to create "a multi-selectable setterbar with colored buttons" ? ( preferably based on the snippet above, but not necessarily ). Answer Does this provide the functionality you are looking for? Note that a multi-selectable SetterBar is a TogglerBar . The only problem with the latter is that it cannot be partitioned into a multi-row grid. For your particular problem, I would rather use Bu

graphics - Why does a heavy background slow LocatorPane from updating, even if only the locators are Dynamic?

I'm having some trouble getting a dynamic plot to operate efficiently, and I think I've tracked down at least part of the problem to some pretty weird behaviour on the part of LocatorPane . Take two different image backgrounds, which can be quite similar except for their size on disk: image1 = ContourPlot[x^2-y^2, {x, -1, 1}, {y, -1, 1}, ImageSize -> 250]; image2 = ContourPlot[x^2-y^2, {x, -1, 1}, {y, -1, 1}, ImageSize -> 250, PlotPoints -> 200]; where the ByteCount of image2 is, in this case, about twenty times bigger than that of image1 , and now use these images as the background for a LocatorPane : point = {0.4, 0}; Row[{ LocatorPane[ Dynamic[point], image2 ], Dynamic[point] }] which produces something like this As you can see, the version with the heavier background is a huge lot more sluggish than the lighter one (though this is much more evident if you run it yourself). Why is this? Both occurrences of point are inside a Dynamic command but t

bugs - Return value of Import "MX" when file was saved with newer version

I just detected that Mathematica 10.4.1 on Windows will just quietly return Null when I try to Import an .mx file I exported with version 11.1.1. I understand and know that .mx files that were generated with newer versions will generally not load with older versions. Up to now I thought (and I believe I have seen that for older verions) it would give some message and return $Failed , but obviously this is not the case here. As often, the documentation page for the MX format is not giving detailed information about that specific case. My question is whether that is the expected behavior and whether there is some documentation about that or that would be something to report to WRI... Answer This is indeed a bug. A careless tweak was made to the format, so that MX files created by Version 11.1 or newer aren't even recognized as MX files by pre-11.1.0 versions. So Get is succeeding, reading the binary file as text and returning Null because it encounters a zero byte, interpreted