### Related

##### array-do-if-listarray-plot2d-sin

array([rs,rsy],float,5);

i:0;

n:100;

Calculate

##### array-do-if-listarray-plot2d-sin

array([rs,rsy],float,5);

i:0;

n:100;

Calculate

##### array-do-if-listarray-plot2d-sin

array([rs,rsy],float,5);

i:0;

f(x):=sin(x);

Calculate

##### array-do-if-listarray-plot2d-sin

m:3;

array([rs,rsy],float,m);

i:0;

Calculate

##### array-do-if-listarray-plot2d-sin

array([rs,rsy],float,5);

i:0;

f(x):=sin(x);

Calculate

##### array-do-if-listarray-plot2d-sin

array([rs,rsy],float,5);

i:0;

n:200;

Calculate

##### array-do-if-listarray-plot2d-sin

array([rs,rsy],float,5);

i:0;

f(x):=sin(x);

Calculate

##### array-do-if-listarray-plot2d-sin

array([rs,rsy],float,5);

i:0;

f(x):=sin(x);

Calculate

##### array-do-if-listarray-plot2d-sin

array([rs,rsy],float,5);

i:0;

n:200;

Calculate

##### array-do-if-listarray-plot2d-sin

m:3;

array([rs,rsy],float,m);

i:0;

Calculate

### [array,do,if,listarray,plot2d]

Run Example
(%i1)array(rs,float,5);
(%o1)                                 rs
(%i2) i:0;
(%o2)                                  0
(%i3) f(x):=x^2;
2
(%o3)                             f(x) := x
(%i4) for x: 0 step 6.28/5 thru 6.28 do (rs[i]:x, i:i+1);
(%o4)                                done
(%i5) for i:0 thru 5 do display(rs[i]);
rs  = 0
0

rs  = 1.256
1

rs  = 2.512
2

rs  = 3.768
3

rs  = 5.024
4

rs  = 6.28
5

