Tag Info

New answers tagged

1

I will attempt to answer my own question. Technical support at Wolfram Research pointed out that the boundary conditions specified above are incorrect. Specifically the two outer circles have the wrong boundary conditions. The correct BCs are given by bcs = Join[{DirichletCondition[u[x, y] == 0, x^2 + y^2 >= 0.149^2]}, Map[DirichletCondition[u[x, y] ...


9

The inertia tensor is defined as an integral of the following tensor over the body region vars = {x, y, z}; r2 = IdentityMatrix[3] Tr[#] - # &@Outer[Times, vars, vars]; r2 // MatrixForm It is very simple to do with integration over a region Integrate[r2, vars ∈ region] It can be wrapped in the following function inertiaTensor[reg_, assum_: {}] ...


2

I am not sure about this but it looks like ImplicitRegion works only with real domain.


1

\[ScriptCapitalR] = -Sqrt[-1 + 1/4 (x + 1/(x + I y) + I y)^2] + 1/2 (x + 1/(x + I y) + I y) == x + I y RegionPlot[\[ScriptCapitalR], {x, -2.5, 2.5}, {y, -2.5, 2.5}]


8

There are already good answers, but I'm going to improve the performance, generalize to any region in any dimensions and make the function more convenient. The main idea is to use DirichletDistribution (the uniform distribution on a simplex, e.g. triangle or tetrahedron). This idea was implemented by PlatoManiac and me in the related question obtaining ...


1

Here's a method inspired by Rojo's that uses VectorAngle to select corner points, based on their angle with adjoining points along the boundary. This avoids the traveling salesman. Generalizing to any month: days = <|Sunday -> 1, Monday -> 2, Tuesday -> 3, Wednesday -> 4, Thursday -> 5, Friday -> 6, Saturday -> 7|>; . ...


2

Perhaps instead of building the rectangles you can build lines, and only keep the vertices that appear an odd number of times? Such as sort = #[[Last@FindShortestTour[#, DistanceFunction -> ManhattanDistance]]] & october2014[Values, {# - {1, 1}, #, # - {0, 1}, # - {1, 0}} &][ Apply[Join] /* Counts /* Select[OddQ] /* Keys /* sort /* Line /* ...


1

eps = 0.001; repl = (z_Symbol == val_) :> (val - eps/2 <= z <= val + eps/2); r1 = Line[{{0, 0}, {1, 0}}]; r2 = Line[{{1, 0}, {2, 0}}]; r3 = ImplicitRegion[RegionMember[ RegionUnion[r1, r2], {x, y}] // Simplify, {x, y}] /. repl ImplicitRegion[(x | y) \[Element] Reals && -0.0005 <= y <= 0.0005 && 0 <= x ...


1

Some really great answers. Mine is not as flashy but it took me a few hours to get it so I'm throwing it up nevertheless. I focused on making one month with the hope that I could make a month function and find a way to merge months together for a longer calendar (haven't gotten that far, yet). I've also gone the route of creating an item function for ...


7

ClearAll[mpbmdcg,ljr]; mpbmdcg[k_]:= Composition[MeshPrimitives[#,k]&, BoundaryMesh, DiscretizeGraphics, Graphics]; ljr = Composition[Line, Join[#, {#[[1]]}]&, Replace[#,Line[{a_,b_}]:>a, {0, Infinity}]&]; poly = First@mpbmdcg[2]@(Rectangle/@(-1+Normal[october2014[Values]])); fastdesc= FullSimplify[ Reduce[ ...


1

Bear in mind the element value is treated locally within ImplicitRegion so inserting an expression for the element is not straightforward, and an expression like ImplicitRegion[something]-1 doesn't yield a new ImplicitRegion directly. However, you can take advantage of a number of related built-in functions for testing and manipulation of a given ...


0

(version 10) I made function lastUnion , firstUnion and RectangleRegionSimplify instead of RegionSimplify. I think you might want to make RectangleRegionSimplify. lastUnion[coo_] := Flatten[Replace[SplitBy [ coo, Last], {f_, ___, l_} -> {f, l}, 1], 1] firstUnion[coo_] := Flatten[Replace[SplitBy [ coo, First], {f_, ___, l_} -> {f, l}, 1], 1] ...


4

This is your codes. days = <|DayRange[DateObject[{2014, 10, 5}], DateObject[{2014, 10, 11}]] // Map[DayName] // MapIndexed[#1 -> First[#2] &]|>; october2014 = <| DayRange[DateObject[{2014, 10, 1}], DateObject[{2014, 10, 31}]] // MapIndexed[#1 -> {days[DayName[#1]], -1 - Quotient[-days[DayName[#1]] + ...



Top 50 recent answers are included