## 25 Reputation

5 years, 255 days

## Orbit data...

Hi,

I rewrite the function S as below. w and z are the initial conditions x[0]=5,y[0]=6 and choose N=8.The output gives me [2,5] as calculated above. But I do not know how to obtain the the orbit of S in loop. I want to get the output such as

[[5,6],[2,5],[0,6],[7,7],...,Nit] Nit is the Number of iteration. My loop code doesn't work. Thank you.

## verification...

Thank you for your reply. I apologize for the mssing information.  The map is not staraight forward. If I choose x[0]=5,y[0]=6, and N=8, so the calculation is like this:

The value of x[0] depends on e(x[t]). So here e(x[t]) is a picewise function that takes the value of +1 or -1 defined by
{e(x[t])=1 if 0 <=x< floor(N/2) } AND {e(x[t])=-1 if floor (N/2) <=x<N}.

So if N=8 and x[0]=5, then e(x[0])=-1 (since x[0] =5 lies between floor(4) <= x[0]<8). Then, I substitutes the value of e(x[0]) in y[1], that is,

y[1] congruent to y[0]+e(x[0]) mod 8=6-1 mod 8=5 AND
x[1] congruent to x[0]+y[1] mod 8=5+5 mod 8=2. Thus the output for the first iteration is [x[1],y[1]]=[2,5].

I want to produce the list of the output so that I can plot all these points later. The maple code is wrong but I cannot see it. Thank you for your help!

## loop boolean...

@Carl Love

It is perfect! I can run my procedure now. Many thanks to you!
I thought that I have to use the array instead of assigned.
I use 2*N because in the orbit, there are integers that goes away from N and comes back. When I put it between 2*N the procedure works!

Thank you for correcting me with the Orbit procedure. It looks more simpler and more easy. And I will take note about the Array.
Reallly apprecite it! Thank you very much! =)

## loop boolean...

@Carl Love

Hi, really thank you for your help and I am very sorry for the late reply. I was not able to access my computer for a while.

Again, I am sorry for not explaining it very clearly (still have difficulties to explain using proper mathematics).

MinPts=the minimum points in the orbit of F. We can check the orbit by the code for Orbit of F and Finv:

say for (a,b)=(8,1) and I start with initial condition(ic)=0, then I would have

> Orbit(F, 0, 20);
[0, 4, 12, 24, 36, 48, 64, 80, 100, 120, 144, 168, 196, 224, 256, 288, 324, 360, 400, 440, 484]

> Orbit(Finv, 0, 20);
[0, 6, 2, 20, 12, 42, 30, 72, 56, 110, 90, 156, 132, 210, 182, 272, 240, 342, 306, 420, 380]

Then I can check for other ic=1,3,10,14,27,33 (but not 2 because 2 is already from the orbit Finv and also applied for the rest)

From the above output, in my program I want to extrat only the integers that is between the choosen N which is MEC(N) from both F and Finv.

Let say I want to choose N=50

So, the loop starts with ic=0 and iterate once and assigned as MinPts[0]:=true.
Next, I want the first iteration of F which is F(0)=4 and assigned as Escape[4]:=true and Finv(0)=6 as Capture[6]:=true.This means, in the loop for the first iteration, the assigned integers are

MinPts:=[0,?,?,?,...], Escape:=[4,?,?,?,...] and Capture:=[6,?,?,?,...]

Then, into the loop again with ic=1, so I have MinPts[1]:=true, F(1)=5 as Escape[5]:=true and Finv(1)=19 as Capture[19]:=true.

To check, we use Orbit procedure and we have
> Orbit(F, 1, 20);
[1, 5, 13, 21, 3, 11, 23, 35, 47, 63, 79, 99, 119, 143, 167, 195, 223, 255,  287, 323, 359]
> Orbit(Finv, 1, 20);
[1, 19, 11, 41, 29, 71, 55, 109, 89, 155, 131, 209, 181, 271, 239, 341, 305, 419, 379, 505, 461]

So, MinPts now becomes MinPts:=[0,1,?,?,?,...], Escape:=[4,5,?,?,?,...] and Capture:=[6,?,?,?,19,?,...].
The loop is ongoing until it reaches N and all the integers are assigned once.

MEC(N) is the code that iterate the function F and Finv but we di not know how many times the iteration until it reaches N.

So I use array in my previous code for MinPts:=array (0..N), Escape:=array(0..2N),Capture:=array(0..2N) and IsEmpty:=array(0..2N).

The code the you gave me is true but only for (a,b)=(4,1) which I did not explain to you properly.

Thank you for your help. This is my weakness( to explain mathematically). I really appreciate the time and help that you commit in helping me. I hope this helps.

[]

## loop boolean...

@Carl Love
Thank you for your help and sorry for not defining them properly.

