Items tagged with seq seq Tagged Items Feed

Here is my command


> teksbiasa:=`Kriptografi`;




>nilaiASCII:=convert(teksbiasa, bytes);





Anyone know how i need to write the command to add the lenght of the text (len) into each of the number in nilaiASCII?

What is want to get is:


Thank you~=]]



So I'm trying to generate a .dat file that has x in the first column, then the output for y1 in the next and y2 in the following, where y1 and y2 are functions of x so the data file would look something like this from x=-5..5 in equal steps of 0.01.

-5          12           8
-4.99     7             5


I'm struggling to get my head around how to do this, i understand i should use the seq function in maple and save it in array of sorts and then use writedata, but im not sure how to piece it together for having 3 columns


thanks in advance for any help!

I am trying to do some algebra with the derivatives of some variables within a program. As a result i need to relable them before i feed them into solve.

To relable them i create vectors and use subs. one of these vectors behaves differently within a proc to how it behaves outside it. This is weird.

TimefullBehavesFunny := proc (nPars, nVars)
local nDiffs, timefull, timeless;
nDiffs := nPars;
timefull := [seq(dx[j, i] = diff(x[i](t), `$`(t, j)), i = 1 .. nVars)];
timefull := [seq(op(timefull), j = 0 .. nDiffs), seq(x[i] = x[i](t), i = 1 .. nVars)];
timeless := `~`[`=`](`~`[rhs](timefull), `~`[lhs](timefull));
timefull, timeless, nDiffs;
end proc

When i run the above for (3,3) i get a differet result to when i run the following
nDiffs := 3;
timefull := [seq(dx[j, i] = diff(x[i](t), `$`(t, j)), i = 1 .. nVars)];
timefull := [seq(op(timefull), j = 0 .. nDiffs), seq(x[i] = x[i](t), i = 1 .. nVars)];
timeless := `~`[`=`](`~`[rhs](timefull), `~`[lhs](timefull));

and similarly for other numbers.

any ideasas to why?



    The following code displays values of the subscripted variables slf[], a positive integer, and a string variable filler[] which is just a set of spaces depending on how big the corresponding value of slf[] s.  This is to make the printout lined up nicely.  

printf("%s%d%s%d%s%d%s%d%s%d%s%d%s%d%s%d%s%d%s%d\n", filler[1],slf[1],filler[2],slf[2],filler[3],slf[3],filler[4],slf[4],filler[5],slf[5],filler[6],slf[6],filler[7],slf[7],filler[8],slf[8],filler[9],slf[9],filler[10],slf[10]);

   This works fine,but thought there might be a better way.  I tried:


but this came up with an error message.  Is there  a way of doing this more efficiently?

thanks,   David 



I have a little question which is in the title.

It seems to me at the view of this example :

[x[i], y[i]] $ i=1..4;

seq([x[i], y[i]],i=1..4);

May you give me your feedback to be sure ?

Thank you 

Dear all,

Thank you for helping me  to generate a table of values of f(x) starting with x=0 to 100 in steps of 1, that is for x=0,1,2,3,...,100.


I tried:

f:=x->2*sqrt(3)*a1*a2*(sum(pochhammer(1/3,k)*3^k*x^(3*k)/(3*k)! ,k=0..infinity)*sum(pochhammer(2/3,k)*3^k*x^(3*k+2)/(3*k+2)!  ,k=0..infinity)-sum(pochhammer(2/3,k)*3^k*x^(3*k+1)/(3*k+1)!  ,k=0..infinity)*sum(pochhammer(1/3,k)*3^k*x^(3*k+1)/(3*k+1)!  ,k=0..infinity));


But I the result is amazing.... I don't understand the problem.





I try to get the first ten fractions of Pi with the commands "seq" and "nthconver".

I tried this:

a:= cfrac(Pi);
CFRAC([3, 7, 15, 1, 292, 1, 1, 1, 2, 1, 3, ...])


But it doesn't work.

Who can help me?


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:


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?



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.

How do I construct the seuqence 1/16 , 1/32 , 1/64 , 1/128 , 1/256 in maple?


What's the syntax?

I looked at the examples in here:


But didn't find something similar.




I need to be able to find the difference between the ith+1 and the ith element of a sequence and store that difference in another list. My code so far doesn't seem to be able to do that. My code is below. Thank you in advance to anyone taking their time looking at this, any help is greatly appreciated!



Kind regards,

Gambia Man

Hi I am not very used to Maple since I used mathematica previously.

So is there way to put an if statement within sequecne definition? that is,


id = 1;

seq(if(i>2, idx += 1), idx+i , i=1..10)


something like this where if statement runs and then idx+i is added to the sequence, as if I am running a loop.


i recall having asked this question before and having received answers which unfortunately I cannot locate.

I wish to generate a sequence like
    a[1], b[1], a[2], b[2], a[3], b[3]

The following does not work for the obvious reason:

    seq(a[i], b[i], i=1..3);

What is the right way?

There is million items in list, 

what is the difference between seq and for loop ?

is seq faster than for loop?

it is very slow when running code below, how to speed up this part of code?

HSKeyIn := Table();
for ij from 1 to 1685159 do
s := solve([mm[ij][1,1]=1,mm[ij][1,2]=1,mm[ij][1,3]=1],[a,b,c]):
if nops(s) > 0 then
if (rhs(s[1][1]) = 1 or rhs(s[1][1]) = 0) and (rhs(s[1][2]) = 1 or rhs(s[1][2]) = 0) and (rhs(s[1][3]) = 1 or rhs(s[1][3]) = 0) then
#print(lhs(indices(T3, pairs)[ij])):
h := HilbertSeries([mm[ij][1,1],mm[ij][1,2],mm[ij][1,3]], {a,b,c}, z):
if not assigned(HSkeyIn[h]) then
if mod(ij, 100) = 0 then
end if:
HSkeyIn[h] := [[mm[ij][1,1],mm[ij][1,2],mm[ij][1,3]]]:
if mod(ij, 100) = 0 then
end if:
HSkeyIn[h] := [op(HSkeyIn[h]), [mm[ij][1,1],mm[ij][1,2],mm[ij][1,3]]]:
end if:

end if:
end if:

mm := [[a, 1], [a, b]];
mmseq := {seq(mm[ij],ij=1..2)};

how to filter above in seq when any items in the [] has 1

criteria is below

if mm[ij][1] = 1 or mm[ij][2] = 1 or mm[ij][3] = 1 then
Dummy := 0:
mm2 := [op(mm2), mm[ij]]:
end if


Hi, I'm having a problem regarding this equation:
                                                           sum(v(i), i = 1 .. 28)

where, v is a Data Table created under the Components Tab with 28 Rows, and 1 Column.

I keep on getting an error of: 

                                                     Error, unsupported type of index, i

I didn't use or declare 'i' in any part of the program.

Thank you for your help! 

1 2 3 4 5 Page 1 of 5