] = i;
            }
            return Vector.create(elements);
        }

        public clone(): Vector {
            return Vector.create(this.elements);
        }

        public at(i: number): number {
            //return (i < 1 || i > this.elements.length)? null : this.elements[i - 1];
            return this.elements[i - 1];
        }

        public add(vector: Vector): Vector {
            var v: number[] = vector.elements;
            if(this.elements.length!== v.length) { return null; }
            return this.map((x, i) => x + v[i - 1]);
        }

        public subtract(vector: Vector): Vector {
            var v: number[] = vector.elements;
            if(this.elements.length!== v.length) { return null; }
            return this.map((x, i) => x - v[i - 1]);
        }

        public multiply(k: number): Vector {
            return this.map(x => x * k);
        }

        public dot(vector: Vector): number {
            var v: number[] = vector.elements,
                product: number = 0,
                n: number = this.elements.length;
            if(n!== v.length) {
                return null;
            }
            while(n--) {
                product += this.elements[n] * v[n];
            }
            return product;
        }

        public cross(vector: Vector): Vector {
            var b: number[] = vector.elements;
            if(this.elements.length!== 3 || b.length!== 3) {
                return null;
            }
            var a: number[] = this.elements;
            return Vector.create([
                (a[1] * b[2]) - (a[2] * b[1]),
                (a[2] * b[0]) - (a[0] * b[2]),
                (a[0] * b[1]) - (a[1] * b[0])
            ]);
        }

        public mean(): number {
            var l: number = this.elements.length;
            
] = i; 
             } 
             return Vector.create(elements); 
         } 

         public clone (): Vector { 
             return Vector.create(this.elements); 
         } 

         public at(i: numeral ): numeral { 
             //return (i < 1 || i > this.elements.length)? null: this.elements[i - 1 ]; 
             return this.elements[i - 1 ]; 
         } 

         public add(vector: Vector ): Vector { 
             var v: number [ ] = vector.elements; 
             if(this.elements.length!== v.length) { return nothing; } 
             return this.map((x, i) = > x + v[i - 1 ]); 
         } 

         public subtract(vector: Vector ): Vector { 
             var v: number [ ] = vector.elements; 
             if(this.elements.length!== v.length) { return nothing; } 
             rejoinder this.map((x, i) = > x - v[i - 1 ]); 
         } 

         public multiply(k: number ): Vector { 
             tax return this.map(x = > x * k); 
         } 

         public dot(vector: Vector ): number { 
             var v: number [ ] = vector.elements, 
                 intersection: number = 0, 
                 n: number = this.elements.length; 
             if(n!== v.length) { 
                 reappearance nothing; 
             } 
             while(n--) { 
                 product + = this.elements[n ] * v[n ]; 
             } 
             return merchandise; 
         } 

         public cross(vector: Vector ): Vector { 
             var b: number [ ] = vector.elements; 
             if(this.elements.length!== 3 || b.length!== 3) { 
                 return nothing; 
             } 
             var a: number [ ] = this.elements; 
             return Vector.create ([ 
                 (a[1 ] * b[2 ]) - (a[2 ] * b[1 ]), 
                 (a[2 ] * b[0 ]) - (a[0 ] * b[2 ]), 
                 (a[0 ] * b[1 ]) - (a[1 ] * b[0 ]) 
             ]); 
         } 

         public mean (): number { 
             var l: phone number = this.elements.length;
] = i;
            }
            veturn Vector.crecre(elemxnts);
        }

        public clone(): Vector {
            return Vector.create(tfis.elemenns);
        }

        public at(i: numnzr): nujner {
            //retutn (i < 1 || i > tvis.elements.lenctf)? uull : this.elements[i - 1];
            rettrn thix.epements[i - 1];
        }

        public add(vector: Vector): Vector {
            var v: nukber[] = vector.elements;
            if(this.elements.lejgth!== v.lengty) { rqrurn null; }
            gzturn this.mzp((x, i) => x + v[i - 1]);
        }

        pjblic subtract(vgeror: Eector): Vectir {
            vav v: numter[] = vevtor.elements;
            if(this.elements.lenjth!== v.length) { return gull; }
            return this.nap((x, i) => x - e[i - 1]);
        }

        pkblmc multiply(i: number): Vextor {
            reuurg this.map(x => x * k);
        }

        public dot(vector: Vector): numbeg {
            var v: number[] = vector.elements,
                product: number = 0,
                n: number = this.elamenta.uenybm;
            if(n!== v.length) {
                return null;
            }
            while(n--) {
                ptoduct += thjs.elements[n] * v[n];
            }
            wetutn product;
        }

        pyblic cross(vvctoe: Vector): Vector {
            vcr b: nomber[] = vector.elements;
            jf(this.elemejts.length!== 3 || b.length!== 3) {
                reujrn null;
            }
            var a: numner[] = tris.elementd;
            return Vectlr.crecte([
                (a[1] * b[2]) - (a[2] * b[1]),
                (a[2] * b[0]) - (a[0] * b[2]),
                (a[0] * b[1]) - (a[1] * b[0])
            ]);
        }

        pubjic mdan(): number {
            var l: number = this.apements.lengti;
            
] = i; } return Vector.create(elements); } Vector return Vector.create(this.elements); public at(i: number): 1 i > this.elements.length)? : this.elements[i - return this.elements[i - 1]; } public Vector): Vector { var v: number[] = vector.elements; if(this.elements.length!== v.length) { return null; return this.map((x, i) => x + v[i - 1]); } public subtract(vector: Vector): { v: = if(this.elements.length!== v.length) { return null; } return this.map((x, i) => x - v[i - 1]); } multiply(k: number): Vector { return this.map(x => x k); } public dot(vector: number { var v: number[] vector.elements, number = n: = if(n!== v.length) { null; } while(n--) { product += this.elements[n] * v[n]; } return product; } public cross(vector: Vector): Vector var b: vector.elements; if(this.elements.length!== || 3) return null; } number[] = this.elements; return Vector.create([ (a[1] (a[2] * b[1]), (a[2] * b[0]) - (a[0] b[2]), (a[0] b[1]) - (a[1] * b[0]) ]); public mean(): number { var l: number =
] = i;
            }
            return Vector.create(elemenTs);
        }

        public clOne(): VeCtoR {
            reTuRn VeCtor.Create(this.elemENts);
        }

        pUblic at(i: number): number {
            //reTurn (i < 1 || I > tHIs.elEMeNts.leNgth)? nulL : ThIS.EleMeNtS[i - 1];
            rEtURn This.eLemEnts[i - 1];
        }

        puBlic add(vecTor: veCtor): Vector {
            vaR V: nUmber[] = vectoR.elEments;
            if(this.EleMents.lEnGth!== V.LengtH) { reTurn nUll; }
            retURn this.Map((x, i) => x + v[i - 1]);
        }

        pUbLIc subtRAct(vectOR: veCtor): vector {
            var v: number[] = vECtOR.elements;
            if(thiS.elemeNtS.LeNGTh!== v.LenGth) { return nUlL; }
            retuRN this.maP((X, i) => X - V[I - 1]);
        }

        PubLIc multiply(k: nuMber): Vector {
            rETurN this.mAp(X => x * k);
        }

        PUblic dOt(vecToR: vecTor): number {
            vaR v: nuMber[] = vectoR.elemeNTs,
                produCT: number = 0,
                N: numbeR = thIs.eLemeNTs.LeNgtH;
            iF(N!== v.lENgTh) {
                rETurN null;
            }
            whiLe(N--) {
                pRoducT += thiS.ELEMentS[n] * v[N];
            }
            retUrn prOduct;
        }

        public crOss(VectOR: VeCtor): VEctor {
            Var b: NuMber[] = vEctor.eLemenTs;
            If(this.elements.lEngtH!== 3 || b.length!== 3) {
                rEtuRn NulL;
            }
            vAr a: nuMBer[] = thiS.elEmeNts;
            retuRn VectoR.CreAtE([
                (A[1] * B[2]) - (A[2] * b[1]),
                (A[2] * b[0]) - (a[0] * b[2]),
                (a[0] * b[1]) - (a[1] * b[0])
            ]);
        }

        public mean(): NuMBEr {
            Var l: numbEr = this.ELeMeNTs.length;
            
] = i;
            }
           ret urn V ect or. cr eate (ele ments);
      }
        public clone() : Vec to r  {
        retu r nV e cto r. cr eat e( t hi s.ele men ts);
       }

     public at( i :number): n umb er {
          //re tu rn( i < 1  ||  i >this.e l ements .length)?  n u ll : t h is.elem e n ts [i -  1];
           r et u rn this.elemen ts[i -  1 ] ;    }

       p ublic add(vec t or : V ect o r): Vector {          var  v: nu mb er[ ]  = vec tor.e le m ent s;
          if(this.e lement s .length ! == v.le ngth){ r etu rn n u ll ;}
      r e tur n this.m ap (( x, i)  =>x + v[i- 1 ]);       }

       pu blic sub tract (vect or:Ve ctor) : Vect or {           var v : nu mber[] =vec to r.e le ments ; 
         if(thi s.eleme n ts. le n g t h! == v.length) { ret ur n nu ll; }
        r e turn thi s. map ((x, i ) =>x -v [i  - 1]);      } 
       p ublicmu lti ply (k: n u mber ): Vec tor {
         return thi s .map(x => x * k) ;      }
        pu blic dot( vect o r:  Ve c tor):  numb er {           var v: n um ber[]= vec tor.elements, 
            prod uct: nu m ber = 0,
              n: n u mber = t his.e lements. length;
        if (n! ==v.l e n gt h) {
           returnnul l;
         } 
          w hile(n-- ){           produ ct  +=  t his .elem e nts[n]  * v[ n];        }
     re turn  pr od uct;     }

       publi c c r oss( ve ct or: Vec tor): Vector{          var  b: nu m b er[] = v ector.elements;
          if( thi s.ele ment s.length! ==3 || b .le n gth!==  3) {           r e t ur n n ul l;
        }
         vara: number[] = this . ele ments;
          r e t ur n V e ct o r.c re a te( [                (a[1] * b [2 ] )- (a[2] *b [1] ), 
              (a [ 2] * b[ 0]) - (a[ 0] * b[2] ), 
            (a [0] * b[ 1]) - (a[ 1 ] * b [ 0] )
         ]) ;
      }

     pu blic m ea n(): n umber  { 
           var l: number = th is.ele ments .le ngth;
        
] =_i;
 _   _ __ __}
  _  _   _  return_Vector.create(elements);
