Sponsored links: Algebra eBooks
 

Related

listarray

for i thru 4 do for j...

listarray(A);

Calculate

listarray

? listarray;

Calculate

listarray

for i thru 4 do for j...

listarray(A);

Calculate

listarray

? listarray;

Calculate

listarray

Run Example
(%i1)m:4;
(%o1)                                  4
(%i2) array([rs,rsy],float,m);
(%o2)                              [rs, rsy]
(%i3) i:0;
(%o3)                                  0
(%i4) n:200;
(%o4)                                 200
(%i5) f(x):=sin(x);
(%o5)                           f(x) := sin(x)
(%i6) for x: 0 step 6.28/m thru 6.28 do (rs[i]:x, rsy[i]:f(rs[i]), i:i+1);
(%o6)                                done
(%i7) for i:0 thru m do display(rs[i]);
                                    rs  = 0
                                      0

                                  rs  = 1.57
                                    1

                                  rs  = 3.14
                                    2

                                  rs  = 4.71
                                    3

                                  rs  = 6.28
                                    4

(%o7)                                done
(%i8) array([arrx,arry],float,n);
(%o8)                            [arrx, arry]
(%i9) i:0;
(%o9)                                  0
(%i10) for x: 0 step 6.28/n thru 6.28 do (arrx[i]:x, i:i+1);
(%o10)                               done
(%i11) for i:0 thru n do (for j:0 thru m-1 do ( if(arrx[i]>
=rs[j] and arrx[i]<
=(rs[j]+rs[j+1])/2)then arry[i]:f(rs[j]) else if(arrx[i]>
(rs[j]+rs[j+1])/2 and arrx[i]<
=rs[j+1])then arry[i]:f(rs[j+1])));
(%o11)                               done
(%i12) arry[100]:f(rs[m]);
(%o12)                        - 0.003185301793138
(%i13) rx:listarray(arrx);
(%o13) [0, 0.0314, 0.0628, 0.0942, 0.1256, 0.157, 0.1884, 0.2198, 0.2512, 
0.2826, 0.314, 0.3454, 0.3768, 0.4082, 0.4396, 0.471, 0.5024, 0.5338, 0.5652, 
0.5966, 0.628, 0.6594, 0.6908, 0.7222, 0.7536, 0.785, 0.8164, 0.8478, 0.8792, 
0.9106, 0.942, 0.9734, 1.0048, 1.0362, 1.0676, 1.099, 1.1304, 1.1618, 1.1932, 
1.2246, 1.256, 1.287400000000001, 1.318800000000001, 1.350200000000001, 
1.381600000000001, 1.413000000000001, 1.444400000000001, 1.475800000000001, 
1.507200000000001, 1.538600000000001, 1.570000000000001, 1.601400000000002, 
1.632800000000002, 1.664200000000002, 1.695600000000002, 1.727000000000002, 
1.758400000000002, 1.789800000000002, 1.821200000000002, 1.852600000000002, 
1.884000000000002, 1.915400000000002, 1.946800000000003, 1.978200000000003, 
2.009600000000003, 2.041000000000003, 2.072400000000003, 2.103800000000003, 
2.135200000000003, 2.166600000000003, 2.198000000000003, 2.229400000000003, 
2.260800000000003, 2.292200000000003, 2.323600000000003, 2.355000000000004, 
2.386400000000004, 2.417800000000004, 2.449200000000004, 2.480600000000004, 
2.512000000000004, 2.543400000000004, 2.574800000000004, 2.606200000000004, 
2.637600000000004, 2.669000000000005, 2.700400000000005, 2.731800000000005, 
2.763200000000005, 2.794600000000005, 2.826000000000005, 2.857400000000005, 
2.888800000000005, 2.920200000000005, 2.951600000000005, 2.983000000000005, 
3.014400000000006, 3.045800000000006, 3.077200000000006, 3.108600000000006, 
3.140000000000006, 3.171400000000006, 3.202800000000006, 3.234200000000006, 
3.265600000000006, 3.297000000000006, 3.328400000000007, 3.359800000000007, 
3.391200000000007, 3.422600000000007, 3.454000000000007, 3.485400000000007, 
3.516800000000007, 3.548200000000007, 3.579600000000007, 3.611000000000007, 
3.642400000000007, 3.673800000000008, 3.705200000000008, 3.736600000000008, 
3.768000000000008, 3.799400000000008, 3.830800000000008, 3.862200000000008, 
3.893600000000008, 3.925000000000008, 3.956400000000008, 3.987800000000008, 
4.019200000000009, 4.050600000000008, 4.082000000000008, 4.113400000000008, 
4.144800000000007, 4.176200000000007, 4.207600000000006, 4.239000000000006, 
4.270400000000006, 4.301800000000005, 4.333200000000005, 4.364600000000005, 
4.396000000000004, 4.427400000000004, 4.458800000000004, 4.490200000000003, 
4.521600000000003, 4.553000000000003, 4.584400000000002, 4.615800000000002, 
4.647200000000002, 4.678600000000001, 4.710000000000001, 4.741400000000001, 
4.7728, 4.8042, 4.8356, 4.866999999999999, 4.898399999999999, 
4.929799999999998, 4.961199999999998, 4.992599999999998, 5.023999999999997, 
5.055399999999997, 5.086799999999997, 5.118199999999996, 5.149599999999996, 
5.180999999999996, 5.212399999999995, 5.243799999999995, 5.275199999999995, 
5.306599999999994, 5.337999999999994, 5.369399999999994, 5.400799999999993, 
5.432199999999993, 5.463599999999993, 5.494999999999992, 5.526399999999992, 
5.557799999999991, 5.589199999999991, 5.620599999999991, 5.65199999999999, 
5.68339999999999, 5.71479999999999, 5.746199999999989, 5.777599999999989, 
5.808999999999989, 5.840399999999988, 5.871799999999988, 5.903199999999988, 
5.934599999999987, 5.965999999999987, 5.997399999999987, 6.028799999999986, 
6.060199999999986, 6.091599999999986, 6.122999999999985, 6.154399999999985, 
6.185799999999984, 6.217199999999984, 6.248599999999984, 6.279999999999983]
(%i14) ry:listarray(arry);
(%o14) [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0.99999968293183, 0.99999968293183, 0.99999968293183, 
0.99999968293183, 0.99999968293183, 0.99999968293183, 0.99999968293183, 
0.99999968293183, 0.99999968293183, 0.99999968293183, 0.99999968293183, 
0.99999968293183, 0.99999968293183, 0.99999968293183, 0.99999968293183, 
0.99999968293183, 0.99999968293183, 0.99999968293183, 0.99999968293183, 
0.99999968293183, 0.99999968293183, 0.99999968293183, 0.99999968293183, 
0.99999968293183, 0.99999968293183, 0.99999968293183, 0.99999968293183, 
0.99999968293183, 0.99999968293183, 0.99999968293183, 0.99999968293183, 
0.99999968293183, 0.99999968293183, 0.99999968293183, 0.99999968293183, 
0.99999968293183, 0.99999968293183, 0.99999968293183, 0.99999968293183, 
0.99999968293183, 0.99999968293183, 0.99999968293183, 0.99999968293183, 
0.99999968293183, 0.99999968293183, 0.99999968293183, 0.99999968293183, 
0.99999968293183, 0.99999968293183, 0.0015926529164868, 0.0015926529164868, 
0.0015926529164868, 0.0015926529164868, 0.0015926529164868, 
0.0015926529164868, 0.0015926529164868, 0.0015926529164868, 
0.0015926529164868, 0.0015926529164868, 0.0015926529164868, 
0.0015926529164868, 0.0015926529164868, 0.0015926529164868, 
0.0015926529164868, 0.0015926529164868, 0.0015926529164868, 
0.0015926529164868, 0.0015926529164868, 0.0015926529164868, 
0.0015926529164868, 0.0015926529164868, 0.0015926529164868, 
0.0015926529164868, 0.0015926529164868, - 0.003185301793138, 
0.0015926529164868, 0.0015926529164868, 0.0015926529164868, 
0.0015926529164868, 0.0015926529164868, 0.0015926529164868, 
0.0015926529164868, 0.0015926529164868, 0.0015926529164868, 
0.0015926529164868, 0.0015926529164868, 0.0015926529164868, 
0.0015926529164868, 0.0015926529164868, 0.0015926529164868, 
0.0015926529164868, 0.0015926529164868, 0.0015926529164868, 
0.0015926529164868, 0.0015926529164868, 0.0015926529164868, 
0.0015926529164868, 0.0015926529164868, 0.0015926529164868, 
- 0.99999714638772, - 0.99999714638772, - 0.99999714638772, 
- 0.99999714638772, - 0.99999714638772, - 0.99999714638772, 
- 0.99999714638772, - 0.99999714638772, - 0.99999714638772, 
- 0.99999714638772, - 0.99999714638772, - 0.99999714638772, 
- 0.99999714638772, - 0.99999714638772, - 0.99999714638772, 
- 0.99999714638772, - 0.99999714638772, - 0.99999714638772, 
- 0.99999714638772, - 0.99999714638772, - 0.99999714638772, 
- 0.99999714638772, - 0.99999714638772, - 0.99999714638772, 
- 0.99999714638772, - 0.99999714638772, - 0.99999714638772, 
- 0.99999714638772, - 0.99999714638772, - 0.99999714638772, 
- 0.99999714638772, - 0.99999714638772, - 0.99999714638772, 
- 0.99999714638772, - 0.99999714638772, - 0.99999714638772, 
- 0.99999714638772, - 0.99999714638772, - 0.99999714638772, 
- 0.99999714638772, - 0.99999714638772, - 0.99999714638772, 
- 0.99999714638772, - 0.99999714638772, - 0.99999714638772, 
- 0.99999714638772, - 0.99999714638772, - 0.99999714638772, 
- 0.99999714638772, - 0.99999714638772, - 0.99999714638772, 
- 0.003185301793138, - 0.003185301793138, - 0.003185301793138, 
- 0.003185301793138, - 0.003185301793138, - 0.003185301793138, 
- 0.003185301793138, - 0.003185301793138, - 0.003185301793138, 
- 0.003185301793138, - 0.003185301793138, - 0.003185301793138, 
- 0.003185301793138, - 0.003185301793138, - 0.003185301793138, 
- 0.003185301793138, - 0.003185301793138, - 0.003185301793138, 
- 0.003185301793138, - 0.003185301793138, - 0.003185301793138, 
- 0.003185301793138, - 0.003185301793138, - 0.003185301793138, 
- 0.003185301793138]
(%i15) pointx:listarray(rs);
(%o15)                    [0, 1.57, 3.14, 4.71, 6.28]
(%i16) pointy:listarray(rsy);
(%o16) [0, 0.99999968293183, 0.0015926529164868, - 0.99999714638772, 
                                                           - 0.003185301793138]
