Items tagged with sequences sequences Tagged Items Feed

Hi everyone

Title might be misleading but couldn't come up with a short version of my problem.

The idea is to show an animation of several plots of an array, which all have different values in the positive and in the negative range. For distinguishing purposes I want to show positive values in a different colour than the negative values.

For better understanding imagine a chess board with the rows and columns and there are places with values, black chess pieces as positive values and white chess pieces as negative values. Each array in the sequence from A1 to An shows a movement.

For the plots I use sparsematrixplot which unfortunately just shows all non-zero values. So I seperated the original array and made two arrays, one with the positive values and one with the negative values. I am able to animate the sequence of several plots and can play the animation of two sequences consecutively with following:

A:=seq(sparsematrixplot(convert(H||g,matrix),color=green,view=[0..10,0..10]),g=1..G):
B:=seq(sparsematrixplot(convert(F||g,matrix),color=red,view=[0..10,0..10]),g=1..G):
display([A,B], insequence=true);

Hence my questions
1. Is it possible to plot an array with different colours for different values and can I animate these plots?

2. If not, is there a way to display the two plot sequences on top of each other?

 

Thanks for your help in advance.

Hi,

 

tmp:=seq([phi[5-j]*(1-p[6-j]),phi[5-j]*p[6-j]],j=1..4);
Vector(8,[seq(op(tmp[i]),i=1..4)]);

"tmp" is basically what I want. Some kind of 'paired' terms, indexed in reverse order.

I wonder if there is a better (perhaps more efficient and "direct") way to do it?

 

Thanks,

casper

Hi all,

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

Works fine.

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

gives nothing.

But if what I really want, is a ordered sequence

for i from 3 by -1 to 1 do

r:=[op(r),a[i]];

end do;

a[3],a[2],a[1]

What's the best way to get it? (apart from writing a loop)

 

Casper

Hey,

I'm currently working on sequences and can't figure out how to get all of the terms to work modp, is there an easy way of doing this instead of having to use mod(a,p) on each separate term?

Thanks

Rach

 

with(numtheory):

f := proc (x) options operator, arrow; sum((-1)^n*(n^(1/n)-1), n = x .. infinity) end proc

proc (x) options operator, arrow; sum((-1)^n*(n^(1/n)-1), n = x .. infinity) end proc

(1)

What are the quotients  ot the  continued fration of the sum of f(1)+f(2)+f(3)+f(4)+...

Here are the  quotients  of some partial sums.

``

cfrac(evalf(sum(f(x), x = 1 .. 2)), 'quotients')

[0, 2, 1, 1, 1, 21, 10, 4, 1, 4, 8, `...`]

(2)

cfrac(evalf(sum(f(x), x = 1 .. 3)), 'quotients')

[0, 6, 1, 2, 3, 1, 1, 2, 3, 3, 24, `...`]

(3)

cfrac(evalf(sum(f(x), x = 1 .. 4)), 'quotients')

[0, 2, 1, 2, 1, 4, 2, 1, 3, 1, 1, `...`]

(4)

cfrac(evalf(sum(f(x), x = 1 .. 5)), 'quotients')

[0, 5, 1, 99, 1, 1, 1, 6, 1, 3, 1, `...`]

(5)

cfrac(evalf(sum(f(x), x = 1 .. 6)), 'quotients')

[0, 2, 1, 6, 1, 2, 1, 2, 2, 1, 1, `...`]

(6)

cfrac(evalf(sum(f(x), x = 1 .. 7)), 'quotients')

[0, 5, 1, 1, 142, 1, 1, 1, 1, 19, 1, `...`]

(7)

cfrac(evalf(sum(f(x), x = 1 .. 8)), 'quotients')

[0, 2, 1, 47, 1, 1, 1, 1, 27, 4, 1, `...`]

(8)

cfrac(evalf(sum(f(x), x = 1 .. 9)), 'quotients')

[0, 5, 5, 3, 1, 7, 1, 1, 1, 2, 1, `...`]

(9)

cfrac(evalf(sum(f(x), x = 1 .. 100)), 'quotients')

[0, 3, 1, 1, 1, 11, 2, 2, 1, 1, 4, `...`]

(10)

cfrac(evalf(sum(f(x), x = 1 .. 200)), 'quotients')

[0, 3, 1, 2, 1, 1, 1, 11, 3, 4, 6, `...`]

(11)

cfrac(evalf(sum(f(x), x = 1 .. 400)), 'quotients')

[0, 3, 1, 3, 3, 3, 1, 18, 1, 2, 1, `...`]

(12)

cfrac(evalf(sum(f(x), x = 1 .. 800)), 'quotients')

[0, 3, 1, 3, 1, 4, 16, 14, 3, 23, 2, `...`]

(13)

cfrac(evalf(sum(f(x), x = 1 .. 1600)), 'quotients')

[0, 3, 1, 4, 7, 4, 436, 1, 1, 1, 2, `...`]

(14)

``

Here are the quotients of the  continued fration  of the sum. 

cfrac(evalf(sum(f(x), x = 1 .. infinity)), 'quotients')

[0, 3, 1, 4, 1, 1, 1, 1, 1, 9, 1, `...`]

(15)

With the exception of the leading 0, that is close to the integer squence of pi.

``evalf((65241/65251)*Pi)

3.141111191

(16)

The exponents of 2 that sum the numerator and denominator, in the following way, of that multiple of pi give rise to the integer sequences {0,1,2,3,8,16},numbers such that floor[a(n)^2 / 7] is a square, and {0,2,3,4,8,16},{0,3} union powers of 2.

evalf((2^16-2^8-2^5-2^2-2-2^0)*Pi/(2^16-2^8-2^4-2^3-2^2-2^0))

3.141111191

(17)

We can do the same thing for the first 20 quotients giving rise to the integer sequences {0,1,2,5,6,8,10,13,17,19,22,23,24,28,31} and {0,4,6,9,12, 14,15,16,18,22, 23,24,28,31}. What can be said of these sequences?

cfrac(evalf(sum(f(x), x = 1 .. infinity), 20), 20, 'quotients')``

[0, 3, 1, 4, 1, 1, 1, 1, 1, 9, 1, 3, 1, 2, 1, 1, 1, 5, 1, 3, 11, `...`]

(18)

evalf((1849023129/1849306543)*Pi, 20)

3.1411111913121115131

(19)

````

evalf((2^31-2^28-2^24-2^23-2^22-2^19-2^17-2^13-2^10-2^8-2^6-2^5-2^2-2-2^0)*Pi/(2^31-2^28-2^24-2^23-2^22-2^18-2^16-2^15-2^14-2^12-2^9-2^6-2^4-2^0), 20)

3.1411111913121115131

(20)

``


 

Page 1 of 1