Sponsored links: Algebra eBooks
 

Related

make_array

Run Example
(%i1)N:1;
(%o1)                                  1
(%i2)  a:N*0.1;
(%o2)                                 0.1
(%i3) b:a+2;
(%o3)                                 2.1
(%i4) h:0.2;
(%o4)                                 0.2
(%i5) c:(a+b)/2;
(%o5)                                 1.1
(%i6) n:1+floor((b-a)/h) ;
(%o6)                                 11
(%i7) x1:make_array(flonum, n+1);
(%o7)    {Array:  #(0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0)}
(%i8) y1:make_array(flonum, n+1);
(%o8)    {Array:  #(0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0)}
(%i9) x1[0]:a;
(%o9)                                 0.1
(%i10) x1[1]:a+h;
(%o10)                                0.3
(%i11)  y1[0]:c;
(%o11)                                1.1
(%i12) for i:2 thru n step 1 do (x1[i]:x1[i-1]+h);
(%o12)                               done
(%i13) for i:1 thru n step 1 do (y1[i]:y1[i-1]+h*    (2*(x1[i-1])^2+x1[i-1]*y1[i-1]+3*(y1[i-1])^2));
(%o13)                               done
(%i14) for i:0 thru n step 1 do (display(x1[i]), display(y1[i]));
                                   x1  = 0.1
                                     0

                                   y1  = 1.1
                                     0

                                   x1  = 0.3
                                     1

                                  y1  = 1.852
                                    1

                                   x1  = 0.5
                                     2

                            y1  = 4.057062400000001
                              2

                                   x1  = 0.7
                                     3

                            y1  = 14.43862183049626
                              3

                                   x1  = 0.9
                                     4

                            y1  = 141.7403091052157
                              4

                                   x1  = 1.1
                                     5

                            y1  = 12221.76669988942
                              5

                                   x1  = 1.3
                                     6

                          y1  = 8.963785979928942E+7
                            6

                                   x1  = 1.5
                                     7

                          y1  = 4.820967658581944E+15
                            7

                                   x1  = 1.7
                                     8

                         y1  = 1.3945037499055851E+31
                           8

                                   x1  = 1.9
                                     9

                         y1  = 1.1667844251004433E+62
                           9

                                  x1   = 2.1
                                    10

                        y1   = 8.1683153679418328E+123
                          10

                                  x1   = 2.3
                                    11

                        y1   = 4.0032825570092835E+247
                          11

(%o14)                               done
(%i15) 
Run Example
arraymake (a, [1]);
(%o1)                                 a
                                       1
(%i2)  arraymake (a, [k]);
(%o2)                                 a
                                       k
(%i3)  arraymake (a, [i, j, 3]);
(%o3)                              a
                                    i, j, 3
(%i4)  array (a, fixnum, 10);
(%o4)                                  a
(%i5)  fillarray (a, makelist (i^2, i, 1, 11));
(%o5)                                  a
(%i6)  arraymake (a, [5]);
(%o6)                                 a
                                       5
(%i7)  ''%;
(%o7)             (%i8)  l : [a, b, c, d, e];
(%o8)                           [a, b, c, d, e]
(%i9)  arraymake ('l, [n]);
(%o9)                                 l
                                       n
(%i10)  ''%, n = 3;
(%o10)            (%i11)  a2 : make_array (fixnum, 10);
(%o11)                 {Array:  #(0 0 0 0 0 0 0 0 0 0)}
(%i12)  fillarray (a2, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
(%o12)                 {Array:  #(1 2 3 4 5 6 7 8 9 10)}
(%i13)  arraymake ('a2, [8]);
(%o13)                                a2
                                        8
(%i14)  ''%;
(%o14)            
Run Example
N:1;
(%o1)                                  1
(%i2) a:N*0.1;
(%o2)                                 0.1
(%i3) b:a+0.5;
(%o3)                                 0.6
(%i4) c:(a+b)/2;
(%o4)                                0.35
(%i5) h:0.05;
(%o5)                                0.05
(%i6) n:1+floor((b-a)/h);
(%o6)                                 11
(%i7) x1:make_array(flonum,n);
(%o7)      {Array:  #(0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0)}
(%i8) y1:make_array(flonum,n);
(%o8)      {Array:  #(0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0)}
(%i9) x1[0]:a;
(%o9)                                 0.1
(%i10) x1[1]:a+h;
(%o10)                               0.15
(%i11) y1[0]:c;
(%o11)                               0.35
(%i12) for i:2 thru n-1 step 1 do (x1[i]:x1[i-1]+h);
(%o12)                               done
(%i13) for i:1 thru n-1 step 1 do (y1[i]:float(y1[i-1]+h*(2*(x1[i-1])^2+x1[i-1]*y1[i-1]+3*(y1[i-1])^2)));
(%o13)                               done
(%i14) wxdraw2d(point_type=circle,    point_size=1,     points_joined=true,     key="Eiler",    color=red,    points(x1,y1));
(%o14) wxdraw2d(point_type = circle, point_size = 1, points_joined = true, 
key = Eiler, color = red, points({Array:  #(0.10000000000000001 0.150000000000\
00002 0.20000000000000001 0.25
  0.29999999999999999 0.34999999999999998 0.39999999999999997
  0.44999999999999996 0.49999999999999994 0.54999999999999993
  0.59999999999999998)}, {Array:  #(0.34999999999999998 0.37112499999999998 0.\
39681850234374999
  0.42840642593753797 0.4675413161294435 0.51634366821459299
  0.57762129996414358 0.65522068088926655 0.75461026730902414
  0.88389102232097927 1.05563752633575)}))
(%i15) 

Related Help

Help for Make_array