(%i17) for i:0 thru n do display(arry[i]);
                                   arry  = 0
                                       0

                                   arry  = 0
                                       1

                                   arry  = 0
                                       2

                                   arry  = 0
                                       3

                                   arry  = 0
                                       4

                                   arry  = 0
                                       5

                                   arry  = 0
                                       6

                                   arry  = 0
                                       7

                                   arry  = 0
                                       8

                                   arry  = 0
                                       9

                                  arry   = 0
                                      10

                                  arry   = 0
                                      11

                                  arry   = 0
                                      12

                                  arry   = 0
                                      13

                                  arry   = 0
                                      14

                                  arry   = 0
                                      15

                                  arry   = 0
                                      16

                                  arry   = 0
                                      17

                                  arry   = 0
                                      18

                                  arry   = 0
                                      19

                                  arry   = 0
                                      20

                                  arry   = 0
                                      21

                                  arry   = 0
                                      22

                                  arry   = 0
                                      23

                                  arry   = 0
                                      24

                                  arry   = 0
                                      25

                           arry   = 0.99999968293183
                               26

                           arry   = 0.99999968293183
                               27

                           arry   = 0.99999968293183
                               28

                           arry   = 0.99999968293183
                               29

                           arry   = 0.99999968293183
                               30

                           arry   = 0.99999968293183
                               31

                           arry   = 0.99999968293183
                               32

                           arry   = 0.99999968293183
                               33

                           arry   = 0.99999968293183
                               34

                           arry   = 0.99999968293183
                               35

                           arry   = 0.99999968293183
                               36

                           arry   = 0.99999968293183
                               37

                           arry   = 0.99999968293183
                               38

                           arry   = 0.99999968293183
                               39

                           arry   = 0.99999968293183
                               40

                           arry   = 0.99999968293183
                               41

                           arry   = 0.99999968293183
                               42

                           arry   = 0.99999968293183
                               43

                           arry   = 0.99999968293183
                               44

                           arry   = 0.99999968293183
                               45

                           arry   = 0.99999968293183
                               46

                           arry   = 0.99999968293183
                               47

                           arry   = 0.99999968293183
                               48

                           arry   = 0.99999968293183
                               49

                           arry   = 0.99999968293183
                               50

                           arry   = 0.99999968293183
                               51

                           arry   = 0.99999968293183
                               52

                           arry   = 0.99999968293183
                               53

                           arry   = 0.99999968293183
                               54

                           arry   = 0.99999968293183
                               55

                           arry   = 0.99999968293183
                               56

                           arry   = 0.99999968293183
                               57

                           arry   = 0.99999968293183
                               58

                           arry   = 0.99999968293183
                               59

                           arry   = 0.99999968293183
                               60

                           arry   = 0.99999968293183
                               61

                           arry   = 0.99999968293183
                               62

                           arry   = 0.99999968293183
                               63

                           arry   = 0.99999968293183
                               64

                           arry   = 0.99999968293183
                               65

                           arry   = 0.99999968293183
                               66

                           arry   = 0.99999968293183
                               67

                           arry   = 0.99999968293183
                               68

                           arry   = 0.99999968293183
                               69

                           arry   = 0.99999968293183
                               70

                           arry   = 0.99999968293183
                               71

                           arry   = 0.99999968293183
                               72

                           arry   = 0.99999968293183
                               73

                           arry   = 0.99999968293183
                               74

                          arry   = 0.0015926529164868
                              75

                          arry   = 0.0015926529164868
                              76

                          arry   = 0.0015926529164868
                              77

                          arry   = 0.0015926529164868
                              78

                          arry   = 0.0015926529164868
                              79

                          arry   = 0.0015926529164868
                              80

                          arry   = 0.0015926529164868
                              81

                          arry   = 0.0015926529164868
                              82

                          arry   = 0.0015926529164868
                              83

                          arry   = 0.0015926529164868
                              84

                          arry   = 0.0015926529164868
                              85

                          arry   = 0.0015926529164868
                              86

                          arry   = 0.0015926529164868
                              87

                          arry   = 0.0015926529164868
                              88

                          arry   = 0.0015926529164868
                              89

                          arry   = 0.0015926529164868
                              90

                          arry   = 0.0015926529164868
                              91

                          arry   = 0.0015926529164868
                              92

                          arry   = 0.0015926529164868
                              93

                          arry   = 0.0015926529164868
                              94

                          arry   = 0.0015926529164868
                              95

                          arry   = 0.0015926529164868
                              96

                          arry   = 0.0015926529164868
                              97

                          arry   = 0.0015926529164868
                              98

                          arry   = 0.0015926529164868
                              99

                         arry    = - 0.003185301793138
                             100

                         arry    = 0.0015926529164868
                             101

                         arry    = 0.0015926529164868
                             102

                         arry    = 0.0015926529164868
                             103

                         arry    = 0.0015926529164868
                             104

                         arry    = 0.0015926529164868
                             105

                         arry    = 0.0015926529164868
                             106

                         arry    = 0.0015926529164868
                             107

                         arry    = 0.0015926529164868
                             108

                         arry    = 0.0015926529164868
                             109

                         arry    = 0.0015926529164868
                             110

                         arry    = 0.0015926529164868
                             111

                         arry    = 0.0015926529164868
                             112

                         arry    = 0.0015926529164868
                             113

                         arry    = 0.0015926529164868
                             114

                         arry    = 0.0015926529164868
                             115

                         arry    = 0.0015926529164868
                             116

                         arry    = 0.0015926529164868
                             117

                         arry    = 0.0015926529164868
                             118

                         arry    = 0.0015926529164868
                             119

                         arry    = 0.0015926529164868
                             120

                         arry    = 0.0015926529164868
                             121

                         arry    = 0.0015926529164868
                             122

                         arry    = 0.0015926529164868
                             123

                         arry    = 0.0015926529164868
                             124

                         arry    = - 0.99999714638772
                             125

                         arry    = - 0.99999714638772
                             126

                         arry    = - 0.99999714638772
                             127

                         arry    = - 0.99999714638772
                             128

                         arry    = - 0.99999714638772
                             129

                         arry    = - 0.99999714638772
                             130

                         arry    = - 0.99999714638772
                             131

                         arry    = - 0.99999714638772
                             132

                         arry    = - 0.99999714638772
                             133

                         arry    = - 0.99999714638772
                             134

                         arry    = - 0.99999714638772
                             135

                         arry    = - 0.99999714638772
                             136

                         arry    = - 0.99999714638772
                             137

                         arry    = - 0.99999714638772
                             138

                         arry    = - 0.99999714638772
                             139

                         arry    = - 0.99999714638772
                             140

                         arry    = - 0.99999714638772
                             141

                         arry    = - 0.99999714638772
                             142

                         arry    = - 0.99999714638772
                             143

                         arry    = - 0.99999714638772
                             144

                         arry    = - 0.99999714638772
                             145

                         arry    = - 0.99999714638772
                             146

                         arry    = - 0.99999714638772
                             147

                         arry    = - 0.99999714638772
                             148

                         arry    = - 0.99999714638772
                             149

                         arry    = - 0.99999714638772
                             150

                         arry    = - 0.99999714638772
                             151

                         arry    = - 0.99999714638772
                             152

                         arry    = - 0.99999714638772
                             153

                         arry    = - 0.99999714638772
                             154

                         arry    = - 0.99999714638772
                             155

                         arry    = - 0.99999714638772
                             156

                         arry    = - 0.99999714638772
                             157

                         arry    = - 0.99999714638772
                             158

                         arry    = - 0.99999714638772
                             159

                         arry    = - 0.99999714638772
                             160

                         arry    = - 0.99999714638772
                             161

                         arry    = - 0.99999714638772
                             162

                         arry    = - 0.99999714638772
                             163

                         arry    = - 0.99999714638772
                             164

                         arry    = - 0.99999714638772
                             165

                         arry    = - 0.99999714638772
                             166

                         arry    = - 0.99999714638772
                             167

                         arry    = - 0.99999714638772
                             168

                         arry    = - 0.99999714638772
                             169

                         arry    = - 0.99999714638772
                             170

                         arry    = - 0.99999714638772
                             171

                         arry    = - 0.99999714638772
                             172

                         arry    = - 0.99999714638772
                             173

                         arry    = - 0.99999714638772
                             174

                         arry    = - 0.99999714638772
                             175

                         arry    = - 0.003185301793138
                             176

                         arry    = - 0.003185301793138
                             177

                         arry    = - 0.003185301793138
                             178

                         arry    = - 0.003185301793138
                             179

                         arry    = - 0.003185301793138
                             180

                         arry    = - 0.003185301793138
                             181

                         arry    = - 0.003185301793138
                             182

                         arry    = - 0.003185301793138
                             183

                         arry    = - 0.003185301793138
                             184

                         arry    = - 0.003185301793138
                             185

                         arry    = - 0.003185301793138
                             186

                         arry    = - 0.003185301793138
                             187

                         arry    = - 0.003185301793138
                             188

                         arry    = - 0.003185301793138
                             189

                         arry    = - 0.003185301793138
                             190

                         arry    = - 0.003185301793138
                             191

                         arry    = - 0.003185301793138
                             192

                         arry    = - 0.003185301793138
                             193

                         arry    = - 0.003185301793138
                             194

                         arry    = - 0.003185301793138
                             195

                         arry    = - 0.003185301793138
                             196

                         arry    = - 0.003185301793138
                             197

                         arry    = - 0.003185301793138
                             198

                         arry    = - 0.003185301793138
                             199

                         arry    = - 0.003185301793138
                             200

(%o17)                               done
(%i18) plot2d([f,[discrete,pointx,pointy],[discrete,rx,ry]],[x,0,6.28],[style,lines,points,points],[point_type,circle,diamond],[legend,"sin(x)","",""]);
plotplot2d([f,[discrete,pointx,pointy],[discrete,rx,ry]],[x,0,6.28],[style,lines,points,points],[point_type,circle,diamond],[legend,"sin(x)","",""]);
Run Example
array(a, 5, 1);
(%o1)                                  a
(%i2) a(0,0) = 5;
(%o2)                             a(0, 0) = 5
(%i3) listarray(a);
(%o3) [#####, #####, #####, #####, #####, #####, #####, #####, #####, #####, 
                                                                  #####, #####]
(%i4) 
Run Example
array(a, 5, 1);
(%o1)                                  a
(%i2) a[1,1] = 5;
(%o2)                              a     = 5
                                    1, 1
(%i3) listarray(a);
(%o3) [#####, #####, #####, #####, #####, #####, #####, #####, #####, #####, 
                                                                  #####, #####]
(%i4) 

Related Help

Help for Listarray