My function F is invertible and there will be no intersection, I think. I am trying to write a loop.
For example I choose a range from 0 to N, then start with ic=0 (initial condition), if IsEmpty is true (there is no other integer assigned to 0) then I call it as MinPts (Minimum points).
I am into the loop, for z=0, and iterate once F(0)=4 (for example), gives meEscape=true and Finv(0)=2 gives me Capture=true. Then, z becomes z=1 and do the same thing untill all the integer between 0 to 2*N are assigned once.

I am hoping to get the output as

MinPts=[0,1,3,6] Escape=[4,5,11,12] Capture=[2,7,8,9].

The code for F and quite complicated and they are

code for F (contains 3 procedures)

> Fp := proc (x) local Up, up; global a, b; Up := simplify((1/2)*(2*b-a+sqrt((2*b-a)^2+8*a*x))/a); if type(Up, integer) then up := Up+1 else up := ceil(Up) end if; return x+2*up*b-a*up^2 end proc;
> Fm := proc (x) local Um, um; global a, b; Um := simplify((1/2)*(-2*b-a+sqrt((2*b+a)^2-8*a*x))/a); um := ceil(Um); return x+2*um*b+a*um^2 end proc;
> F := proc (x) global Fp, Fm; Fm(Fp(x)); return % end proc;

code for Finv (also contains 3 procedures)

> Fpinv := proc (x) local Up, up; global a, b; Up := simplify((1/2)*(a-2*b+sqrt((-2*b+a)^2+8*a*x))/a); if type(Up, integer) then up := Up+1 else up := ceil(Up) end if; return x+2*up*(a-b)-a*up^2 end proc;
> Fminv := proc (x) local Um, um; global a, b; Um := simplify((1/2)*(-3*a+2*b+sqrt((3*a-2*b)^2-8*a*x))/a); um := ceil(Um); return x+2*um*(a-b)+a*um^2 end proc;
> Finv := proc (x) global Fpinv, Fminv; Fminv(Fpinv(x)); return % end proc;

the value of a and b is in our choice. in my case, I choose a=4 and b=1 to get the desired output.

Thank you for your help! Really aprreciate it.

## @Kitonum  Thank you! that really wo...

Thank you! that really works for all of them.

But what can I change in the procedure if the input, x are the list of sequence which the answer also give me in the sequence form.

Example: E:=[0,2,7,15,26,40]
I want to put the input x:=[3,10,24] that will give me the answer C(x,E)=[3,4,5]?

Can it be done or it only accept positive integer?

Really appreciate it! Thank you

## @Carl Love  Thank you! that really ...

Thank you! that really works for all of them.

But what can I change in the procedure if the input, x are the list of sequence which the answer also give me in the sequence form.

Example: E:=[0,2,7,15,26,40]
I want to put the input x:=[3,10,24] that will give me the answer C(x,E)=[3,4,5]?

Can it be done or it only accept positive integer?

Really appreciate it! Thank you

## How to get the location if the input is ...

Yes I am looking for the list of sequence but also gives me the location of the input if x<=E[i].

again if I have the sequence E:=[0,2,7,15,26,40],

when I put the value x:=3, which is the value of 3 is between the E[2]=2 and E[3]=7, so I want the answer give me the third element which is 3. The answer should be 3 when I put the value of the input x:=3,4,5,6,7 (because 3 is more than 2 and less than 7) and 7 is the third element in E.

I have difficulties to get the expression.

## @Preben Alsholm Thank you very much...

Thank you very much for the help! I got the desired output.

I used for t from 1 to Nit while (z<>ic)  or t=1 do etc.

Thank you again. Very much apprciated.

## How to make it stops after certain itera...

Thank you for the help! really appreciate it. sorry for the text. My proc would be:

Orbit:=proc(Map,ic,Nit)
local orbit,z,t:
orbit:=array(0..N):
z:=ic:
orbit[0]:=z:
for t to Nit while (z<>ic) do
z:=Map(z);
orbit[t]:=z;
od:
return [seq(orbit[t],t=0..N)];
end;

I;ve tried to put an extra z:=Map(z) before the loop, and it worked! But how to make it stops automatically when the iteration reaches z:=ic?

## How to make it stops after certain itera...

Thank you for the help! really appreciate it. sorry for the text. My proc would be:

Orbit:=proc(Map,ic,Nit)
local orbit,z,t:
orbit:=array(0..N):
z:=ic:
orbit[0]:=z:
for t to Nit while (z<>ic) do
z:=Map(z);
orbit[t]:=z;
od:
return [seq(orbit[t],t=0..N)];
end;

I;ve tried to put an extra z:=Map(z) before the loop, and it worked! But how to make it stops automatically when the iteration reaches z:=ic?

 Page 1 of 1
﻿