Message Boards Message Boards

0
|
2647 Views
|
6 Replies
|
3 Total Likes
View groups...
Share
Share this post:

[?] List of elements of a complex sequence

Posted 4 years ago

Hi all, I am new to Mathematica but was wondering if it is possible to list complex (a+ib) elements of a sequence as a function of an element. For instance if I define a sequence recursively as x(k+1) = (1-i) x(k), can Mathematica display as output x(1)=(1-i) x(0); x(2)=(-2i) x(0); x(3)= -2(1+i) x(0); x(4)=-4 x(0); etc. ? If it is possible, how ? What would be the best way to plot the result ? Thanks !

POSTED BY: Al Gorgeous
6 Replies
Posted 4 years ago

Thank you.

POSTED BY: Al Gorgeous

Without having acces to such cool functions like ComplexListPlot one could do it in an old fashioned manner oneself

t1 = Table[fx[j, 1], {j, 1, 15}];
t2 = If[Head[#] === Integer, {#, 0}, List[Re[#], Im[#]]] & /@ t1
ListLinePlot[t2]
POSTED BY: Hans Dolhaine

OK

The RSolve given above yields as answer

{{x[k] -> (1 - I)^k x0}}

Now define a Function fx

fx[k_, x0_] := FullSimplify[(1 - I)^k x0]

Look what happens to

fx[5, 2 + 3 I]

or

Table[fx[j, x0], {j, 1, 10}]

For a plot you must specify x0. Let us chose x0 = 1

tt = Table[{j, fx[j, 1]}, {j, 1, 15}];
pl1 = ListLinePlot[Re[#[[2]]] & /@ tt,PlotStyle->Red]  (*real parts*)
pl2 = ListLinePlot[Im[#[[2]]] & /@ tt,PlotStyle->Blue]

Look at both plots in one

Show[pl1, pl2]
POSTED BY: Hans Dolhaine
Posted 4 years ago

Hi Al,

You can use ComplexListPlot.

values = RecurrenceTable[{x[n + 1] == (1 - I) x[n], x[0] == x0}, x, {n, 1, 12}] /. x0 -> 1
ComplexListPlot[Callout[#, #] & /@ values,
 PlotRange -> All,
 Joined -> True,
 ImageSize -> 500]

enter image description here

POSTED BY: Rohit Namjoshi
Posted 4 years ago

Thank you very much for your answer.

However I was more looking for the following one (your answer did help a little bit...):

RecurrenceTable[{x[n + 1] == (1 - I) x[n], x[0] == 1}, x, {n, 1, 12}]

or

RecurrenceTable[{x[n + 1] == (1 - I) x[n], x[0] == x0}, x, {n, 1, 12}]

Now I have to figure out how I can plot those points in the (Re, Im) plane...

:)

POSTED BY: Al Gorgeous
sol=RSolve[{x[k] == (1 - I) x[-1 + k], x[0] == x0}, x[k], k]
POSTED BY: Hans Dolhaine
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract