fairuzalwani

25 Reputation

2 Badges

5 years, 275 days

MaplePrimes Activity


These are questions asked by fairuzalwani

I have question about how to write the expression to get the order in the sequence?

For exmple, if I have this sequence,

E:=[0,2,7,15,26,40]

I want to write a procedure that tells me the location of any input,x in the sequence E.

For example, if I choose x:=3, then the number 3 is actually between 2 and 7, so it will give me the answer C(x)=3 (because 7 is the third elemet).

I try to write the procedure but there always wrong! I do not know what expression should I write!

C:=proc(x)
local
for i from 1 to nops(E) do
if x<=E[i] then
c:=E[i]
fi;od;
end;

Please help! 

Hi! PLEASE HELP ME.. I try to give a new name in my proc where it stops at the initial condition, ic. Somehow it gave me an output like

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

>Orbit (F,[1,0],20);
##

##I want to eliminate the orbit13 and so on. I tried to give a new name where for example per:=array(0..t). I want it stops at t and do not go until Nit. Can you help me?

@fairuzalwani 

Hi! I have difficulties in plotting my proc. I have this proc,

> 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) or t=1 do
z:=Map(z);
orbit[t]:=z;
od:
return [seq(orbit[t],t=1..N)];
end;

##If I run it, let say

>Orbit(F, [1, 1], 15);

##the output would be something like this:

[[1, 1], [3, 0], [-1, -1], [1, 0], [-3, -1], [-1, 0], [7, 1], [9, 0], [5, -1], [-5, -2], [-9, -1], [-7, 0], orbit[13], orbit[14], orbit[15]] 

##since it already found the periodic point. But, I need to include my initial condition z:=ic to be able to plot the graph but I do not have idea on how to do it. Please help. Should I make changes in my proc or in my plot structure?

Thank you in advance!

here is my maple procedure. I have to make the iteration works until I have met the initial condition it will stop. the initial conditions here is z:=ic.


1 2 Page 2 of 2