Graphing random points on the XY-planeHow to generate random points in a region?How one can make the boundary...
Should we avoid writing fiction about historical events without extensive research?
I've given my players a lot of magic items. Is it reasonable for me to give them harder encounters?
Meaning of word ягоза
How can I handle a player who pre-plans arguments about my rulings on RAW?
Make me a metasequence
How do we objectively assess if a dialogue sounds unnatural or cringy?
Caulking a corner instead of taping with joint compound?
Why are special aircraft used for the carriers in the United States Navy?
Why won't the strings command stop?
Can I solder 12/2 Romex to extend wire 5 ft?
Can the Shape Water Cantrip be used to manipulate blood?
Rationale to prefer local variables over instance variables?
Are all UTXOs locked by an address spent in a transaction?
Reason why dimensional travelling would be restricted
“I had a flat in the centre of town, but I didn’t like living there, so …”
GPL code private and stolen
Practical reasons to have both a large police force and bounty hunting network?
Correct physics behind the colors on CD (compact disc)?
Quitting employee has privileged access to critical information
PTIJ: What dummy is the Gemara referring to?
3.5% Interest Student Loan or use all of my savings on Tuition?
Is there a full canon version of Tyrion's jackass/honeycomb joke?
Can a Trickery Domain cleric cast a spell through the Invoke Duplicity clone while inside a Forcecage?
When was drinking water recognized as crucial in marathon running?
Graphing random points on the XY-plane
How to generate random points in a region?How one can make the boundary of the regionplot smaller or bigger?Put random points into a specific 2D subregionHow to draw the trajectory of a moving particleRandomPoint in geographic region from Polygon[region_]?How to generate a random pulsar graph between two points?Bounded random walkRandom points on the Cuboid, and using FindShortestTourIntersection between knot and planeDisplaying Points and Lines in 3DGraphing a cylinder packing in 3D
$begingroup$
I am trying to generate around 10-20 points on the xy- plane in the domain $[-10,10]times[-10,10]$ (in 3D) and I am having trouble. I want to draw the plane in 3D, graph the random (they do not have to be random but at least nicely dispersed) points, and then graph vertical lines through these points. I found this How to generate random points in a region? and tried to adopt it for a plane in 3D but since i am very new to Mathematica I cannot seem to make it work. I am aware of the RandomPoint command but the problem is i need to describe the region and I do not know how to describe the region of xy-plane. I tried z=0 but I think it only accepts "worded" regions.
Any help would be appreciated.
plotting graphics3d random
New contributor
$endgroup$
add a comment |
$begingroup$
I am trying to generate around 10-20 points on the xy- plane in the domain $[-10,10]times[-10,10]$ (in 3D) and I am having trouble. I want to draw the plane in 3D, graph the random (they do not have to be random but at least nicely dispersed) points, and then graph vertical lines through these points. I found this How to generate random points in a region? and tried to adopt it for a plane in 3D but since i am very new to Mathematica I cannot seem to make it work. I am aware of the RandomPoint command but the problem is i need to describe the region and I do not know how to describe the region of xy-plane. I tried z=0 but I think it only accepts "worded" regions.
Any help would be appreciated.
plotting graphics3d random
New contributor
$endgroup$
$begingroup$
If you want to useRandomPoint
, there'sImplicitRegion
:RandomPoint[ ImplicitRegion[Abs@x < 10 && Abs@y < 10 && z == 0, {x, y, z}], 100]
will give you 100 points in the specified region. Alternatively, you could also generate points in 2D usingRandomReal[10,{100,2}]
and add the z coordinate usingAppend[0]/@pts
$endgroup$
– Lukas Lang
yesterday
add a comment |
$begingroup$
I am trying to generate around 10-20 points on the xy- plane in the domain $[-10,10]times[-10,10]$ (in 3D) and I am having trouble. I want to draw the plane in 3D, graph the random (they do not have to be random but at least nicely dispersed) points, and then graph vertical lines through these points. I found this How to generate random points in a region? and tried to adopt it for a plane in 3D but since i am very new to Mathematica I cannot seem to make it work. I am aware of the RandomPoint command but the problem is i need to describe the region and I do not know how to describe the region of xy-plane. I tried z=0 but I think it only accepts "worded" regions.
Any help would be appreciated.
plotting graphics3d random
New contributor
$endgroup$
I am trying to generate around 10-20 points on the xy- plane in the domain $[-10,10]times[-10,10]$ (in 3D) and I am having trouble. I want to draw the plane in 3D, graph the random (they do not have to be random but at least nicely dispersed) points, and then graph vertical lines through these points. I found this How to generate random points in a region? and tried to adopt it for a plane in 3D but since i am very new to Mathematica I cannot seem to make it work. I am aware of the RandomPoint command but the problem is i need to describe the region and I do not know how to describe the region of xy-plane. I tried z=0 but I think it only accepts "worded" regions.
Any help would be appreciated.
plotting graphics3d random
plotting graphics3d random
New contributor
New contributor
edited yesterday
m_goldberg
87.4k872198
87.4k872198
New contributor
asked yesterday
SorfoshSorfosh
1403
1403
New contributor
New contributor
$begingroup$
If you want to useRandomPoint
, there'sImplicitRegion
:RandomPoint[ ImplicitRegion[Abs@x < 10 && Abs@y < 10 && z == 0, {x, y, z}], 100]
will give you 100 points in the specified region. Alternatively, you could also generate points in 2D usingRandomReal[10,{100,2}]
and add the z coordinate usingAppend[0]/@pts
$endgroup$
– Lukas Lang
yesterday
add a comment |
$begingroup$
If you want to useRandomPoint
, there'sImplicitRegion
:RandomPoint[ ImplicitRegion[Abs@x < 10 && Abs@y < 10 && z == 0, {x, y, z}], 100]
will give you 100 points in the specified region. Alternatively, you could also generate points in 2D usingRandomReal[10,{100,2}]
and add the z coordinate usingAppend[0]/@pts
$endgroup$
– Lukas Lang
yesterday
$begingroup$
If you want to use
RandomPoint
, there's ImplicitRegion
: RandomPoint[ ImplicitRegion[Abs@x < 10 && Abs@y < 10 && z == 0, {x, y, z}], 100]
will give you 100 points in the specified region. Alternatively, you could also generate points in 2D using RandomReal[10,{100,2}]
and add the z coordinate using Append[0]/@pts
$endgroup$
– Lukas Lang
yesterday
$begingroup$
If you want to use
RandomPoint
, there's ImplicitRegion
: RandomPoint[ ImplicitRegion[Abs@x < 10 && Abs@y < 10 && z == 0, {x, y, z}], 100]
will give you 100 points in the specified region. Alternatively, you could also generate points in 2D using RandomReal[10,{100,2}]
and add the z coordinate using Append[0]/@pts
$endgroup$
– Lukas Lang
yesterday
add a comment |
2 Answers
2
active
oldest
votes
$begingroup$
You can use RandomPoint with InfinitePlane and draw lines using InfiniteLine:
plane = InfinitePlane[{{0, 0, 0}, {1, 0, 0}, {0, 1, 0}}];
pts = RandomPoint[plane, 20, {{-10, 10}, {-10, 10}, {0, 0}}];
Graphics3D[{plane, Red, InfiniteLine[#, {0, 0, 1}] & /@ pts, Blue,
Sphere[pts, .1]}, PlotRange -> {{-10, 10}, {-10, 10}, {-5, 5}}]
$endgroup$
$begingroup$
Wow, that is perfect. Now if i wanted to change the direction vector of the line depending on the points, how would i do that? I tried changing ${0,0,1}$ to ${#[[2]], #[[1]], sqrt[#[[2]]^2 + #[[1]]^2]}$ but that didn't work.
$endgroup$
– Sorfosh
yesterday
1
$begingroup$
@Sorfosh it works fine to me. Did you type sqrt instead Sqrt ?
$endgroup$
– halmir
yesterday
$begingroup$
oh... wow. I forgot it is case sensitive. Thank you! :P
$endgroup$
– Sorfosh
yesterday
add a comment |
$begingroup$
Maybe this will work for you.
First define a function for generating $n$ random points on the xy-plane.
pts[n_] := {#1, #2, 0} & @@@ RandomReal[{-10., 10.}, {n, 2}]
Then
SeedRandom[42];
Module[{n = 20, p0} ,
p0 = pts[n];
Graphics3D[
{{AbsolutePointSize[4], Point[p0]},
{Red, Thick, HalfLine[#, {0, 0, 1}] & /@ p0}},
PlotRange -> {{-10, 10}, {-10, 10}, {0, 10}}]]
$endgroup$
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "387"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sorfosh is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f192670%2fgraphing-random-points-on-the-xy-plane%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
You can use RandomPoint with InfinitePlane and draw lines using InfiniteLine:
plane = InfinitePlane[{{0, 0, 0}, {1, 0, 0}, {0, 1, 0}}];
pts = RandomPoint[plane, 20, {{-10, 10}, {-10, 10}, {0, 0}}];
Graphics3D[{plane, Red, InfiniteLine[#, {0, 0, 1}] & /@ pts, Blue,
Sphere[pts, .1]}, PlotRange -> {{-10, 10}, {-10, 10}, {-5, 5}}]
$endgroup$
$begingroup$
Wow, that is perfect. Now if i wanted to change the direction vector of the line depending on the points, how would i do that? I tried changing ${0,0,1}$ to ${#[[2]], #[[1]], sqrt[#[[2]]^2 + #[[1]]^2]}$ but that didn't work.
$endgroup$
– Sorfosh
yesterday
1
$begingroup$
@Sorfosh it works fine to me. Did you type sqrt instead Sqrt ?
$endgroup$
– halmir
yesterday
$begingroup$
oh... wow. I forgot it is case sensitive. Thank you! :P
$endgroup$
– Sorfosh
yesterday
add a comment |
$begingroup$
You can use RandomPoint with InfinitePlane and draw lines using InfiniteLine:
plane = InfinitePlane[{{0, 0, 0}, {1, 0, 0}, {0, 1, 0}}];
pts = RandomPoint[plane, 20, {{-10, 10}, {-10, 10}, {0, 0}}];
Graphics3D[{plane, Red, InfiniteLine[#, {0, 0, 1}] & /@ pts, Blue,
Sphere[pts, .1]}, PlotRange -> {{-10, 10}, {-10, 10}, {-5, 5}}]
$endgroup$
$begingroup$
Wow, that is perfect. Now if i wanted to change the direction vector of the line depending on the points, how would i do that? I tried changing ${0,0,1}$ to ${#[[2]], #[[1]], sqrt[#[[2]]^2 + #[[1]]^2]}$ but that didn't work.
$endgroup$
– Sorfosh
yesterday
1
$begingroup$
@Sorfosh it works fine to me. Did you type sqrt instead Sqrt ?
$endgroup$
– halmir
yesterday
$begingroup$
oh... wow. I forgot it is case sensitive. Thank you! :P
$endgroup$
– Sorfosh
yesterday
add a comment |
$begingroup$
You can use RandomPoint with InfinitePlane and draw lines using InfiniteLine:
plane = InfinitePlane[{{0, 0, 0}, {1, 0, 0}, {0, 1, 0}}];
pts = RandomPoint[plane, 20, {{-10, 10}, {-10, 10}, {0, 0}}];
Graphics3D[{plane, Red, InfiniteLine[#, {0, 0, 1}] & /@ pts, Blue,
Sphere[pts, .1]}, PlotRange -> {{-10, 10}, {-10, 10}, {-5, 5}}]
$endgroup$
You can use RandomPoint with InfinitePlane and draw lines using InfiniteLine:
plane = InfinitePlane[{{0, 0, 0}, {1, 0, 0}, {0, 1, 0}}];
pts = RandomPoint[plane, 20, {{-10, 10}, {-10, 10}, {0, 0}}];
Graphics3D[{plane, Red, InfiniteLine[#, {0, 0, 1}] & /@ pts, Blue,
Sphere[pts, .1]}, PlotRange -> {{-10, 10}, {-10, 10}, {-5, 5}}]
edited yesterday
answered yesterday
halmirhalmir
10.3k2543
10.3k2543
$begingroup$
Wow, that is perfect. Now if i wanted to change the direction vector of the line depending on the points, how would i do that? I tried changing ${0,0,1}$ to ${#[[2]], #[[1]], sqrt[#[[2]]^2 + #[[1]]^2]}$ but that didn't work.
$endgroup$
– Sorfosh
yesterday
1
$begingroup$
@Sorfosh it works fine to me. Did you type sqrt instead Sqrt ?
$endgroup$
– halmir
yesterday
$begingroup$
oh... wow. I forgot it is case sensitive. Thank you! :P
$endgroup$
– Sorfosh
yesterday
add a comment |
$begingroup$
Wow, that is perfect. Now if i wanted to change the direction vector of the line depending on the points, how would i do that? I tried changing ${0,0,1}$ to ${#[[2]], #[[1]], sqrt[#[[2]]^2 + #[[1]]^2]}$ but that didn't work.
$endgroup$
– Sorfosh
yesterday
1
$begingroup$
@Sorfosh it works fine to me. Did you type sqrt instead Sqrt ?
$endgroup$
– halmir
yesterday
$begingroup$
oh... wow. I forgot it is case sensitive. Thank you! :P
$endgroup$
– Sorfosh
yesterday
$begingroup$
Wow, that is perfect. Now if i wanted to change the direction vector of the line depending on the points, how would i do that? I tried changing ${0,0,1}$ to ${#[[2]], #[[1]], sqrt[#[[2]]^2 + #[[1]]^2]}$ but that didn't work.
$endgroup$
– Sorfosh
yesterday
$begingroup$
Wow, that is perfect. Now if i wanted to change the direction vector of the line depending on the points, how would i do that? I tried changing ${0,0,1}$ to ${#[[2]], #[[1]], sqrt[#[[2]]^2 + #[[1]]^2]}$ but that didn't work.
$endgroup$
– Sorfosh
yesterday
1
1
$begingroup$
@Sorfosh it works fine to me. Did you type sqrt instead Sqrt ?
$endgroup$
– halmir
yesterday
$begingroup$
@Sorfosh it works fine to me. Did you type sqrt instead Sqrt ?
$endgroup$
– halmir
yesterday
$begingroup$
oh... wow. I forgot it is case sensitive. Thank you! :P
$endgroup$
– Sorfosh
yesterday
$begingroup$
oh... wow. I forgot it is case sensitive. Thank you! :P
$endgroup$
– Sorfosh
yesterday
add a comment |
$begingroup$
Maybe this will work for you.
First define a function for generating $n$ random points on the xy-plane.
pts[n_] := {#1, #2, 0} & @@@ RandomReal[{-10., 10.}, {n, 2}]
Then
SeedRandom[42];
Module[{n = 20, p0} ,
p0 = pts[n];
Graphics3D[
{{AbsolutePointSize[4], Point[p0]},
{Red, Thick, HalfLine[#, {0, 0, 1}] & /@ p0}},
PlotRange -> {{-10, 10}, {-10, 10}, {0, 10}}]]
$endgroup$
add a comment |
$begingroup$
Maybe this will work for you.
First define a function for generating $n$ random points on the xy-plane.
pts[n_] := {#1, #2, 0} & @@@ RandomReal[{-10., 10.}, {n, 2}]
Then
SeedRandom[42];
Module[{n = 20, p0} ,
p0 = pts[n];
Graphics3D[
{{AbsolutePointSize[4], Point[p0]},
{Red, Thick, HalfLine[#, {0, 0, 1}] & /@ p0}},
PlotRange -> {{-10, 10}, {-10, 10}, {0, 10}}]]
$endgroup$
add a comment |
$begingroup$
Maybe this will work for you.
First define a function for generating $n$ random points on the xy-plane.
pts[n_] := {#1, #2, 0} & @@@ RandomReal[{-10., 10.}, {n, 2}]
Then
SeedRandom[42];
Module[{n = 20, p0} ,
p0 = pts[n];
Graphics3D[
{{AbsolutePointSize[4], Point[p0]},
{Red, Thick, HalfLine[#, {0, 0, 1}] & /@ p0}},
PlotRange -> {{-10, 10}, {-10, 10}, {0, 10}}]]
$endgroup$
Maybe this will work for you.
First define a function for generating $n$ random points on the xy-plane.
pts[n_] := {#1, #2, 0} & @@@ RandomReal[{-10., 10.}, {n, 2}]
Then
SeedRandom[42];
Module[{n = 20, p0} ,
p0 = pts[n];
Graphics3D[
{{AbsolutePointSize[4], Point[p0]},
{Red, Thick, HalfLine[#, {0, 0, 1}] & /@ p0}},
PlotRange -> {{-10, 10}, {-10, 10}, {0, 10}}]]
edited yesterday
answered yesterday
m_goldbergm_goldberg
87.4k872198
87.4k872198
add a comment |
add a comment |
Sorfosh is a new contributor. Be nice, and check out our Code of Conduct.
Sorfosh is a new contributor. Be nice, and check out our Code of Conduct.
Sorfosh is a new contributor. Be nice, and check out our Code of Conduct.
Sorfosh is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Mathematica Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f192670%2fgraphing-random-points-on-the-xy-plane%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
$begingroup$
If you want to use
RandomPoint
, there'sImplicitRegion
:RandomPoint[ ImplicitRegion[Abs@x < 10 && Abs@y < 10 && z == 0, {x, y, z}], 100]
will give you 100 points in the specified region. Alternatively, you could also generate points in 2D usingRandomReal[10,{100,2}]
and add the z coordinate usingAppend[0]/@pts
$endgroup$
– Lukas Lang
yesterday