(%o5)                                done
(%i6) array([arrx,arry],float,101);
(%o6)                            [arrx, arry]
(%i7) i:0;
(%o7)                                  0
(%i8) for x: 0 step 3.14/50 thru 6.28 do (arrx[i]:x, i:i+1);
(%o8)                                done
(%i9) for i:0 thru 100 do (for j:0 thru 4 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])));
(%o9)                                done
(%i10) arry[100]:f(rs[5]);
(%o10)                              39.4384
(%i11) rx:listarray(arrx);
(%o11) [0, 0.0628, 0.1256, 0.1884, 0.2512, 0.314, 0.3768, 0.4396, 0.5024,
0.5652, 0.628, 0.6908, 0.7536, 0.8164, 0.8792, 0.942, 1.0048, 1.0676, 1.1304,
1.1932, 1.256, 1.3188, 1.3816, 1.4444, 1.5072, 1.57, 1.6328, 1.6956, 1.7584,
1.8212, 1.884, 1.946799999999999, 2.009599999999999, 2.0724, 2.1352, 2.198,
2.2608, 2.3236, 2.386400000000001, 2.449200000000001, 2.512000000000001,
2.574800000000001, 2.637600000000001, 2.700400000000002, 2.763200000000002,
2.826000000000002, 2.888800000000002, 2.951600000000002, 3.014400000000002,
3.077200000000003, 3.140000000000003, 3.202800000000003, 3.265600000000003,
3.328400000000003, 3.391200000000004, 3.454000000000004, 3.516800000000004,
3.579600000000004, 3.642400000000004, 3.705200000000005, 3.768000000000005,
3.830800000000005, 3.893600000000005, 3.956400000000005, 4.019200000000005,
4.082000000000005, 4.144800000000005, 4.207600000000006, 4.270400000000006,
4.333200000000006, 4.396000000000006, 4.458800000000006, 4.521600000000007,
4.584400000000007, 4.647200000000007, 4.710000000000007, 4.772800000000007,
4.835600000000007, 4.898400000000008, 4.961200000000008, 5.024000000000008,
5.086800000000008, 5.149600000000008, 5.212400000000009, 5.275200000000009,
5.338000000000009, 5.400800000000009, 5.463600000000009, 5.52640000000001,
5.58920000000001, 5.65200000000001, 5.71480000000001, 5.77760000000001,
5.840400000000011, 5.903200000000011, 5.966000000000011, 6.028800000000011,
6.091600000000011, 6.154400000000011, 6.217200000000012, 0.0, 0.0]
(%i12) ry:listarray(arry);
(%o12) [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.577536, 1.577536, 1.577536,
1.577536, 1.577536, 1.577536, 1.577536, 1.577536, 1.577536, 1.577536,
1.577536, 1.577536, 1.577536, 1.577536, 1.577536, 1.577536, 1.577536,
1.577536, 1.577536, 1.577536, 6.310144, 6.310144, 6.310144, 6.310144,
6.310144, 6.310144, 6.310144, 6.310144, 6.310144, 6.310144, 6.310144,
6.310144, 6.310144, 6.310144, 6.310144, 6.310144, 6.310144, 6.310144,
6.310144, 14.197824, 14.197824, 14.197824, 14.197824, 14.197824, 14.197824,
14.197824, 14.197824, 14.197824, 14.197824, 14.197824, 14.197824, 14.197824,
14.197824, 14.197824, 14.197824, 14.197824, 14.197824, 14.197824, 14.197824,
25.240576, 25.240576, 25.240576, 25.240576, 25.240576, 25.240576, 25.240576,
25.240576, 25.240576, 25.240576, 25.240576, 25.240576, 25.240576, 25.240576,
25.240576, 25.240576, 25.240576, 25.240576, 25.240576, 25.240576, 39.4384,
39.4384, 39.4384, 39.4384, 39.4384, 39.4384, 39.4384, 39.4384, 39.4384,
39.4384, 39.4384, 0.0]
(%i13) for i:0 thru 100 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   = 1.577536
11

arry   = 1.577536
12

arry   = 1.577536
13

arry   = 1.577536
14

arry   = 1.577536
15

arry   = 1.577536
16

arry   = 1.577536
17

arry   = 1.577536
18

arry   = 1.577536
19

arry   = 1.577536
20

arry   = 1.577536
21

arry   = 1.577536
22

arry   = 1.577536
23

arry   = 1.577536
24

arry   = 1.577536
25

arry   = 1.577536
26

arry   = 1.577536
27

arry   = 1.577536
28

arry   = 1.577536
29

arry   = 1.577536
30

arry   = 6.310144
31

arry   = 6.310144
32

arry   = 6.310144
33

arry   = 6.310144
34

arry   = 6.310144
35

arry   = 6.310144
36

arry   = 6.310144
37

arry   = 6.310144
38

arry   = 6.310144
39

arry   = 6.310144
40

arry   = 6.310144
41

arry   = 6.310144
42

arry   = 6.310144
43

arry   = 6.310144
44

arry   = 6.310144
45

arry   = 6.310144
46

arry   = 6.310144
47

arry   = 6.310144
48

arry   = 6.310144
49

arry   = 14.197824
50

arry   = 14.197824
51

arry   = 14.197824
52

arry   = 14.197824
53

arry   = 14.197824
54

arry   = 14.197824
55

arry   = 14.197824
56

arry   = 14.197824
57

arry   = 14.197824
58

arry   = 14.197824
59

arry   = 14.197824
60

arry   = 14.197824
61

arry   = 14.197824
62

arry   = 14.197824
63

arry   = 14.197824
64

arry   = 14.197824
65

arry   = 14.197824
66

arry   = 14.197824
67

arry   = 14.197824
68

arry   = 14.197824
69

arry   = 25.240576
70

arry   = 25.240576
71

arry   = 25.240576
72

arry   = 25.240576
73

arry   = 25.240576
74

