Results 1 to 4 of 4

Math Help - Mathematica and Sequences

  1. #1
    Senior Member bkarpuz's Avatar
    Joined
    Sep 2008
    From
    R
    Posts
    481
    Thanks
    2

    Mathematica and Sequences

    I have the following code, but I dont know why I could not make it work :S
    Please help.
    Code:
    x = Table[1, {i, 1, 15}];
    For[i = 3, i < 15, i++,
     x[i + 1] = 16/9*x[i] - 2/3*x[i - 1] - 1/3*x[i - 2]
     ]
    Graphics[Point[Table[{i, x[i]}, {i, 1, 15}]]]
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Super Member
    Joined
    Aug 2008
    Posts
    903
    Need double brackets in an array : x[[i]]. The syntax x[i] is interpreted as the function x at the value i.
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Senior Member bkarpuz's Avatar
    Joined
    Sep 2008
    From
    R
    Posts
    481
    Thanks
    2
    Quote Originally Posted by shawsend View Post
    Need double brackets in an array : x[[i]]. The syntax x[i] is interpreted as the function x at the value i.
    Yes, I was just about to answer it

    Code:
    s = 12;
    x = Table[1, {i, 1, s}];
    For[i = 3, i <= s - 1, i++,
     x[[i + 1]] = 16/9*x[[i]] - 2/3*x[[i - 1]] - 1/3*x[[i - 2]];
     ]
    Graphics[Point[Table[{i, x[[i]]}, {i, 1, s, 1}]]]
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Senior Member bkarpuz's Avatar
    Joined
    Sep 2008
    From
    R
    Posts
    481
    Thanks
    2
    I again have problems about scaling the graphic :S

    Code:
    s = 50;
    x = Table[1, {i, 1, s}];
    xmin := 1;
    xmax := 1;
    For[i = 3, i <= s - 1, i++,
     c = 16/9*x[[i]] - 2/3*x[[i - 1]] - 1/3*x[[i - 2]];
     x[[i + 1]] := c;
     xmin = If[c < xmin, c, xmin];
       xmax = If[c > xmax, c, xmax];
     ]
    Graphics[Point[Table[{i, x[[i]]}, {i, 1, s, 1}]], Axes -> True]
    I found out that the following code is more useful:
    Code:
    s = 50;
    x = Table[1, {i, 1, s}];
    For[i = 3, i <= s - 1, i++, x[[i + 1]] = 16/9*x[[i]] - 2/3*x[[i - 1]] - 1/3*x[[i - 2]] ]
    ListPlot[Table[{i, x[[i]]}, {i, 1, s}]]
    Last edited by bkarpuz; September 26th 2008 at 06:06 AM. Reason: New codes are added.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Convergence in sequences of sequences
    Posted in the Differential Geometry Forum
    Replies: 4
    Last Post: October 19th 2010, 08:28 AM
  2. Sequences and the sequences' arithmetics
    Posted in the Differential Geometry Forum
    Replies: 1
    Last Post: October 6th 2010, 10:31 PM
  3. help me in Mathematica
    Posted in the Math Software Forum
    Replies: 2
    Last Post: May 18th 2010, 02:26 AM
  4. Monotone sequences and Cauchy sequences
    Posted in the Differential Geometry Forum
    Replies: 3
    Last Post: March 21st 2009, 09:59 PM
  5. Replies: 5
    Last Post: January 16th 2008, 05:51 PM

Search Tags


/mathhelpforum @mathhelpforum