8,072 reputation
11949
bio website
location
age
visits member for 2 years, 9 months
seen 7 hours ago

8h
comment List(Line)Plot with a big jump
Insert a Null (or anything that's not a real number) where you want a gap. ListLinePlot[{{0, 0}, {1, 0}, {2, 0}, Null, {3, 5}, {4, 6}, {5, 7}}]
9h
comment Histogram bin includes numbers out of range
If you go to the documentation for Histogram and click "Details and Options", it describes the different ways that bin width specifications can be given. One of the possibilities is {xmin, xmax, dx}: "use bins of width dx from xmin to xmax". That should work for you.
17h
comment Interpolating a polynomial for with first and second derivative of points
Then InterpolatingPolynomial[{{r1, y1, yp1, ypp1}, {r2, y2, yp2, ypp2}}, r] will do it. It returns the polynomial of minimum degree that satisfies the conditions, and since you have six conditions, you will automatically get a fifth-order polynomial.
18h
comment Interpolating a polynomial for with first and second derivative of points
You don't have $f(r_1)$ and $f(r_2)$, only its derivatives?
19h
comment What extrapolation method does Interpolation use by default?
By the way, "With cubic spline interpolation, the second derivative at the end points is zero" is only true for what are known as "natural" cubic splines, which are not the only possible type of spline. In any case, Mathematica does not use spline interpolation by default, but even when you specify Method -> "Spline" it doesn't use natural splines.
1d
comment How to make hollow octahedron 3-compound?
I was sure this was a duplicate of an older question, but it's actually not...
1d
comment Implement a piecewise function elegantly and efficiently
I believe your function is also equivalent to Clip[0.5 x, {Max[xmin, x - m], Min[1, x + m]}].
1d
comment Mystifying failure of NonlinearModelFit
Providing a ballpark initial guess works for me: NonlinearModelFit[ts, a Exp[b t], {a, {b, 1/800}}, t]. Doesn't work with Method -> "NMinimize" though, which ignores it.
1d
comment Implement a piecewise function elegantly and efficiently
You can use Piecewise, which is designed to match the syntax of the mathematical definition-by-cases you wrote above. Although I don't know if there is any difference in performance.
2d
comment How to plot curves in ternary plot (triangular plot)
Indeed, I believe István Zachar's answer in particular would work perfectly for this question.
2d
comment How to check if a line segment intersects with a polygon?
Oh, yes it does. By "as expected" I meant "as in your answer". Yes, it does look like a bug. RegionDimension correctly returns 1, though.
2d
comment How to check if a line segment intersects with a polygon?
Wait, no, now everything is working as expected. And I was sure I restarted the kernel and checked, too... Maybe I made a mistake somewhere. Sorry for the confusion.
2d
comment How to check if a line segment intersects with a polygon?
Strange, I get True for all cases, even the ones that don't intersect. Which makes sense to me: an empty region is still a region, just like an empty set/list/graph is still a set/list/graph. (v10.0.1 on Mac, by the way)
2d
comment How to check if a line segment intersects with a polygon?
By "a segment bounding the polygon" Daniel means a line segment on the boundary of the polygon, i.e., an edge of the polygon. The short red line does not intersect any of your polygon's ten edges.
2d
comment How to check if a line segment intersects with a polygon?
@novice: No, Daniel's method still works with nonconvex polygons. Do you have a counterexample in mind?
2d
comment How to make the 3D borders like these around Notebook content?
@Sjoerd: I believe the OP wants the dark border above and to the left of the white notebook contents, which is missing in the second screenshot. Though I wonder how the OP took the first image showing what they want, given that they do not have it. :)
2d
comment How to simulate the 2-D motion of a particle under uniformly accelerated motion?
Can you explain what you mean by "simulate the motion"?
2d
comment RegionFunction generalized to plot a different colour/style for the largest expression
I do kind of want to hear that aside, but I'll understand if you're not inclined to typing it all up!
2d
comment RegionFunction generalized to plot a different colour/style for the largest expression
Are the questions different? "I have several functions of two variables defined in some region ... I'd like a plot to show at a glance the regions where each function is largest, with a different colour or similar" perfectly describes the other question (except for "smallest" vs. "largest").
2d
comment RegionFunction generalized to plot a different colour/style for the largest expression
Is this question "closely related" or an actual duplicate of the one you linked to? It certainly looks like a duplicate to me, but I haven't voted to close yet in case I'm missing something.