how would i use while, when xi = (xi?1 + 1/xi?1), x0 = 1, until
|xi ? xi?1| ? (i = 1, 2, …, n, n = 10, = 10?3
)
to find values of xi
Is this a Mathematica question? If so, what have you tried? As posted it is very hard even to figure out what is meant as a subscript. It is also not clear what the consecutive difference is supposed to be (eventually?) less than.
With most languages, you would use While. You can do that in Mathematica too.
Let’s take a simple example first. Let’s find the values of x(i) = x(i-1) +1 with x(0) = 0 while x(i) <10
You’ll need an empty list that you can append values to as you find them. I’ve called that list “acc” below. Consider this example:
acc = {};
i = 0;
While[i < 10, AppendTo[acc, i]; i = i + 1]
acc is short for accumulator. It now holds the list: {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
Try modifying the code above to do your iteration.
Mathematica has much better ways of doing computations like this, but it’s good to learn how to solve problems like this while learning how to program.