Difference between revisions of "Array Function Example Variables"
(Created page with "Category: Analytica User Guide These are example variables that are used in More Array Functions.") |
|||
(12 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
[[Category: Analytica User Guide]] | [[Category: Analytica User Guide]] | ||
− | These are example variables that are used in [[ | + | [[Category: Variables]] |
+ | <breadcrumbs>Analytica User Guide > Array functions > {{PAGENAME}}</breadcrumbs> | ||
+ | |||
+ | |||
+ | These are example variables that are used in [[Array functions]]. | ||
+ | |||
+ | :<code>Index Car_type := ['VW', 'Honda', 'BMW']</code> | ||
+ | :<code>Index Years := 2005 .. 2009</code> | ||
+ | :<code>Index Time := 0 .. 4</code> | ||
+ | :<code>Index CarNum := 1 .. 7</code> | ||
+ | :<code>Index MaintType := ['Repair', 'Scheduled', 'Tires']</code> | ||
+ | |||
+ | :<code>Variable Car_prices :=</code> | ||
+ | :{| class="wikitable" border="1" | ||
+ | ! !! colspan="5" style="text-align: left;" | Years ▶ | ||
+ | |- | ||
+ | ! style="width:100px;" |'''Car_type ▼ ''' | ||
+ | ! style="width:75px;" |'''2005 ''' | ||
+ | ! style="width:75px;" |'''2006 ''' | ||
+ | ! style="width:75px;" |'''2007 ''' | ||
+ | ! style="width:75px;" |'''2008 ''' | ||
+ | ! style="width:75px;" |'''2009 ''' | ||
+ | |- | ||
+ | !'''VW''' | ||
+ | | $16,000 | ||
+ | | $17,000 | ||
+ | | $18,000 | ||
+ | | $19,000 | ||
+ | | $20,000 | ||
+ | |- | ||
+ | !'''Honda ''' | ||
+ | | $18,000 | ||
+ | | $19,000 | ||
+ | | $20,000 | ||
+ | | $22,000 | ||
+ | | $24,000 | ||
+ | |- | ||
+ | !'''BMW''' | ||
+ | | $25,000 | ||
+ | | $26,000 | ||
+ | | $28,000 | ||
+ | | $30,000 | ||
+ | | $32,000 | ||
+ | |} | ||
+ | |||
+ | :<code>Variable Miles :=</code> | ||
+ | :{| class="wikitable" border="1" | ||
+ | ! !! colspan="5" style="text-align: left;" | Years ▶ | ||
+ | |- | ||
+ | ! style="width:100px;" |'''Car_type ▼ ''' | ||
+ | ! style="width:75px;" |'''2005 ''' | ||
+ | ! style="width:75px;" |'''2006 ''' | ||
+ | ! style="width:75px;" |'''2007 ''' | ||
+ | ! style="width:75px;" |'''2008 ''' | ||
+ | ! style="width:75px;" |'''2009 ''' | ||
+ | |- | ||
+ | !'''VW''' | ||
+ | | 8000 | ||
+ | | 7000 | ||
+ | | 10K | ||
+ | | 6000 | ||
+ | | 9000 | ||
+ | |- | ||
+ | !'''Honda ''' | ||
+ | | 10K | ||
+ | | 12K | ||
+ | | 11K | ||
+ | | 14K | ||
+ | | 13K | ||
+ | |- | ||
+ | !'''BMW''' | ||
+ | | 5000 | ||
+ | | 8000 | ||
+ | | 8000 | ||
+ | | 7000 | ||
+ | | 10K | ||
+ | |} | ||
+ | |||
+ | :<code>Variable Miles_per_gallon :=</code> | ||
+ | :{| class="wikitable" border="1" | ||
+ | ! colspan="3" style="text-align: left;" | Car_type ▶ | ||
+ | |- | ||
+ | ! style="width:75px;" |'''VW ''' | ||
+ | ! style="width:75px;" |'''Honda ''' | ||
+ | ! style="width:75px;" |'''BMW ''' | ||
+ | |- | ||
+ | | 32 | ||
+ | | 34 | ||
+ | | 18 | ||
+ | |} | ||
+ | |||
+ | :<code>Variable Rate_of_inflation :=</code> | ||
+ | :{| class="wikitable" border="1" | ||
+ | ! colspan="5" style="text-align: left;" | Years ▶ | ||
+ | |- | ||
+ | ! style="width:75px;" |'''2005 ''' | ||
+ | ! style="width:75px;" |'''2006 ''' | ||
+ | ! style="width:75px;" |'''2007 ''' | ||
+ | ! style="width:75px;" |'''2008 ''' | ||
+ | ! style="width:75px;" |'''2009 ''' | ||
+ | |- | ||
+ | | 1 | ||
+ | | 1.01 | ||
+ | | 1.02 | ||
+ | | 1.03 | ||
+ | | 1.04 | ||
+ | |} | ||
+ | |||
+ | :<code>Variable Cost_of_ownership :=</code> | ||
+ | :{| class="wikitable" border="1" | ||
+ | ! !! colspan="5" style="text-align: left;" | Time ▶ | ||
+ | |- | ||
+ | ! style="width:100px;" |'''Car_type ▼ ''' | ||
+ | ! style="width:75px;" |'''0''' | ||
+ | ! style="width:75px;" |'''1''' | ||
+ | ! style="width:75px;" |'''2''' | ||
+ | ! style="width:75px;" |'''3''' | ||
+ | ! style="width:75px;" |'''4''' | ||
+ | |- | ||
+ | !'''VW''' | ||
+ | | 2810 | ||
+ | | 2951 | ||
+ | | 3098 | ||
+ | | 3253 | ||
+ | | 3416 | ||
+ | |- | ||
+ | !'''Honda ''' | ||
+ | | 3535 | ||
+ | | 3847 | ||
+ | | 3897 | ||
+ | | 4166 | ||
+ | | 4365 | ||
+ | |- | ||
+ | !'''BMW''' | ||
+ | | 3185 | ||
+ | | 3294 | ||
+ | | 3409 | ||
+ | | 3529 | ||
+ | | 3656 | ||
+ | |} | ||
+ | |||
+ | :<code>Variable NumMaintEvents :=</code> | ||
+ | :{| class="wikitable" border="1" | ||
+ | ! !! colspan="7" style="text-align: left;" | CarNum ▶ | ||
+ | |- | ||
+ | ! style="width:100px;" |'''MaintType ▼ ''' | ||
+ | ! style="width:75px;" |'''1''' | ||
+ | ! style="width:75px;" |'''2''' | ||
+ | ! style="width:75px;" |'''3''' | ||
+ | ! style="width:75px;" |'''4''' | ||
+ | ! style="width:75px;" |'''5''' | ||
+ | ! style="width:75px;" |'''6''' | ||
+ | ! style="width:75px;" |'''7''' | ||
+ | |- | ||
+ | !'''Repair''' | ||
+ | | 10 | ||
+ | | 4 | ||
+ | | 9 | ||
+ | | 4 | ||
+ | | 4 | ||
+ | | 1 | ||
+ | | 4 | ||
+ | |- | ||
+ | !'''Scheduled''' | ||
+ | | 0 | ||
+ | | 2 | ||
+ | | 0 | ||
+ | | 1 | ||
+ | | 2 | ||
+ | | 0 | ||
+ | | 5 | ||
+ | |- | ||
+ | !'''Tires''' | ||
+ | | 0 | ||
+ | | 2 | ||
+ | | 0 | ||
+ | | 0 | ||
+ | | 1 | ||
+ | | 0 | ||
+ | | 0 | ||
+ | |} | ||
+ | |||
+ | :<code>Variable NumRepairs :=</code> | ||
+ | :{| class="wikitable" border="1" | ||
+ | ! colspan="7" style="text-align: left;" | CarNum ▶ | ||
+ | |- | ||
+ | ! style="width:75px;" |'''1''' | ||
+ | ! style="width:75px;" |'''2''' | ||
+ | ! style="width:75px;" |'''3''' | ||
+ | ! style="width:75px;" |'''4''' | ||
+ | ! style="width:75px;" |'''5''' | ||
+ | ! style="width:75px;" |'''6''' | ||
+ | ! style="width:75px;" |'''7''' | ||
+ | |- | ||
+ | | 10 | ||
+ | | 4 | ||
+ | | 9 | ||
+ | | 4 | ||
+ | | 4 | ||
+ | | 1 | ||
+ | | 4 | ||
+ | |} | ||
+ | |||
+ | ==See Also== | ||
+ | * [[Arrays and Indexes]] | ||
+ | * [[Multidimensional array]] | ||
+ | * [[Typographic conventions in this guide]] | ||
+ | * [[User guide Examples folder]] | ||
+ | * [[Array Manipulation Examples and Challenge Problems]] | ||
+ | * [[Tutorial: Arrays]] | ||
+ | |||
+ | |||
+ | <footer>Array functions / {{PAGENAME}} / Functions that create arrays</footer> |
Latest revision as of 21:59, 22 August 2016
These are example variables that are used in Array functions.
Index Car_type := ['VW', 'Honda', 'BMW']
Index Years := 2005 .. 2009
Index Time := 0 .. 4
Index CarNum := 1 .. 7
Index MaintType := ['Repair', 'Scheduled', 'Tires']
Variable Car_prices :=
Years ▶ Car_type ▼ 2005 2006 2007 2008 2009 VW $16,000 $17,000 $18,000 $19,000 $20,000 Honda $18,000 $19,000 $20,000 $22,000 $24,000 BMW $25,000 $26,000 $28,000 $30,000 $32,000
Variable Miles :=
Years ▶ Car_type ▼ 2005 2006 2007 2008 2009 VW 8000 7000 10K 6000 9000 Honda 10K 12K 11K 14K 13K BMW 5000 8000 8000 7000 10K
Variable Miles_per_gallon :=
Car_type ▶ VW Honda BMW 32 34 18
Variable Rate_of_inflation :=
Years ▶ 2005 2006 2007 2008 2009 1 1.01 1.02 1.03 1.04
Variable Cost_of_ownership :=
Time ▶ Car_type ▼ 0 1 2 3 4 VW 2810 2951 3098 3253 3416 Honda 3535 3847 3897 4166 4365 BMW 3185 3294 3409 3529 3656
Variable NumMaintEvents :=
CarNum ▶ MaintType ▼ 1 2 3 4 5 6 7 Repair 10 4 9 4 4 1 4 Scheduled 0 2 0 1 2 0 5 Tires 0 2 0 0 1 0 0
Variable NumRepairs :=
CarNum ▶ 1 2 3 4 5 6 7 10 4 9 4 4 1 4
See Also
- Arrays and Indexes
- Multidimensional array
- Typographic conventions in this guide
- User guide Examples folder
- Array Manipulation Examples and Challenge Problems
- Tutorial: Arrays
Comments
Enable comment auto-refresher