0
$\begingroup$

I don't understand why, but, with this code, I can't get a graph. Nothing is happening in output. And I have no errors.. Here is the code:

ListPlot[RecurrenceTable[{a[n + 1] == (a[n] + b[n])/2, 
   b[n + 1] == (2 / (1 / a[n] + 1/b[n])), a[0] == 4, b[0] == 3}, {a, 
   b}, {n, 0, 30}],
 PlotRange -> {0, 100},
 ImageSize -> 400,
 AxesLabel -> {"n", "anbn"},
 PlotLabel -> "Premiers Termes :-) "
 ]

Do you know what is the problem?

Thanks for your time!!!

Edit: Now, changing a[0], b[0] and n, I have this:

enter image description here

New edit:

enter image description here

$\endgroup$
  • $\begingroup$ Exact calculations are too time consumption in this case. Is using a[0] == 4.0 and b[0] == 3.0 an option for you? I think you will have to do this numerically. $\endgroup$ – Gustavo Delfino Feb 23 '18 at 16:08
  • $\begingroup$ What do you mean? Its not an obligation to put a[0] and b[0] with these values. But, It must be superior to 0 for both, thats all .. Have you got any suggestions? $\endgroup$ – nolw38 Feb 23 '18 at 16:32
  • 1
    $\begingroup$ When you replace the 4 with 4.0 and the 3 with 3.0 you trigger numerical evaluation which is much faster. To see this, evaluate your RecurrenceTable (remove the plot stuff) replacing the 30 with much smaller values and increment them gradually. You will see some huge fractions that take increasingly more time to calculate. $\endgroup$ – Gustavo Delfino Feb 23 '18 at 16:37
  • $\begingroup$ Why is there only two points and not a wide range of points? is it not supposed to be points for a[0] a[1] ....... a[10] and same for b ? I put a new edit with your advices. $\endgroup$ – nolw38 Feb 23 '18 at 16:39
  • $\begingroup$ I dont understand why n dont have values higher than 3.55 $\endgroup$ – nolw38 Feb 23 '18 at 16:45
1
$\begingroup$
        I think you can see the dependence of a[0]=s, b[0]=q given below plot.

         Manipulate[
          ListLinePlot[
         RecurrenceTable[{a[n + 1] == (a[n] + b[n])/2, 
       b[n + 1] == (2/((1/a[n]) + (1/b[n]))), a[0] == s, b[0] == q}, {a, 
      b}, {n, 0, 20, 1}], PlotRange -> All, ImageSize -> 400, 
     PerformanceGoal -> "Speed", Frame -> True, 
         PlotMarkers -> {Automatic, 16}, PlotStyle -> Blue], {s, 1, 
      30}, {q, .001, 1}]

plot of data

$\endgroup$
  • $\begingroup$ Thanks !!! But we don't see b values, right? $\endgroup$ – nolw38 Feb 23 '18 at 17:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.