arry   = 25.240576
75

arry   = 25.240576
76

arry   = 25.240576
77

arry   = 25.240576
78

arry   = 25.240576
79

arry   = 25.240576
80

arry   = 25.240576
81

arry   = 25.240576
82

arry   = 25.240576
83

arry   = 25.240576
84

arry   = 25.240576
85

arry   = 25.240576
86

arry   = 25.240576
87

arry   = 25.240576
88

arry   = 25.240576
89

arry   = 39.4384
90

arry   = 39.4384
91

arry   = 39.4384
92

arry   = 39.4384
93

arry   = 39.4384
94

arry   = 39.4384
95

arry   = 39.4384
96

arry   = 39.4384
97

arry   = 39.4384
98

arry   = 39.4384
99

arry    = 39.4384
100

(%o13)                               done
(%i14) plot2d([discrete,[rx,ry]],[x,0,6.28]);
plot
Run Example
array(rs,float,5);
(%o1)                                 rs
(%i2) i:0;
(%o2)                                  0
(%i3) f(x):=x^2;
2
(%o3)                             f(x) := x
(%i4) for x: 0 step 6.28/5 thru 6.28 do (rs[i]:x, i:i+1);
(%o4)                                done
(%i5) for i:0 thru 5 do display(rs[i]);
rs  = 0
0

rs  = 1.256
1

rs  = 2.512
2

rs  = 3.768
3

rs  = 5.024
4

rs  = 6.28
5

(%o5)                                done
(%i6) array([arrx,arry],float,101);
(%o6)                            [arrx, arry]
(%i7) i:0;
(%o7)                                  0
(%i8) for x: 0 step 3.14/50 thru 6.28 do (arrx[i]:x, i:i+1);
(%o8)                                done
(%i9) for i:0 thru 100 do (for j:0 thru 4 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])));
(%o9)                                done
(%i10) arry[100]:f(rs[5]);
(%o10)                              39.4384
(%i11) rx:listarray(arrx);
(%o11) [0, 0.0628, 0.1256, 0.1884, 0.2512, 0.314, 0.3768, 0.4396, 0.5024,
0.5652, 0.628, 0.6908, 0.7536, 0.8164, 0.8792, 0.942, 1.0048, 1.0676, 1.1304,
1.1932, 1.256, 1.3188, 1.3816, 1.4444, 1.5072, 1.57, 1.6328, 1.6956, 1.7584,
1.8212, 1.884, 1.946799999999999, 2.009599999999999, 2.0724, 2.1352, 2.198,
2.2608, 2.3236, 2.386400000000001, 2.449200000000001, 2.512000000000001,
2.574800000000001, 2.637600000000001, 2.700400000000002, 2.763200000000002,
2.826000000000002, 2.888800000000002, 2.951600000000002, 3.014400000000002,
3.077200000000003, 3.140000000000003, 3.202800000000003, 3.265600000000003,
3.328400000000003, 3.391200000000004, 3.454000000000004, 3.516800000000004,
3.579600000000004, 3.642400000000004, 3.705200000000005, 3.768000000000005,
3.830800000000005, 3.893600000000005, 3.956400000000005, 4.019200000000005,
4.082000000000005, 4.144800000000005, 4.207600000000006, 4.270400000000006,
4.333200000000006, 4.396000000000006, 4.458800000000006, 4.521600000000007,
4.584400000000007, 4.647200000000007, 4.710000000000007, 4.772800000000007,
4.835600000000007, 4.898400000000008, 4.961200000000008, 5.024000000000008,
5.086800000000008, 5.149600000000008, 5.212400000000009, 5.275200000000009,
5.338000000000009, 5.400800000000009, 5.463600000000009, 5.52640000000001,
5.58920000000001, 5.65200000000001, 5.71480000000001, 5.77760000000001,
5.840400000000011, 5.903200000000011, 5.966000000000011, 6.028800000000011,
6.091600000000011, 6.154400000000011, 6.217200000000012, 0.0, 0.0]
(%i12) ry:listarray(arry);
(%o12) [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.577536, 1.577536, 1.577536,
1.577536, 1.577536, 1.577536, 1.577536, 1.577536, 1.577536, 1.577536,
1.577536, 1.577536, 1.577536, 1.577536, 1.577536, 1.577536, 1.577536,
1.577536, 1.577536, 1.577536, 6.310144, 6.310144, 6.310144, 6.310144,
6.310144, 6.310144, 6.310144, 6.310144, 6.310144, 6.310144, 6.310144,
6.310144, 6.310144, 6.310144, 6.310144, 6.310144, 6.310144, 6.310144,
6.310144, 14.197824, 14.197824, 14.197824, 14.197824, 14.197824, 14.197824,
14.197824, 14.197824, 14.197824, 14.197824, 14.197824, 14.197824, 14.197824,
14.197824, 14.197824, 14.197824, 14.197824, 14.197824, 14.197824, 14.197824,
25.240576, 25.240576, 25.240576, 25.240576, 25.240576, 25.240576, 25.240576,
25.240576, 25.240576, 25.240576, 25.240576, 25.240576, 25.240576, 25.240576,
25.240576, 25.240576, 25.240576, 25.240576, 25.240576, 25.240576, 39.4384,
39.4384, 39.4384, 39.4384, 39.4384, 39.4384, 39.4384, 39.4384, 39.4384,
39.4384, 39.4384, 0.0]
(%i13) for i:0 thru 100 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   = 1.577536
11

