Difference between revisions of "Creation of Sets/Array in z^3"

From ZCubes Wiki
Jump to navigation Jump to search
(Created page with "<div style="font-size:30px">'''Tricks and Shortcuts'''</div><br/> ==Description== '''*Creating an Array''' *Comma(,) has to be used to separate the elements(especially when n...")
 
Line 7: Line 7:
 
  a = [1 2 3; -4*5 -4 6; 7 8 10]
 
  a = [1 2 3; -4*5 -4 6; 7 8 10]
 
  This gives the answer as:
 
  This gives the answer as:
  '''1 2  3'''
+
a =  '''1 2  3'''
'''-24 6'''
+
    '''-24 6'''
  '''7 8 10'''
+
      '''7 8 10'''
  
 
  with comma:
 
  with comma:
 
  a = [1 2 3; -4*5, -4 6; 7 8 10]
 
  a = [1 2 3; -4*5, -4 6; 7 8 10]
  '''1  2 3'''
+
a =  '''1  2 3'''
'''-20 -4 6'''
+
    '''-20 -4 6'''
  '''7  8 10'''
+
      '''7  8 10'''
 +
 
 +
'''*Notations'''
 +
*The unit operators work for simple or matrix parameters on both sides. This makes |-| be available for non-unit based subtraction. This is possibly a better notation.
 +
*To do unit based subtractions, do
 +
A=[1m 2m];
 +
B=[4m 5m];
 +
c=A<->B
 +
'''c = [-3m -3m]'''
 +
 
 +
*Matrix subtraction, without units.
 +
A=[1m 2m];
 +
B=[4m 5m];
 +
c=A|-|B
 +
'''c = [-3 -3]'''
 +
 
 +
 
 +
'''*Creating an Array with an interval'''
 +
*An array can be created within a given interval using this notation. Brackets() are important.
 +
xmin = 1
 +
xmax = 2
 +
dx = 0.2
 +
x = [(xmin-dx)..(xmax+dx)..(dx)];
 +
'''x = [0.8 1 1.2000000000000002 1.4000000000000001 1.6 1.8 2 2.2]'''

Revision as of 06:29, 14 November 2016

Tricks and Shortcuts


Description

*Creating an Array

  • Comma(,) has to be used to separate the elements(especially when negative numbers are in an array). This removes the ambiguity.
For example:(without comma)
a = [1 2 3; -4*5 -4 6; 7 8 10]
This gives the answer as:
a =  1 2  3
   -24 6
     7 8 10
with comma:
a = [1 2 3; -4*5, -4 6; 7 8 10]
a =  1  2 3
   -20 -4 6
     7  8 10

*Notations

  • The unit operators work for simple or matrix parameters on both sides. This makes |-| be available for non-unit based subtraction. This is possibly a better notation.
  • To do unit based subtractions, do
A=[1m 2m];
B=[4m 5m];
c=A<->B
c = [-3m -3m]
  • Matrix subtraction, without units.
A=[1m 2m];
B=[4m 5m];
c=A|-|B
c = [-3 -3]


*Creating an Array with an interval

  • An array can be created within a given interval using this notation. Brackets() are important.
xmin = 1
xmax = 2
dx = 0.2
x = [(xmin-dx)..(xmax+dx)..(dx)];
x = [0.8 1 1.2000000000000002 1.4000000000000001 1.6 1.8 2 2.2]