Difference between revisions of "ZCubes/How to Apply Z Programming and Combinatorial Arguments"
(10 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
+ | ==Z Programming and Combinatorial Arguments== | ||
+ | <br/> | ||
+ | This video demonstrates how to enable functions to be able to process arrays of values, instead of single value arguments. Using the ‘arrayfy’ feature, the function that handles a set of parameters can handle a range of values for each parameter. This powerful feature of handling 'combinatorial arguments' opens up the possibility of evaluating functions for wide range of values without any changes to the function code. | ||
+ | |||
==Video== | ==Video== | ||
+ | <br/> | ||
+ | {{#ev:youtube|sH8X4M7d5WU|480|left|Z Programming and Combinatorial Arguments}} | ||
+ | <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/> | ||
+ | |||
+ | |||
+ | ==Examples== | ||
+ | Finding velocity : Final velocity (v) of an object equals initial velocity (u) of that object plus acceleration (a) of the object times the elapsed time (t) from u to v. For standard gravity, a = 9.80665 m/s2. | ||
+ | |||
+ | 1. To find the final velocity (V), use the ZCubes code as- | ||
+ | <br/> | ||
+ | <math>V := u+a*t;</math> | ||
+ | <br/> | ||
+ | <math>V(1,9.8,1)</math> | ||
+ | |||
+ | displays the result as ''10.8''. | ||
+ | |||
+ | |||
+ | 2. To find the final velocity(V) for array of values of 't' from 1 to 30, use the following ZCubes code as- | ||
+ | <br/> | ||
+ | <math>V := u+a*t;</math> | ||
+ | <br/> | ||
+ | <math>V arr;</math> //typing arr and pressing Shift+Space key gives an character '#' | ||
+ | <br/> | ||
+ | <math>V(1,9.8,1..30)</math> | ||
+ | |||
+ | displays the final velocity values with varying inputs of time as: | ||
+ | <br/> | ||
+ | u t V | ||
+ | <br/> 9.8 1 10.8 | ||
+ | <br/> 9.8 2 20.6 | ||
+ | <br/> 9.8 3 30.400000000000002 | ||
+ | <br/> 9.8 4 40.2 | ||
+ | <br/> 9.8 5 50 | ||
+ | <br/> 9.8 6 59.800000000000004 | ||
+ | <br/> 9.8 7 69.60000000000001 | ||
+ | <br/> 9.8 8 79.4 | ||
+ | <br/> 9.8 9 89.2 | ||
+ | <br/> 9.8 10 99 | ||
+ | <br/> 9.8 11 108.80000000000001 | ||
+ | <br/> 9.8 12 118.60000000000001 | ||
+ | <br/> 9.8 13 128.4 | ||
+ | <br/> 9.8 14 138.20000000000002 | ||
+ | <br/> 9.8 15 148 | ||
+ | <br/> 9.8 16 157.8 | ||
+ | <br/> 9.8 17 167.60000000000002 | ||
+ | <br/> 9.8 18 177.4 | ||
+ | <br/> 9.8 19 187.20000000000002 | ||
+ | <br/> 9.8 20 197 | ||
+ | <br/> 9.8 21 206.8 | ||
+ | <br/> 9.8 22 216.60000000000002 | ||
+ | <br/> 9.8 23 226.4 | ||
+ | <br/> 9.8 24 236.20000000000002 | ||
+ | <br/> 9.8 25 246.00000000000003 | ||
+ | <br/> 9.8 26 255.8 | ||
+ | <br/> 9.8 27 265.6 | ||
+ | <br/> 9.8 28 275.40000000000003 | ||
+ | <br/> 9.8 29 285.20000000000005 | ||
+ | <br/> 9.8 30 295 | ||
+ | |||
+ | |||
+ | 3. To find the final velocity(V) for array of values of 't' and 'u' from 1 to 30, use the following ZCubes code as- | ||
+ | <br/> | ||
+ | <math>V := u+a*t;</math> | ||
+ | <br/> | ||
+ | <math>V arr;</math> //typing arr and pressing Shift+Space key gives an character '#' | ||
+ | <br/> | ||
+ | <math>V(1..30,9.8,1..30)</math> | ||
+ | |||
+ | |||
− | |||
− | + | <br/> | |
+ | *[[Z3 | Z3 home]] | ||
+ | *[[Z^3 Language Documentation]] | ||
+ | *[[ZCubes_Videos | ZCubes Videos and Tutorials]] | ||
+ | *[[Main_Page | About ZCubes ]] | ||
+ | <br/> | ||
+ | <br/> | ||
+ | © Copyright 1996-2020, ZCubes, Inc. |
Latest revision as of 13:08, 14 September 2021
Z Programming and Combinatorial Arguments
This video demonstrates how to enable functions to be able to process arrays of values, instead of single value arguments. Using the ‘arrayfy’ feature, the function that handles a set of parameters can handle a range of values for each parameter. This powerful feature of handling 'combinatorial arguments' opens up the possibility of evaluating functions for wide range of values without any changes to the function code.
Video
Examples
Finding velocity : Final velocity (v) of an object equals initial velocity (u) of that object plus acceleration (a) of the object times the elapsed time (t) from u to v. For standard gravity, a = 9.80665 m/s2.
1. To find the final velocity (V), use the ZCubes code as-
displays the result as 10.8.
2. To find the final velocity(V) for array of values of 't' from 1 to 30, use the following ZCubes code as-
//typing arr and pressing Shift+Space key gives an character '#'
displays the final velocity values with varying inputs of time as:
u t V
9.8 1 10.8
9.8 2 20.6
9.8 3 30.400000000000002
9.8 4 40.2
9.8 5 50
9.8 6 59.800000000000004
9.8 7 69.60000000000001
9.8 8 79.4
9.8 9 89.2
9.8 10 99
9.8 11 108.80000000000001
9.8 12 118.60000000000001
9.8 13 128.4
9.8 14 138.20000000000002
9.8 15 148
9.8 16 157.8
9.8 17 167.60000000000002
9.8 18 177.4
9.8 19 187.20000000000002
9.8 20 197
9.8 21 206.8
9.8 22 216.60000000000002
9.8 23 226.4
9.8 24 236.20000000000002
9.8 25 246.00000000000003
9.8 26 255.8
9.8 27 265.6
9.8 28 275.40000000000003
9.8 29 285.20000000000005
9.8 30 295
3. To find the final velocity(V) for array of values of 't' and 'u' from 1 to 30, use the following ZCubes code as-
//typing arr and pressing Shift+Space key gives an character '#'
© Copyright 1996-2020, ZCubes, Inc.