Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'generating vectors with random orientations' topicStudent Support Forum > General > "generating vectors with random orientations"

< Previous CommentHelp | Reply To Comment | Reply To Topic
Author Comment/Response
Bo Le
10/02/03 01:13am

Hi,

A possible approach would be:

(1st) to generate n randomly orieanted vectors with length 1:

randomVectors[n_]:=Table[
With[{fi=2 \[Pi] Random[]},
{Cos[fi],Sin[fi]}],
{n}];


(2nd) to place the vectors on the plane and visualize them, choosing isotropically distributed origin:

visualizeVectors[vectors_]:=Show[
Graphics[
With[{x=5 Random[],y=3 Random[]},
Arrow[{x,y},{x,y}+#]]&/@vectors],
Frame\[Rule]True,
AspectRatio\[Rule]Automatic]


Note 5 and 3 in the setting of x and y, this is the domain. Note also you can use a pure Line object to visualize vectors.


Hope that helps?

Bo Le @ Slovenia

URL: ,

Subject (listing for 'generating vectors with random orientations')
Author Date Posted
generating vectors with random orientations Zoran T 09/25/03 07:55am
Re: generating vectors with random orientations Henry Lamb 09/30/03 01:00am
Re: generating vectors with random orientations Bo Le 10/02/03 01:13am
< Previous CommentHelp | Reply To Comment | Reply To Topic