Items tagged with array array Tagged Items Feed


I've got this error in my code and I don't know why as I didn't get it when I used a different xn function. Any help would be greatly appreciated! Thank you in advance!

Kind regards,

Gambia Man



boxcount := proc (data, N) local n, xmax, xmin, xrange, ymax, ymin, yrange, dx, dy, i, j, ix, iy, sum, res; n := (1/2)*ArrayNumElems(data); xmax := max(seq(data[i, 1], i = 1 .. n)); xmin := min(seq(data[i, 1], i = 1 .. n)); ymax := max(seq(data[i, 2], i = 1 .. n)); ymin := min(seq(data[i, 2], i = 1 .. n)); xrange := xmax-xmin; xmin := xmin+(-1)*0.1e-1*xrange; xmax := xmax+0.1e-1*xrange; xrange := 1.02*xrange; yrange := ymax-ymin; ymin := ymin+(-1)*0.1e-1*yrange; ymax := ymax+0.1e-1*yrange; yrange := 1.02*yrange; dx := xrange/N; dy := yrange/N; res := Array(0 .. N-1, 0 .. N-1, 0); for i to n do ix := trunc((data[i, 1]-xmin)/dx); iy := trunc((data[i, 2]-ymin)/dy); res[ix, iy] := 1 end do; add(add(res[i, j], i = 0 .. N-1), j = 0 .. N-1) end proc:


bicationplot := proc (N) local Nr, Nt, x0, rmin, rmax, bif, k, ir, r, xn, i; global pts; Nr := 100; Nt := 200; x0 := .1; rmin := .75; rmax := 3.5; bif := Array(1 .. Nr*N, 1 .. 2); k := 1; for ir to Nr do r := rmin+ir*(rmax-rmin)/Nr; xn := x0; for i to Nt do xn := xn^2-r end do; for i to N do xn := xn^2-r; bif[k, 1] := r; bif[k, 2] := xn; k := k+1 end do end do; pts := bif end proc:




fractaldimension := proc (Noofitterations::integer, Npoints::integer, Nmax::integer) local res, xv, yv, line, stderrors, avgstderrors, i, avgline; avgstderrors := 0; avgline := 0; for i to Noofitterations do bicationplot(Npoints); res := [seq([1.0/n, boxcount(pts, n)], n = 1 .. Nmax, 10)]; xv := [seq(log(res[i][1]), i = 1 .. nops(res))]; yv := [seq(log(res[i][2]), i = 1 .. nops(res))]; line[i] := Fit(m*x+const, xv, yv, x, output = [leastsquaresfunction]); stderrors[i] := Fit(m*x+const, xv, yv, x, output = standarderrors) end do; for i to Noofitterations do avgstderrors := avgstderrors+stderrors[i] end do; avgstderrors := avgstderrors/Noofitterations; for i to Noofitterations do avgline := avgline+line[i] end do; avgline := avgline/Noofitterations; return FD = -(diff(avgline, x)), avgline, avgstderrors, loglogplot(res) end proc:

fractaldimension(10, 100, 100)

Error, (in boxcount) bad index into Array





 with small step rather than two points?

I had writen my questions into this code And I think there's maybe something wrong with A=[0..130]

I think you can understand what I want by reading this code but if you are confused please let me know.

Hi everyone,

I am trying to copy a 178x2 matrix into maple. the data is in a .dat file in two columns. For example the first few lines:

+2.000000E-10 +1.636232E-05

+3.017707E-05 +4.531920E-05

+6.065973E-05 +7.586885E-05

+9.096636E-05 +1.059570E-04

+1.208671E-04 +1.357189E-04


I´ve got 2-dimensional array (100x100) of values, which I'd like to plot as 3d graph, where x,y axis would be coords in the array and z-axis would be the value there.

Values are formed by procedure, not by function, so I can't use standard 3d plot, that plots a 3d surface. I think the best is to use the pointplot3d function, but you have to assign each point separately. 

I tried to create a list of pointplot3d plots, one for each row of the array, and then display these plots all in one, but I just received GLException error.

Do you have any ideas?

I want to refer to the first element in a list such as x:=[1,2,3] as x[0] not x[1].

How to do it?

The black point correction for xyY to sRGB was incorrect in my original post. It should be done the same ways as for xyY to aRGB which was correct. Hope nobody was inconvenienced. 