arry   = 1.577536
12

arry   = 1.577536
13

arry   = 1.577536
14

arry   = 1.577536
15

arry   = 1.577536
16

arry   = 1.577536
17

arry   = 1.577536
18

arry   = 1.577536
19

arry   = 1.577536
20

arry   = 1.577536
21

arry   = 1.577536
22

arry   = 1.577536
23

arry   = 1.577536
24

arry   = 1.577536
25

arry   = 1.577536
26

arry   = 1.577536
27

arry   = 1.577536
28

arry   = 1.577536
29

arry   = 1.577536
30

arry   = 6.310144
31

arry   = 6.310144
32

arry   = 6.310144
33

arry   = 6.310144
34

arry   = 6.310144
35

arry   = 6.310144
36

arry   = 6.310144
37

arry   = 6.310144
38

arry   = 6.310144
39

arry   = 6.310144
40

arry   = 6.310144
41

arry   = 6.310144
42

arry   = 6.310144
43

arry   = 6.310144
44

arry   = 6.310144
45

arry   = 6.310144
46

arry   = 6.310144
47

arry   = 6.310144
48

arry   = 6.310144
49

arry   = 14.197824
50

arry   = 14.197824
51

arry   = 14.197824
52

arry   = 14.197824
53

arry   = 14.197824
54

arry   = 14.197824
55

arry   = 14.197824
56

arry   = 14.197824
57

arry   = 14.197824
58

arry   = 14.197824
59

arry   = 14.197824
60

arry   = 14.197824
61

arry   = 14.197824
62

arry   = 14.197824
63

arry   = 14.197824
64

arry   = 14.197824
65

arry   = 14.197824
66

arry   = 14.197824
67

arry   = 14.197824
68

arry   = 14.197824
69

arry   = 25.240576
70

arry   = 25.240576
71

arry   = 25.240576
72

arry   = 25.240576
73

arry   = 25.240576
74

arry   = 25.240576
75

arry   = 25.240576
76

arry   = 25.240576
77

arry   = 25.240576
78

arry   = 25.240576
79

arry   = 25.240576
80

arry   = 25.240576
81

arry   = 25.240576
82

arry   = 25.240576
83

arry   = 25.240576
84

arry   = 25.240576
85

arry   = 25.240576
86

arry   = 25.240576
87

arry   = 25.240576
88

arry   = 25.240576
89

arry   = 39.4384
90

