This file is indexed.

/usr/share/doc/libplplot12/examples/octave/x09c.m is in octave-plplot 5.10.0+dfsg-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
## Copyright (C) 1998, 1999, 2000 Joao Cardoso.
## 
## This program is free software; you can redistribute it and/or modify it
## under the terms of the GNU General Public License as published by the
## Free Software Foundation; either version 2 of the License, or (at your
## option) any later version.
## 
## This program is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
## General Public License for more details.
##
## This file is part of plplot_octave.
## It is based on the corresponding demo function of PLplot.

## Does several contour plots using different coordinate mappings.

1;

global	XPTS=35;		## Data points in x
global	YPTS=46;		## Datat points in y

global	tr = [2/(XPTS-1); 0.0; -1.0; 0.0; 2/(YPTS-1); -1.0];	

function [tx ty] = mypltr(x, y)

  global	XPTS
  global	YPTS
  global	tr

  tx = tr(1) * x + tr(2) * y + tr(3);
  ty = tr(4) * x + tr(5) * y + tr(6);
  
endfunction


function _polar

  plenv(-1., 1., -1., 1., 0, -2);
  plcol0(1);

  ## Perimeter
  PERIMETERPTS = 100;
  RPTS = 40;
  THETAPTS = 40;

  i = 0:PERIMETERPTS-1;
  t = (2.*pi/(PERIMETERPTS-1))*i;
  px = cos(t);
  py = sin(t);
  plline(px', py');

  ## create data to be contoured
  i = 0:RPTS-1;
  r = i/(RPTS-1);
  z = r'*ones(1,RPTS);

  j = (0:THETAPTS-1)';
  theta = (2.*pi/(THETAPTS-1))*j;
  xg = cos(theta)*r;
  yg = sin(theta)*r;

  i = 0:9;
  lev = 0.05 + 0.10* i';

  plcol0(2);
  plcont2(z, 1, RPTS, 1, THETAPTS, lev, xg', yg');
  plcol0(1);
  pllab("", "", "Polar Contour Plot");
endfunction

## shielded potential contour plot example.