I would be curious if others have found a more elegant way to index through an Array to perform an operation on a set of vectors. I had to use the single quote to get the operation performed first and the index increment second. 



  I have the following input in order to obtain the dimension of an array, by means of the values has been assigned




  The result is 


[ 1 1 ]
Error, invalid input: LinearAlgebra:-Dimension expects its 1st argument, A, to be of type {Matrix, Vector} or coercible via `~Simplify`, but received f



I cannot get number "2", which is expected. Is there any way to obtain that? I looked for help and mapleprime, without any simple solution ......


Thank you very much!




  Suppose I have an array





  I would like to check if an element, e.g. "c", belong to this array. I can contrsuct a "for... end do" command to compare each element and/or construct a subroutine. 


  Is there any build-in function in maple can do that? Perferably return true/false


Thank you!


  Excuse me, I have the following code





for i from 1 to n do
end do;



 The output ends up with


Error, (in combinat:-permute) 1st argument must be a list, set or a non-negative integer


 It seems that maple will not generate permutation of g... How to generate the permutation of array g? i.e. by assigning all variables automatically.


Thank you very much!


 Let M be a matrix with polynomial array f_i's such that any array is in K[a_1,..,a_m][x_1,..,x_n] where a=a_1,,,a_m are sequence of parameters and x=x_1,..,x_n are sequense of variables. Now, I want to extract the coefficients of  f_i that are in K[a_1,a_2,..,a_m]. For example if M=Matrix([[ax-bxy],[cx^2-dy]]) how can I extract the matrix coefficint C=Matrix([[a,-b],[c,-d]])?

Please note that a,b,c,d are parameters and x,y are variables.

Hi all,


min/max command in Maple can return the minimum/maximum of a sequence or array.

 In my case, I want to find not only the minimum/maximum, but also where are them. How can I do?

For example, there is a squence [1,2,3,7,6,5,4].

Through max([1,2,3,7,6,5,4]), we can get 7.

But I still want to get "4" which is the index value of "7". 


Thank you.


Hello people,


I've been working with a list of [x,y,z] elements, where the x and y are positions, and z is the value at given x y. I wish to be able to plot the results so that they look like this

Plot of points


I made the above plot using the following code


where points[1] is a list of lists of points.

Glad that i was succesful, i tried to apply this method to a must larger number of points, only to be met by the following error

Error, (in makePlotFromLargeFNASet) assigning to a long list, please use Arrays

So, i made it so that points[1] became an array instead of a list of lists. When trying to apply surfdata now, using the exact same line as above, the plot is not 2D with colors as the 3rd dimension, but only returns a 3D plot as if dimension=3. It is endlessly frustrating, since there doesn't seem to be any sense to the error, and i cannot find an answer to why it does so. Any help would be appreciated!


Thanks in advance,



EDIT: I have uploaded the worksheet and the two files that i use on the following link:


I have a nice 1 x 2 arry of plots, both columns of which are animations. They play beautifully inline. However, I cannot get them to export. Only one column can be selected at a time, hence I could export each animation separately, but the whole idea is to watch the animations together, side-by-side.

I have tried to change the plot setup to export to a file but when I do that I get an error in plots[display].

See the file above for details.

It could be that Display just cannot do this. But I don't see why not. I can export an array of plots of static images and it creates a single GIF file with both columns. The animated gifs should just be this same idea done 50 times over.


Any advice?

I want to generate all 4x4 matrices of rank-1 over the field with two elements, F_2. I don't want to use actual arrays though, I just want to use symbols representing the unit matrices. So for example Eij represents the 4x4 matrix with a 1 in row i & column j, and 0's elsewhere. 

We have 16 unit matrices: E11, E12, ..., E14, ... E41, E42, E43, E44. Then we have to look at all possible linear combinations that result in a rank-1 matrix. So for example: E11+E12,  E11+E21,  E11+E12+E13,  E33+E43, etc. The total number of rank-1 4x4 matrices over F_2 is 225. How can I find all of these quickly?

I am required to generate a list containing the square of numbers 1 through k where k is an arbitrary int,defined from 1 to n. To do this, I've currently got the following commands:

local k, mylist:=[];

for k from 1 to n do


end do;

where sumsquare() is a procedure I defined to compute the sum of the squares of 1 through a number passed as an argument

At present this gives me an out of bounds error. 

How can I initialize mylist to be of size n, like in other languages such as C++?


1 2 3 4 5 6 7 Last Page 1 of 25