arry   = 39.4384
91

arry   = 39.4384
92

arry   = 39.4384
93

arry   = 39.4384
94

arry   = 39.4384
95

arry   = 39.4384
96

arry   = 39.4384
97

arry   = 39.4384
98

arry   = 39.4384
99

arry    = 39.4384
100

(%o13)                               done
(%i14) plot2d([discrete,rx,ry]);
plot
Run Example
array(rs,float,5);
(%o1)                                 rs
(%i2) i:0;
(%o2)                                  0
(%i3) f(x):=x^2;
2
(%o3)                             f(x) := x
(%i4) for x: 0 step 6.28/5 thru 6.28 do (rs[i]:x, i:i+1);
(%o4)                                done
(%i5) for i:0 thru 5 do display(rs[i]);
rs  = 0
0

rs  = 1.256
1

rs  = 2.512
2

rs  = 3.768
3

rs  = 5.024
4

rs  = 6.28
5

(%o5)                                done
(%i6) array([arrx,arry],float,101);
(%o6)                            [arrx, arry]
(%i7) i:0;
(%o7)                                  0
(%i8) for x: 0 step 3.14/50 thru 6.28 do (arrx[i]:x, i:i+1);
(%o8)                                done
(%i9) for i:0 thru 100 do (for j:0 thru 4 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])));
(%o9)                                done
(%i10) arry[100]:f(rs[5]);
(%o10)                              39.4384
(%i11) rx:listarray(arrx);
(%o11) [0, 0.0628, 0.1256, 0.1884, 0.2512, 0.314, 0.3768, 0.4396, 0.5024,
0.5652, 0.628, 0.6908, 0.7536, 0.8164, 0.8792, 0.942, 1.0048, 1.0676, 1.1304,
1.1932, 1.256, 1.3188, 1.3816, 1.4444, 1.5072, 1.57, 1.6328, 1.6956, 1.7584,
1.8212, 1.884, 1.946799999999999, 2.009599999999999, 2.0724, 2.1352, 2.198,
2.2608, 2.3236, 2.386400000000001, 2.449200000000001, 2.512000000000001,
2.574800000000001, 2.637600000000001, 2.700400000000002, 2.763200000000002,
2.826000000000002, 2.888800000000002, 2.951600000000002, 3.014400000000002,
3.077200000000003, 3.140000000000003, 3.202800000000003, 3.265600000000003,
3.328400000000003, 3.391200000000004, 3.454000000000004, 3.516800000000004,
3.579600000000004, 3.642400000000004, 3.705200000000005, 3.768000000000005,
3.830800000000005, 3.893600000000005, 3.956400000000005, 4.019200000000005,
4.082000000000005, 4.144800000000005, 4.207600000000006, 4.270400000000006,
4.333200000000006, 4.396000000000006, 4.458800000000006, 4.521600000000007,
4.584400000000007, 4.647200000000007, 4.710000000000007, 4.772800000000007,
4.835600000000007, 4.898400000000008, 4.961200000000008, 5.024000000000008,
5.086800000000008, 5.149600000000008, 5.212400000000009, 5.275200000000009,
5.338000000000009, 5.400800000000009, 5.463600000000009, 5.52640000000001,
5.58920000000001, 5.65200000000001, 5.71480000000001, 5.77760000000001,
5.840400000000011, 5.903200000000011, 5.966000000000011, 6.028800000000011,
6.091600000000011, 6.154400000000011, 6.217200000000012, 0.0, 0.0]
(%i12) ry:listarray(arry);
(%o12) [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.577536, 1.577536, 1.577536,
1.577536, 1.577536, 1.577536, 1.577536, 1.577536, 1.577536, 1.577536,
1.577536, 1.577536, 1.577536, 1.577536, 1.577536, 1.577536, 1.577536,
1.577536, 1.577536, 1.577536, 6.310144, 6.310144, 6.310144, 6.310144,
6.310144, 6.310144, 6.310144, 6.310144, 6.310144, 6.310144, 6.310144,
6.310144, 6.310144, 6.310144, 6.310144, 6.310144, 6.310144, 6.310144,
6.310144, 14.197824, 14.197824, 14.197824, 14.197824, 14.197824, 14.197824,
14.197824, 14.197824, 14.197824, 14.197824, 14.197824, 14.197824, 14.197824,
14.197824, 14.197824, 14.197824, 14.197824, 14.197824, 14.197824, 14.197824,
25.240576, 25.240576, 25.240576, 25.240576, 25.240576, 25.240576, 25.240576,
25.240576, 25.240576, 25.240576, 25.240576, 25.240576, 25.240576, 25.240576,
25.240576, 25.240576, 25.240576, 25.240576, 25.240576, 25.240576, 39.4384,
39.4384, 39.4384, 39.4384, 39.4384, 39.4384, 39.4384, 39.4384, 39.4384,
39.4384, 39.4384, 0.0]
(%i13) for i:0 thru 100 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   = 1.577536
11

