Items tagged with array array Tagged Items Feed

Dear Maple users

I know how to fit a function with some parameters to some data, but how can it be done if the data is 2-dimensional? I mean: I have some time array T, some X array and some Y array. How do I fit a function with certain parameters to the data: (x(t),y(t)) to fit (X(T), y(T)), ...

Erik

Hello

I have such problem:

I calculated rather complicated function, and i want to obtain the array or list of data with definite step.

For this purpose I used next expression:

Out:=[seq(t,F(t),t=0..tmax,step]

I need minimum 1000 points, but calculation for the 100 points requires about 300 second, for 1000 - it will be about 3000 seconds. It's too long for me.

 

How could I accelerate this process?

 

P.S.

Plotting of my function requires about 90 seconds for the entire range. So, this is very strange, thad converting to data list requres so much time.

Hello,

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

restart

with(plots):

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:

bif

bif

(1)

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

 

``

 

Download First_part_fractal_determination_.mw

 with small step rather than two points?

I had writen my questions into this code hw2_finished.mw 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

Hello,

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.

 

Corrections to the original version of theis document;
• Make the scaling for a nonzero black point the same for all RGB color spaces.
• Clip negative RGB values to zero.
• Remove the redundant Array container from matrix multiplications.
Use map in place of the $ to apply a function to each element of an Array.

Pixel_Conversion_B.mw

Hi,

 

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

 

with(ArrayTools):
with(LinearAlgebra):
f[1]:=1:
f[2]:=2:
nops(f);
Size(f);
Dimension(f);

 

  The result is 

---

1
[ 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!

  

Hi,

 

  Suppose I have an array

A[1]:=a;

A[2]:=b;

A[3]:=c;

 

  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!

Hi,

  Excuse me, I have the following code

  

###########################

with(combinat);
with(LinearAlgebra);
f:=([1,2,3]);
permute(f);

n:=3;
g:=array(1..n);

for i from 1 to n do
  g[i]:=i;
end do;

permute(g);

###########################

 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

 link:http://imgur.com/t6fEHee

I made the above plot using the following code

surfdata(points[1],dimension=2,colorscheme=["Orange","MediumBlue"])

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,

Mehdi

 

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

http://www.filedropper.com/plotscript

conic_section_animation.mw

 

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?

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