function potential

  PPERIMETERPTS = 100;
  PRPTS = 40;
  PTHETAPTS = 64;
  PNLEVEL = 20;
  
  ## create data to be contoured

  i = 0:PRPTS-1;
  r = 0.5 + i;
  j = (0:PTHETAPTS-1)';
  theta = (2.*pi/(PTHETAPTS-1))*(0.5 + j);
  xg = (cos(theta)*r)';
  yg = (sin(theta)*r)';

  rmax = max(r);
  xmin = min(min(xg));
  xmax = max(max(xg));
  ymin = min(min(yg));
  ymax = max(max(yg));

  x0 = (xmin + xmax)/2;
  y0 = (ymin + ymax)/2;
  
  ## Expanded limits
  peps = 0.05;
  xpmin = xmin - abs(xmin)*peps;
  xpmax = xmax + abs(xmax)*peps;
  ypmin = ymin - abs(ymin)*peps;
  ypmax = ymax + abs(ymax)*peps;
  
  ## Potential inside a conducting cylinder (or sphere) by method of images.
  ## Charge 1 is placed at (d1, d1), with image charge at (d2, d2).
  ## Charge 2 is placed at (d1, -d1), with image charge at (d2, -d2).
  ## Also put in smoothing term at small distances.
  
  eeps = 2.;

  q1 = 1.;
  d1 = rmax/4.;
  
  q1i = - q1*rmax/d1;
  d1i = rmax^2/d1;
  
  q2 = -1.;
  d2 = rmax/4.;
  
  q2i = - q2*rmax/d2;
  d2i = rmax^2/d2;

  div1 = sqrt((xg-d1).^2 + (yg-d1).^2 + eeps^2);
  div1i = sqrt((xg-d1i).^2 + (yg-d1i).^2 + eeps^2);
  div2 = sqrt((xg-d2).^2 + (yg+d2).^2 + eeps^2);
  div2i = sqrt((xg-d2i).^2 + (yg+d2i).^2 + eeps^2);
  z = q1./div1 + q1i./div1i + q2./div2 + q2i./div2i;

  zmin = min(min(z));
  zmax = max(max(z));

  ## Positive and negative contour levels.
  dz = (zmax-zmin)/ PNLEVEL;

  i = 0:PNLEVEL-1;
  clevel = zmin + ( i + 0.5)*dz;
  clevelneg = clevel(clevel <= 0);
  clevelpos = clevel(clevel > 0);
  nlevelneg = columns( clevelneg);
  nlevelpos = columns( clevelpos);

  ## Colours! 
  ncollin = 11;
  ncolbox = 1;
  ncollab = 2;
  
  ## Finally start plotting this page!
  pladv(0);
  plcol0(ncolbox);

  plvpas(0.1, 0.9, 0.1, 0.9, 1.0);
  plwind(xpmin, xpmax, ypmin, ypmax);
  plbox("", 0., 0, "", 0., 0);
  
  plcol0(ncollin);
  if(nlevelneg >0)
    ## Negative contours
    pllsty(2);
    plcont2(z, 1, PRPTS, 1, PTHETAPTS, clevelneg', xg, yg);
  endif
  
  if(nlevelpos >0) 
    ## Positive contours
    pllsty(1);
    plcont2(z, 1, PRPTS, 1, PTHETAPTS, clevelpos', xg, yg);
  endif
  
  ## Draw outer boundary
  i = 0:PPERIMETERPTS-1;
  t = (2.*pi/(PPERIMETERPTS-1))*i;
  px = x0 + rmax*cos(t);
  py = y0 + rmax*sin(t);
  
  plcol0(ncolbox);
  plline(px', py');
  
  plcol0(ncollab);
  pllab("", "", "Shielded potential of charges in a conducting sphere");

endfunction
	
function ix09c

	  global	XPTS
	  global	YPTS
	  global	tr

	  clevel = linspace(-1,1,11)';
	  ## Hack to ensure that zero contour really is zero
	  ## and not a very small number.
	  ## For me problem only occurs on i386 32 bit Debian 3.1 
	  ## with octave 2.1.69.
	  ## 64-bit Ubuntu Dapper with octave 2.1.72 seems ok.
	  clevel(6) = 0.0;

          mark0 = []; space0 = [];
	  mark1 = [1500]; space1 = [1500];

	  ## Parse and process command line arguments 

	  ##    (void) plparseopts(&argc, argv, PL_PARSE_FULL);

	  ## Initialize plplot

	  plinit();

	  ## Set up function arrays 

	  for i=0:XPTS-1
	    xx = (i - fix(XPTS / 2)) /  fix(XPTS / 2);
	    yy = ((0:YPTS-1) - fix(YPTS / 2)) / fix(YPTS / 2) - 1.0;
	    z(i+1,:) = xx * xx - yy .* yy;
	    w(i+1,:) = 2 * xx .* yy;
	  endfor

	  ## Plot using identity transform
if (0)
	  pl_setcontlabelparam(0.006, 0.3, 0.1, 0);
	  plenv(-1.0, 1.0, -1.0, 1.0, 0, 0);
	  plcol0(2);
	  plcont(z, 1, XPTS, 1, YPTS, clevel, tr);
	  plstyl(mark1, space1);
	  plcol0(3);
	  plcont(w, 1, XPTS, 1, YPTS, clevel, tr);
	  plstyl(mark0, space0);
	  plcol0(1);
	  pllab("X Coordinate", "Y Coordinate", "Streamlines of flow");
endif
	  pl_setcontlabelformat(4,3);
	  pl_setcontlabelparam(0.006, 0.3, 0.1, 1);
	  plenv(-1.0, 1.0, -1.0, 1.0, 0, 0);
	  plcol0(2);
	  plcont(z, 1, XPTS, 1, YPTS, clevel, tr);
	  plstyl(mark1, space1);
	  plcol0(3);
	  plcont(w, 1, XPTS, 1, YPTS, clevel, tr);
	  plstyl(mark0, space0);
	  plcol0(1);
	  pllab("X Coordinate", "Y Coordinate", "Streamlines of flow");

	  ## Set up grids

	  for i=0:XPTS-1
	    [xx yy] = mypltr(i, (0:YPTS-1));

	    argx = xx * pi/2;
	    argy = yy * pi/2;
	    distort = 0.4;

	    xg3(i+1,:) = xx .+ distort .* cos(argx);
	    yg3(i+1,:) = yy .- distort .* cos(argy);
	    
	    xg2(i+1,:) = xx .+ distort .* cos(argx) .* cos(argy);
	    yg2(i+1,:) = yy .- distort .* cos(argx) .* cos(argy);
	  endfor

	  xg1 = xg3(:,1);
	  yg1 = yg3(XPTS,:)';


	  ## Plot using 1d coordinate transform

	  pl_setcontlabelparam(0.006, 0.3, 0.1, 0);
	  plenv(-1.0, 1.0, -1.0, 1.0, 0, 0);
	  plcol0(2);
	  plcont1(z, 1, XPTS, 1, YPTS, clevel, xg1, yg1);
	  plstyl(mark1, space1);
	  plcol0(3);
	  plcont1(w, 1, XPTS, 1, YPTS, clevel, xg1, yg1);
	  plstyl(mark0, space0);
	  plcol0(1);
	  pllab("X Coordinate", "Y Coordinate", "Streamlines of flow");
if(0)
	  pl_setcontlabelparam(0.006, 0.3, 0.1, 1);
	  plenv(-1.0, 1.0, -1.0, 1.0, 0, 0);
	  plcol0(2);
	  plcont1(z, 1, XPTS, 1, YPTS, clevel, xg1, yg1);
	  plstyl(mark1, space1);
	  plcol0(3);
	  plcont1(w, 1, XPTS, 1, YPTS, clevel, xg1, yg1);
	  plstyl(mark0, space0);
	  plcol0(1);
	  pllab("X Coordinate", "Y Coordinate", "Streamlines of flow");
endif
	  ## Plot using 2d coordinate transform

	  pl_setcontlabelparam(0.006, 0.3, 0.1, 0);
	  plenv(-1.0, 1.0, -1.0, 1.0, 0, 0);
	  plcol0(2);
	  plcont2(z, 1, XPTS, 1, YPTS, clevel, xg2, yg2);
	  plstyl(mark1, space1);
	  plcol0(3);
	  plcont2(w, 1, XPTS, 1, YPTS, clevel, xg2, yg2);
	  plstyl(mark0, space0);
	  plcol0(1);
	  pllab("X Coordinate", "Y Coordinate", "Streamlines of flow");
if(0)
	  pl_setcontlabelparam(0.006, 0.3, 0.1, 1);
	  plenv(-1.0, 1.0, -1.0, 1.0, 0, 0);
	  plcol0(2);
	  plcont1(z, 1, XPTS, 1, YPTS, clevel, xg1, yg1);
	  plstyl(mark1, space1);
	  plcol0(3);
	  plcont1(w, 1, XPTS, 1, YPTS, clevel, xg1, yg1);
	  plstyl(mark0, space0);
	  plcol0(1);
	  pllab("X Coordinate", "Y Coordinate", "Streamlines of flow");
endif
	  pl_setcontlabelparam(0.006, 0.3, 0.1, 0);
	  _polar();
	  ## pl_setcontlabelparam(0.006, 0.3, 0.1, 1);
	  ## _polar();


    pl_setcontlabelparam(0.006, 0.3, 0.1, 0);
    potential();
    ## pl_setcontlabelparam(0.006, 0.3, 0.1, 1);
    ## potential();


	  plend1();

	endfunction

ix09c