Skip to main content
14 votes
Accepted

How to Discretize a Tube

It took quite a while, but I've finally come up with a way to generate discretized tubes. This again is based on work in this previous answer (from the thread mentioned earlier by Michael). In the ...
J. M.'s missing motivation's user avatar
12 votes
Accepted

What is the best way to parse differential equations and boundary conditions to a custom function?

Assuming everything is syntactically correct, the function that does what you want is Internal`ProcessEquations`SeparateEquations: ...
Michael E2's user avatar
  • 237k
9 votes

How to generate grid points on boundary of $[-1,1]^d$ for arbitrary dimension $d$ and specified resolution?

Since version 10.1, there has been a built-in function CoordinateBoundsArray to do this kind of thing. It is readily adapted to your special case. ...
m_goldberg's user avatar
  • 108k
8 votes
Accepted

How to generate grid points on boundary of $[-1,1]^d$ for arbitrary dimension $d$ and specified resolution?

Here's a pretty general solution. This generates the desired boundary lattice points in $[0,1]^d$; apply Rescale[] as needed: ...
J. M.'s missing motivation's user avatar
8 votes

What is the best way to parse differential equations and boundary conditions to a custom function?

I'll just give an idea to make it easier to do this. Which is not to use the same API as NDSolve, as that requires much much more work to parse it. Instead, have ...
Nasser's user avatar
  • 146k
8 votes
Accepted

Get interior of mesh region

...
kglr's user avatar
  • 397k
7 votes
Accepted

DiscretizeRegion fails for a triangular region

Looks like you've uncovered a bug. I can confirm this behavior in 10.3.1 and 10.4. You can still discretize your region using DiscretizeGraphics though: ...
RunnyKine's user avatar
  • 33.2k
7 votes
Accepted

Creating Voronoi Mesh Region Bounded by Convex Hull (Possible problem with DiscretizeGraphics)

I'm not really sure what's going on, but I can provide a workaround. First, I notice if I just discretize the first 99 cells, I get the desired result 1 out of 3 times. Strange. ...
Greg Hurst's user avatar
  • 36.3k
7 votes
Accepted

How to discretize the boundary of two regions?

Here is an option using OpenCascadeLink. OpenCascade is an open source 3D CAD package that often does a better job retaining sharp features with boolean operations and seems to be fairly robust. <...
Tim Laska's user avatar
  • 16.4k
6 votes
Accepted

How to get a larger triangle when we discretize a sphere?

How about the following: a = BoundaryDiscretizeRegion[Ball[{0, 0, 0}, 1], MaxCellMeasure -> {"Length" -> 3}, PrecisionGoal -> 0.01] ...
Dunlop's user avatar
  • 4,023
6 votes
Accepted

How to apply `DiscretizeGraphics` to a tube?

A possible workaround (brought up by the Wizard in the comments) involves the use of some of the functions from this previous answer. In particular, you will need ...
J. M.'s missing motivation's user avatar
6 votes
Accepted

DiscretizeRegion was unable to discretize the region ImplicitRegion

You can use the Finite Element mesh generator. Needs["NDSolve`FEM`"] mesh = ToElementMesh[\[ScriptCapitalR]] That already gives a hint to what the problem is ...
user21's user avatar
  • 40k
6 votes

Computing volume of intersection of two regions

This is not ideal, but it gives an approximate resulting region. I first generate random points on the hexagon and add a random vector on the unit sphere. I take the convex hull of the points which is ...
flinty's user avatar
  • 25.5k
6 votes

How to discretize the boundary of two regions?

Here is a slightly different approach also using OpenCascadeLink ...
user21's user avatar
  • 40k
6 votes
Accepted

How to improve the solution of the following differential equation?

Actually the answer depends on parameters. The best what I get just playing with difference order and rational numbers is the following code ...
Alex Trounev's user avatar
  • 45.8k
6 votes
Accepted

How to get finer discretization of 3D polytope?

Edit I found that "Length" -> .2 work when we use ...
cvgmt's user avatar
  • 76.5k
5 votes
Accepted

Collision between a point and a square

Here is a function which you pass it the time, and will return True is point is inside the rectangle else False. This is based ...
Nasser's user avatar
  • 146k
5 votes
Accepted

Problem with ToBoundaryMesh

You could try this as a workaround for now: ...
user21's user avatar
  • 40k
5 votes
Accepted

Converting 3D graphics primitives to 3D image data

As I noted in the comments, a judicious combination of RegionImage[] and ImageMesh[] will yield suitable voxelizations of ...
J. M.'s missing motivation's user avatar
5 votes
Accepted

Unexpected behavior of DiscretizeGraphics

Text does not scale with the ImageSize. Try to manually resize graphics containing text (by dragging the handle). The text ...
Szabolcs's user avatar
  • 236k
5 votes

How to generate grid points on boundary of $[-1,1]^d$ for arbitrary dimension $d$ and specified resolution?

You could try something like this: generateGrid[dim_] := DeleteCases[Tuples[{-1, 0, 1}, dim], {0 ..}] For the case of specifying a resolution as well, try: <...
dr.blochwave's user avatar
  • 8,798
5 votes
Accepted

Finding NonlinearModelFit of multiple data sets with the same parameters and in two dimensions

If you restructure your datasets to have each row representing {x,t,y} with y as the response variable, it should be pretty ...
JimB's user avatar
  • 41.9k
5 votes
Accepted

Randomly distributed circles inside an annulus

Far from efficient, but we can adapt the Neat Example from the RegionDisjoint ref page. Note that a non-uniform distribution of radii would probably speed things up....
Greg Hurst's user avatar
  • 36.3k
5 votes

What is the best way to parse differential equations and boundary conditions to a custom function?

Here's a simpler way (simpler than my first answer) that I came up with today exploring a problem with DSolve. It calls ...
Michael E2's user avatar
  • 237k
5 votes
Accepted

Computing volume of intersection of two regions

Here is an approach based on creating exact regions: ...
user21's user avatar
  • 40k
5 votes
Accepted

Calculate surface normals at the boundary of a Graphics3D object

First of all, we need 2 more options in boundedOpenCone. The option BoundaryStyle -> Automatic creates a ...
xzczd's user avatar
  • 67k
5 votes
Accepted

Coarse mesh of a sphere

In this case DiscretizeGraphics does what you want: ...
Greg Hurst's user avatar
  • 36.3k
4 votes

Traverse "curve" on a grid from a given cell

a graph approach: ...
george2079's user avatar
4 votes
Accepted

Perpendicular chord lengths from the boundary points of an arbitary 2D shape

...
kglr's user avatar
  • 397k
4 votes
Accepted

Generating a grid such that the elements in each row add up to one

You can use IntegerPartitions, which (despite its name) also partitions rationals. Your problem is to partition the number 1 into a set of $d$ nonnegative integer ...
Roman's user avatar
  • 48.3k

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