Hot answers tagged

9

With Frame -> All, the automatic Spacings are weird. The automatic BaselinePosition is bad either way. It seems to be a good idea to include substitutes for as many of those options which are Automatic by default as possible: pic2 = ImageResize[ImageCrop@Rasterize@Graphics@Disk[], {Automatic, 40}]; Grid[{{pic2}}, Alignment -> {Center, Center}, ...


8

The last column seems in error. Here's a workaround for the sample problem, although it does not fix NDSolve`FiniteDifferenceDerivative: dx2 = dx1; dx2[[All, -1]] = -Reverse@dx1[[All, 1]] (* {-0.50000000000000000000, 0.25989153247414500869, -0.29289321881345247560, 0.36161567304292239214, -0.50000000000000000000, 0.80995720221088751026, ...


8

Normal[# /. a : Arrow[{__List}, Except[_List]] :> Thread @ a] gives a quick fix for these examples.


6

I think what is reported in this question is a bug that is affecting many of the Plot family of functions in V10.X for X >= ?. The problem occurs when a plot has to deal with numbers outside the range {$MinMachineNumber, $MaxMachineNumber} {2.22507*10^-308, 1.79769*10^308} Since the OP's problem only occurs near the singularity at zero, let's reduce ...


4

This is a bug in Sum. In addition to the nice workarounds proposed by others, the substitution m = 2p also leads to a correct answer for this example. In[1]:= Sum[ Binomial[2 p - 2, k - 1] (k - 1), {k, 2, 2 p - 2, 2}] /. {p -> m/2} // Simplify Out[1]= 2^(-4 + m) (-2 + m) Sorry for the inconvenience caused by this problem.


3

The bug appears to be fixed in the latest version of Mathematica (10.3.1), as confirmed by @JasonB and @Szabolcs.


3

As a workaround for this incorrect simplification, you could use FindSequenceFunction on a sample of concrete results: Clear[m,n,k]; Simplify[FindSequenceFunction[ Table[ Sum[Binomial[m - 2, k - 1] (k - 1), {k, 2, m, 2}], {m, 2, 12, 2}], n] /. n -> m/2] (* ==> 2^(-4 + m) (-2 + m) *) This is similar to the answer by @Coolwater here.


3

I would suggest defining your sum as a function f[m_?NumericQ] := Sum[Binomial[m - 2, k - 1] (k - 1), {k, 2, m, 2}] /; EvenQ[m]; This evaluates fine and does not give zero when given numeric values. The root of the problem seems to me to have to do with the definition of Binomial internaly as a combination of Gamma functions. "In general,Binomial[n,m] ...


3

Partial derivatives should work on interpolation functions just fine, and I cannot see why your interpolating function should be any different. But it is. Here is a ridiculous workaround ufem2 = Interpolation[ Flatten[Table[{{x, t}, ufem[x, t]}, {x, 0, 10, .1}, {t, 0, 1, .02}], 1]]; loc2 = Derivative[1, 0][ufem2]; Plot[{ufem[x, .2], loc2[x, ...


3

This definitely seems like a bug in RegionIntersection, and you can confirm it using this simple example. Take two Region objects, one an ImplicitRegion defined along a horizontal line, the other a unit square. This error shows up regardless of whether RegionBoundary is used to define the region, so we'll leave it out. region1 = Rectangle[]; line1 = ...


3

Just for the record, this is a way to do it in V9: << ComputationalGeometry` SeedRandom[42]; l = RandomReal[{0, 50}, {100, 2}]; {xr, yr} = Through[{Min, Max}[#]] & /@ Transpose@l; mylines = Line/@(Thread[{xr + {-1,1}, #}]&/@ Range[Sequence @@ yr, -Subtract @@ yr/10]); gc = GraphicsComplex[l, {FaceForm[White], EdgeForm[Black], ...


2

In your inputs a = 10^-6; b = 10^-3; c = 1; d = 0.1; s = -d Sqrt[b^2 + c^2] -0.1 this result is approximated for display. You can see the complete result by placing your cursor in front of the -0.1 and pressing the space bar. Alternatively InputForm[s] -0.1000000499999875 Edit With s = -d Sqrt[b^2 + c^2] the integral calculation yields ...


2

Not very clean: v = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}}; r = Normal /@ {Graphics[GraphicsComplex[v, Polygon[{1, 2, 3, 4}]]], Graphics[GraphicsComplex[v, {Red, Line[{1, 2, 3, 4, 1}]}]]}; r /. {Red, Line[x__]} :> (FilledCurve@Line@x)


2

A workaround This long-term bug is a constant source of pain for Mathematica users for many years. After years of customization of plots "by hands" I have figured out what happens and developed a general approach which allows to get the expected output with as little pain as possible. It was even necessary to develop special technical vocabulary in order to ...


1

Indeed, there is a bug, as I noted in a related answer, and a bug report has been submitted by @Peeter Joot in 2013. As a temporary fix for the issue (hoping that the bug will get resolved in the near future after more than two years), you could use the following modification of the plotting function in the question: volumetricPlot[latticeType_] := Module[ ...


1

To sum up what we have been saying in comments, it may sometimes be dangerous to use symbolic solvers (e.g. Integrate) with inexact input (e.g. $d=0.1$). It is better in your case to evaluate the integral symbolically, and then calculate the approximate numerical value: a = 10^-6; b = 10^-3; c = 1; s = -d Sqrt[b^2 + c^2]; d = 1/10; Integrate[(w ...



Only top voted, non community-wiki answers of a minimum length are eligible