GE - Greater/Equal Test
Usage
|
logical = GE ( npt1 npt2 ) |
|
res = GE ( npt1 npt2 truept falsept ) |
Parameters
|
logical |
Logical:TRUE or FALSE depending on the result of the comparison. |
|
npt1 |
A numerical point. |
|
npt2 |
A numerical point. |
|
truept |
An optional point to be returned if npt1 is greater than or equal to npt2. |
|
truept |
An optional point to be returned if npt1 is not greater than or equal to npt2. |
Description
This module returns true if the first argument is greater than or equal to the second and false otherwise. GE may also be used in a four value mode, see EQ for a description.
See Real for details on comparing floating point numbers.
Examples
|
GE(100 Real:100.2) |
results in Logical:FALSE |
|
GE(100 Real:100.2 hohoho boohoo) |
results in NId:boohoo |
|
GE(10 5 @{1 + 2} @{3 + 4}) |
results in Int:3 (use quote to prevent unneccessary evaluations) |
Geo - Perform Geocoordinate Functions
Usage
|
value = Geo ( geo1 [[geo2] geo3] tag ) |
Parameters
|
geo1 |
A geocoordinate |
|
geo2 |
An optional second geocoordinate |
|
geo3 |
An optional third geocoordinate |
|
tag |
One of the optional tagged arguments |
Tagged Arguments
|
Dawn::date |
Returns the approximate time of dawn/sunrise for date and the location specified in the first argument. |
|
Distance::fraction |
Returns the geocoordinate between the two coordinates that is a fraction of the distance between the two. The fraction is a number between 0 and 1 with 0 representing the first coordinate and 1 the second. A fraction of 0.5 represents halfway between the two. |
|
Dusk::date |
Similar to Dawn but returns the time of dusk/sunset. |
|
Grid::num |
Determines the position of geo1 within a grid of num by num cells with an upper left corner defined by geo2 and a lower right corner defined by geo3. If num is an Int2 point then the first number is the number of rows in the grid and the second is the number of columns. The result is an Int2 point of the form Int2:<row column>. |
|
LunarAltitude::cal |
Returns the lunar altitude at the location specified by geo1 at the date-time given by cal. The result varies between -180 and +180 degrees. Moon rise and moon set correspond to zero degrees. If the first argument is a UDate or DateTime point then it is with respect to GMT, not local time. |
|
UOM::units |
Specifies the unit-of-measure when Distance? is requested. The units value is determined by the entries in v4LanguageInfo.v4i in the v4_home directory. For English, the default units are M and MTR for meters, KM for kilometers (default), MI and MILES for miles, FT and FEET for feet, YD and YARDS for yards, NM and NMILES for nautical miles. Conversion to other units-of-measure can be found here. |
Tagged Results
|
Direction? |
Return the direction (from north) of the second geocoordinate with respect to the first. The result is in degrees. |
|
Distance? |
Return the distance between the two geocoordinates. The unit-of-measure can be set with the UOM tag option. The default is kilometers. |
Description
This module performs various operations on its arguments.
Note that for the Dawn and Dusk options a complete geocoordinate is necessary (i.e. one with latitude, longitude, elevation, and time zone). The elevation is defaulted to 0 and the time zone is approximated from the longitude if missing.
|
Geo(G:(40 01.052N 75 15.613W) G:(40 04.476N 75 24.630W) Distance?) |
results in Num:14.2798625581959 |
|
Geo(G:(40.1 -88.2) G:(21 25N 39 49E) Direction?) |
results in Num:40 - the direction from Urbana IL to Mecca |
|
Geo(G:(40.0209 -76.26 150) Dawn::UDate:030320) |
UCal:20-Mar-2003:06:07:03 - the time of dawn in Philadelphia,PA on 20-Mar-2003 |
|
Geo(G:(40.2723 75.7620) G:(39.8187 74.8838) distance::0.50) |
G:(40.0447 75.325 0 -) |
GraphConnect - Connect Two Nodes on a Graph
Usage
|
result = GraphConnect ( list tagarg ) |
|
result = GraphConnect ( tagarg ) |
Parameters
|
result |
The result varies on the arguments. It may be a list of nodes, or a list of lists when there are multiple connections. |
Tagged Arguments
|
AWhile::logical |
Evaluate logical after each point in the Enum list. If the result of the evaluation is true then continue otherwise terminate. Note that this argument is tested after each point. While::isct is used to test before each point. |
|
Begin::node |
Defines the starting node for the connection |
|
Context::point |
For each enumeration point, V4 evaluates and inserts the point into the current context. If the point is UV4:none then nothing is done (i.e. UV4:none is not placed into the context). This point can be inserted into the context by quoting it: Context::@UV4:none. If point is UV4:Skip the current point is ignored entirely. |
|
ContextP::point |
This is identical to the Context tag except that if point evaluates to a list then each point in the list is inserted into the context. |
|
Depth::num |
Limits the depth of the connection to a maximum of num nodes. |
|
Distance::dim |
The total path distance is 'returned' as a point in the context on dimension dim. This dimension must be of type Integer or Real. This option only applies when performing the traveling salesman analysis. |
|
Edge::node |
Defines the start and end nodes of an edge. The first Edge defines the beginning node and the second occurrence defines the ending node. At least two Edge arguments must be given. Any more than two assumes that the next edge is connected to the prior. |
|
End::node |
The ending or target node in the connection. |
|
Enum::list |
The edges of the graph are to be determined by iterating through the list and evaluating the Edge points for each element of the list. |
|
If::logical |
Used in conjunction with the Enum argument to restrict points to those in which logical evaluates to TRUE. |
|
Maximum::weight |
Specifies the weight of an edge and that the best connection between the start and end nodes is one that maximizes this weight. |
|
Metric::logical |
If TRUE (default) then distances on traveling salesman analysis with geocoordinates are in kilometers, if FALSE then in miles. |
|
Minimum::weight |
Similar to Max except that the best connection is the one minimizing the edge weights. |
|
OneWay::logical |
If this tag is given then it is evaluated for each edge in the graph. If the evaluation of logical is TRUE then the edge is considered to be one-way. If it is FALSE or the OneWay tag is not given then the edge is assumed to be two-way. |
|
Parent::pt |
Specifies the parent point. See Enum for a complete description. |
|
PIf::isct |
Specifies a test based on the parent. See Enum for a complete description. |
|
Result::num |
Return up to a maximum of num resultant connections. |
|
Route::num |
The number of iterations to optimize on traveling salesman route through all nodes. |
|
Until::isct |
isct is evaluated for each point in the list. If the result is false, then Enum continues. If it is true, Enum immediately stops processing the point and all subsequent points. |
|
While::isct |
isct is evaluated for each point in the list. If the result is true, then Enum continues. If it is false, Enum immediately stops processing the point and all subsequent points. |
|
X::isct |
isct is evaluated for each point in the list to obtain the X coordinate of a node (Traveling Salesman Analysis only). |
|
Y::isct |
isct is evaluated for each point in the list to obtain the Y coordinate of a node (Traveling Salesman Analysis only). |
Description
This module performs two basic analyses. The first is determining a path from one point on a graph to another. The second type of analysis is know as the Traveling Salesman Problem. This analysis returns the shortest path to take to visit all nodes in a graph. Note that the algorithm used is not guarenteed to return the theoretical shortest path as this becomes prohibitively expensive as the number of nodes increases (on the order of N! where N is the number of nodes!). See the Wikipedia article or here for more information on the general problem.
This first use of this module is as a generalized function for finding one or more connections in a graph. The edges of a graph may be weighted with the search returning connections with minimal and/or maximal weights. The module can search for several min/max solutions at once. Typical uses include finding the shortest (in time or distance) path between two points in a geocoordinate database.
The traveling salesman analysis is triggered when the Route option is given. This specifies the number of iterations to take to find the shortest path. The greater the number of iterations, the better the chances of getting the optimal solution. The handling of nodes is slightly different in this mode of the function. The iterating list can take on three different forms. If the elements are Int2 points then they are assumed to be points on an X-Y plane. If the elements are Geocoordinates then those are the assumed positions of the nodes. Any other type of point is injected into the context and the X and Y arguments are evaluated to obtain the X and Y coordinates for that node.
|
[Nodes] ( Int2:<3 4> :<1 1> :<6 6> :<3 2> :<5 5> :<0 5> :<1 3> :<6 2> :<3 6> :<4 3>) |
Define a set of points on an X-Y plane |
|
GraphConnect([Nodes] Route::10 Distance::Num) |
Calculate shortest path and return as a list, Num* updated with total path length |
|
List([Nodes] Nth::Int*)/GraphConnect([Nodes] Route::10) |
Same as above but list the X-Y positions |
GT - Greater/Than Test
Usage
|
logical = GT ( npt1 npt2 ) |
|
res = GT ( npt1 npt2 truept falsept ) |
Parameters
|
logical |
Logical:TRUE or FALSE depending on the result of the comparison. |
|
npt1 |
A numerical point. |
|
npt2 |
A numerical point. |
Description
The GT module returns logical true if the first argument is greater than the second.
See Real for details on comparing floating point numbers.
Examples
|
GT(100 Real:100.2) |
Logical:FALSE |
GuiAlert - Display an alert box with message
Usage
|
value = GuiAlert ( message ) |
Parameters
|
value |
This module always returns Logical:True. |
|
message |
The message to be displayed. |
Description
This module opens up an alert window displaying the specified message. The user must click the OK button in the window to close the window and resume the V4 process. If multiple arguments are given then they are concatenated into a single message string.
Currently this module is supported only on Windows-based operating systems.
Examples
|
GuiAlert(Str("The value of Student* is " Student*))
|
|
GuiAlert("The value of Student* is " Student*) |
same as above |
GuiMsgBox - Display a popup message window
Usage
|
button = GuiMsgBox ( tag ) |
Parameters
|
button |
A point on Dim:UV4 indicating which button was clicked to close the window. The value will be one of the following: ABORT, CANCEL, IGNORE, NO, OK, RETRY, or YES. |
|
tag |
One or more of the following tagged arguments. |
Tagged Arguments
|
Filter::list |
A list of lists used with the FileOpen and FileSave message box types. Each element of list must itself be a list containing two components: the first being a text description and the second being a file extension. These extensions and corresponding descriptions appear in the file open box as possible selection filters. |
|
Icon::type |
Defines the type of icon to be displayed in the window. type must be one of: Exclamation, Hand, Information, Question, or Stop. |
|
Message::text |
The message to be displayed in the window. A non-tagged text string is also assumed to be the message. |
|
Title::text |
The window title, the default value is V4 Message. |
|
Type::type |
Determines the type of message box and buttons available to close the window. The type must be one of: AbortRetryIgnore, OK, FileOpen, FileSave, RetryCancel, YesNo, or YesNoCancel. |
Description
The GuiMsgBox module pops up a message box and suspends V4 processing until the user acknowledges and closes the window. The value returned is determined by the button clicked by the user to close the window.
Currently this module is supported only on Windows-based operating systems.
Examples
|
GuiMsgBox("Do you want to continue?" Type::YesNo) |
Returns UV4:Yes or UV4:No depending on the user's response. Note that a non-tagged text string is assumed to be the message. |