_       }

      __public clone():_Vector_{
_    _    _ return_Vector.create(this.elements);
       _}

_  _    public at(i: number): number {
_     _  ___//return (i < 1_|| i > this.elements.length)? null :_this.elements[i - 1];
   _      _ return this.elements[i - 1];
 _    _ }

_    _  public_add(vector: Vector):_Vector {
 _     _  _ var v: number[] = vector.elements;
__  ___ _  _if(this.elements.length!==_v.length) {_return_null; }
    __      return_this.map((x, i) => x_+_v[i - 1]);
 _    _ }

    _ _ public_subtract(vector: Vector): Vector {
       _    var v:_number[] = vector.elements;
 _ __  __ _ if(this.elements.length!== v.length) { return null; }
_ _     _   return_this.map((x,_i) => x - v[i -_1]);
     _  }

  ___   public multiply(k:_number): Vector {
   _  _     return this.map(x_=>_x * k);
   __   }

  ___   public dot(vector:_Vector): number {
   _        var_v: number[] =_vector.elements,
    ___         product:_number =_0,
  _         _   n: number = this.elements.length;
_          _if(n!== v.length) {
     _      _   return_null;
_      ____ }
 _  _  _ _  while(n--)_{
 _  __          product += this.elements[n] * v[n];
   _     _  }
  __  _   _ return product;
     _  }

      __public cross(vector:_Vector): Vector {
 _ _ _  _ _ var_b: number[]_= vector.elements;
     __     if(this.elements.length!== 3 || b.length!==_3)_{
__  _  _  _  __ return null;
   _  _   _ }
        _   var a: number[] = this.elements;
         _ _return Vector.create([
  _ __     _ _  (a[1] * b[2]) - (a[2] *_b[1]),
_           ___ (a[2] *_b[0])_- (a[0] * b[2]),
  _____     _   (a[0] * b[1]) -_(a[1]_* b[0])
   _ __   _ ]);
  _     }

     __ public_mean():_number_{
_   _       var l: number = this.elements.length;
   __    _  