arry   = 1.577536
12

arry   = 1.577536
13

arry   = 1.577536
14

arry   = 1.577536
15

arry   = 1.577536
16

arry   = 1.577536
17

arry   = 1.577536
18

arry   = 1.577536
19

arry   = 1.577536
20

arry   = 1.577536
21

arry   = 1.577536
22

arry   = 1.577536
23

arry   = 1.577536
24

arry   = 1.577536
25

arry   = 1.577536
26

arry   = 1.577536
27

arry   = 1.577536
28

arry   = 1.577536
29

arry   = 1.577536
30

arry   = 6.310144
31

arry   = 6.310144
32

arry   = 6.310144
33

arry   = 6.310144
34

arry   = 6.310144
35

arry   = 6.310144
36

arry   = 6.310144
37

arry   = 6.310144
38

arry   = 6.310144
39

arry   = 6.310144
40

arry   = 6.310144
41

arry   = 6.310144
42

arry   = 6.310144
43

arry   = 6.310144
44

arry   = 6.310144
45

arry   = 6.310144
46

arry   = 6.310144
47

arry   = 6.310144
48

arry   = 6.310144
49

arry   = 14.197824
50

arry   = 14.197824
51

arry   = 14.197824
52

arry   = 14.197824
53

arry   = 14.197824
54

arry   = 14.197824
55

arry   = 14.197824
56

arry   = 14.197824
57

arry   = 14.197824
58

arry   = 14.197824
59

arry   = 14.197824
60

arry   = 14.197824
61

arry   = 14.197824
62

arry   = 14.197824
63

arry   = 14.197824
64

arry   = 14.197824
65

arry   = 14.197824
66

arry   = 14.197824
67

arry   = 14.197824
68

arry   = 14.197824
69

arry   = 25.240576
70

arry   = 25.240576
71

arry   = 25.240576
72

arry   = 25.240576
73

arry   = 25.240576
74

arry   = 25.240576
75

arry   = 25.240576
76

arry   = 25.240576
77

arry   = 25.240576
78

arry   = 25.240576
79

arry   = 25.240576
80

arry   = 25.240576
81

arry   = 25.240576
82

arry   = 25.240576
83

arry   = 25.240576
84

arry   = 25.240576
85

arry   = 25.240576
86

arry   = 25.240576
87

arry   = 25.240576
88

arry   = 25.240576
89

arry   = 39.4384
90

arry   = 39.4384
91

arry   = 39.4384
92

arry   = 39.4384
93

arry   = 39.4384
94

arry   = 39.4384
95

arry   = 39.4384
96

arry   = 39.4384
97

arry   = 39.4384
98

arry   = 39.4384
99

arry    = 39.4384
100

(%o13)                               done
(%i14) plot2d([discrete,[rx,ry]]);
plot

### Related Help

Help for Array

Help for Do

Help for If

Help for Listarray

Help for Plot2d