Correctly defining the return of a procedure Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?Why should I avoid the For loop in Mathematica?Defining a string based sort functionDefining functions in a loopReturn value of Reap when using tagsHow to define even permutations correctly?How to exclude some indices in defining Table?How to make a repetive procedure with LinearModelFitTable with List iterator return unpacked listreverse procedure of KroneckerProductDefine the substitution procedure as a functionRebuild a vector defining the sign of the elements

Did the new image of black hole confirm the general theory of relativity?

Why does this iterative way of solving of equation work?

Do we know why communications with Beresheet and NASA were lost during the attempted landing of the Moon lander?

Complexity of many constant time steps with occasional logarithmic steps

Replacing HDD with SSD; what about non-APFS/APFS?

Two different pronunciation of "понял"

How does modal jazz use chord progressions?

What is the electric potential inside a point charge?

How to market an anarchic city as a tourism spot to people living in civilized areas?

Writing Thesis: Copying from published papers

Are my PIs rude or am I just being too sensitive?

Windows 10: How to Lock (not sleep) laptop on lid close?

When is phishing education going too far?

Autumning in love

How to politely respond to generic emails requesting a PhD/job in my lab? Without wasting too much time

What did Darwin mean by 'squib' here?

What are the performance impacts of 'functional' Rust?

Stars Make Stars

How to say that you spent the night with someone, you were only sleeping and nothing else?

Is there folklore associating late breastfeeding with low intelligence and/or gullibility?

Area of a 2D convex hull

Is above average number of years spent on PhD considered a red flag in future academia or industry positions?

Estimate capacitor parameters

Should you tell Jews they are breaking a commandment?



Correctly defining the return of a procedure



Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?Why should I avoid the For loop in Mathematica?Defining a string based sort functionDefining functions in a loopReturn value of Reap when using tagsHow to define even permutations correctly?How to exclude some indices in defining Table?How to make a repetive procedure with LinearModelFitTable with List iterator return unpacked listreverse procedure of KroneckerProductDefine the substitution procedure as a functionRebuild a vector defining the sign of the elements










3












$begingroup$


I am sort of new to mathematica and I am struggling with how to correctly set the return of a specific function which is a procedure.



I am give the following task:
Given the map $x_n+1 = r x_n (1-x_n)$:



1- set $x_0 = 0.5$



2- write a function $f(r)$ which evaluates the first 1000 terms fo the sequence, takes the last 100 and then selects distinct elements.



This is what I came up with so far



x[0] = 0.5
f[r_]:=
l = Table[0,1000]; (*init table of 1000 elems*)
l[[1]] = x[0]; (*set x_0*)
For[n=1,n<1000,n++,

x[n] = r * x[n-1] *(1-x[n-1]); (*evaluate x_n*)
l[[n+1]] = x[n]; (*set nth elem of list*)

];
l= Union[Take[l, -100]] (*modify list*)
Return[l] (*return list*)



but this does not work at all. thanks tho everyone who is keen to partecipate and give some suggestion :)










share|improve this question







New contributor




JacquesLeen is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$endgroup$







  • 1




    $begingroup$
    Curly braces are for lists, not for code blocks. Use Module, Block, or With for code blocks. And try not to use For.
    $endgroup$
    – Roman
    Apr 8 at 10:45






  • 3




    $begingroup$
    Why should I avoid the For loop in Mathematica?
    $endgroup$
    – corey979
    Apr 8 at 11:34






  • 1




    $begingroup$
    Return doesn't do what you think it does. Don't use it until you understand it. Once you understand it, you'll probably never use it.
    $endgroup$
    – John Doty
    Apr 8 at 13:17










  • $begingroup$
    You might also look into Nest and NestList as an alternative, built-in way to iterate this map.
    $endgroup$
    – Chris K
    Apr 8 at 13:20










  • $begingroup$
    Don't just guess at the syntax, read a tutorial. Plenty can be found with a simple websearch.
    $endgroup$
    – Szabolcs
    2 days ago















3












$begingroup$


I am sort of new to mathematica and I am struggling with how to correctly set the return of a specific function which is a procedure.



I am give the following task:
Given the map $x_n+1 = r x_n (1-x_n)$:



1- set $x_0 = 0.5$



2- write a function $f(r)$ which evaluates the first 1000 terms fo the sequence, takes the last 100 and then selects distinct elements.



This is what I came up with so far



x[0] = 0.5
f[r_]:=
l = Table[0,1000]; (*init table of 1000 elems*)
l[[1]] = x[0]; (*set x_0*)
For[n=1,n<1000,n++,

x[n] = r * x[n-1] *(1-x[n-1]); (*evaluate x_n*)
l[[n+1]] = x[n]; (*set nth elem of list*)

];
l= Union[Take[l, -100]] (*modify list*)
Return[l] (*return list*)



but this does not work at all. thanks tho everyone who is keen to partecipate and give some suggestion :)










share|improve this question







New contributor




JacquesLeen is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$endgroup$







  • 1




    $begingroup$
    Curly braces are for lists, not for code blocks. Use Module, Block, or With for code blocks. And try not to use For.
    $endgroup$
    – Roman
    Apr 8 at 10:45






  • 3




    $begingroup$
    Why should I avoid the For loop in Mathematica?
    $endgroup$
    – corey979
    Apr 8 at 11:34






  • 1




    $begingroup$
    Return doesn't do what you think it does. Don't use it until you understand it. Once you understand it, you'll probably never use it.
    $endgroup$
    – John Doty
    Apr 8 at 13:17










  • $begingroup$
    You might also look into Nest and NestList as an alternative, built-in way to iterate this map.
    $endgroup$
    – Chris K
    Apr 8 at 13:20










  • $begingroup$
    Don't just guess at the syntax, read a tutorial. Plenty can be found with a simple websearch.
    $endgroup$
    – Szabolcs
    2 days ago













3












3








3


0



$begingroup$


I am sort of new to mathematica and I am struggling with how to correctly set the return of a specific function which is a procedure.



I am give the following task:
Given the map $x_n+1 = r x_n (1-x_n)$:



1- set $x_0 = 0.5$



2- write a function $f(r)$ which evaluates the first 1000 terms fo the sequence, takes the last 100 and then selects distinct elements.



This is what I came up with so far



x[0] = 0.5
f[r_]:=
l = Table[0,1000]; (*init table of 1000 elems*)
l[[1]] = x[0]; (*set x_0*)
For[n=1,n<1000,n++,

x[n] = r * x[n-1] *(1-x[n-1]); (*evaluate x_n*)
l[[n+1]] = x[n]; (*set nth elem of list*)

];
l= Union[Take[l, -100]] (*modify list*)
Return[l] (*return list*)



but this does not work at all. thanks tho everyone who is keen to partecipate and give some suggestion :)










share|improve this question







New contributor




JacquesLeen is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$endgroup$




I am sort of new to mathematica and I am struggling with how to correctly set the return of a specific function which is a procedure.



I am give the following task:
Given the map $x_n+1 = r x_n (1-x_n)$:



1- set $x_0 = 0.5$



2- write a function $f(r)$ which evaluates the first 1000 terms fo the sequence, takes the last 100 and then selects distinct elements.



This is what I came up with so far



x[0] = 0.5
f[r_]:=
l = Table[0,1000]; (*init table of 1000 elems*)
l[[1]] = x[0]; (*set x_0*)
For[n=1,n<1000,n++,

x[n] = r * x[n-1] *(1-x[n-1]); (*evaluate x_n*)
l[[n+1]] = x[n]; (*set nth elem of list*)

];
l= Union[Take[l, -100]] (*modify list*)
Return[l] (*return list*)



but this does not work at all. thanks tho everyone who is keen to partecipate and give some suggestion :)







list-manipulation






share|improve this question







New contributor




JacquesLeen is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




JacquesLeen is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




JacquesLeen is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Apr 8 at 9:54









JacquesLeenJacquesLeen

304




304




New contributor




JacquesLeen is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





JacquesLeen is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






JacquesLeen is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







  • 1




    $begingroup$
    Curly braces are for lists, not for code blocks. Use Module, Block, or With for code blocks. And try not to use For.
    $endgroup$
    – Roman
    Apr 8 at 10:45






  • 3




    $begingroup$
    Why should I avoid the For loop in Mathematica?
    $endgroup$
    – corey979
    Apr 8 at 11:34






  • 1




    $begingroup$
    Return doesn't do what you think it does. Don't use it until you understand it. Once you understand it, you'll probably never use it.
    $endgroup$
    – John Doty
    Apr 8 at 13:17










  • $begingroup$
    You might also look into Nest and NestList as an alternative, built-in way to iterate this map.
    $endgroup$
    – Chris K
    Apr 8 at 13:20










  • $begingroup$
    Don't just guess at the syntax, read a tutorial. Plenty can be found with a simple websearch.
    $endgroup$
    – Szabolcs
    2 days ago












  • 1




    $begingroup$
    Curly braces are for lists, not for code blocks. Use Module, Block, or With for code blocks. And try not to use For.
    $endgroup$
    – Roman
    Apr 8 at 10:45






  • 3




    $begingroup$
    Why should I avoid the For loop in Mathematica?
    $endgroup$
    – corey979
    Apr 8 at 11:34






  • 1




    $begingroup$
    Return doesn't do what you think it does. Don't use it until you understand it. Once you understand it, you'll probably never use it.
    $endgroup$
    – John Doty
    Apr 8 at 13:17










  • $begingroup$
    You might also look into Nest and NestList as an alternative, built-in way to iterate this map.
    $endgroup$
    – Chris K
    Apr 8 at 13:20










  • $begingroup$
    Don't just guess at the syntax, read a tutorial. Plenty can be found with a simple websearch.
    $endgroup$
    – Szabolcs
    2 days ago







1




1




$begingroup$
Curly braces are for lists, not for code blocks. Use Module, Block, or With for code blocks. And try not to use For.
$endgroup$
– Roman
Apr 8 at 10:45




$begingroup$
Curly braces are for lists, not for code blocks. Use Module, Block, or With for code blocks. And try not to use For.
$endgroup$
– Roman
Apr 8 at 10:45




3




3




$begingroup$
Why should I avoid the For loop in Mathematica?
$endgroup$
– corey979
Apr 8 at 11:34




$begingroup$
Why should I avoid the For loop in Mathematica?
$endgroup$
– corey979
Apr 8 at 11:34




1




1




$begingroup$
Return doesn't do what you think it does. Don't use it until you understand it. Once you understand it, you'll probably never use it.
$endgroup$
– John Doty
Apr 8 at 13:17




$begingroup$
Return doesn't do what you think it does. Don't use it until you understand it. Once you understand it, you'll probably never use it.
$endgroup$
– John Doty
Apr 8 at 13:17












$begingroup$
You might also look into Nest and NestList as an alternative, built-in way to iterate this map.
$endgroup$
– Chris K
Apr 8 at 13:20




$begingroup$
You might also look into Nest and NestList as an alternative, built-in way to iterate this map.
$endgroup$
– Chris K
Apr 8 at 13:20












$begingroup$
Don't just guess at the syntax, read a tutorial. Plenty can be found with a simple websearch.
$endgroup$
– Szabolcs
2 days ago




$begingroup$
Don't just guess at the syntax, read a tutorial. Plenty can be found with a simple websearch.
$endgroup$
– Szabolcs
2 days ago










2 Answers
2






active

oldest

votes


















6












$begingroup$

Try this:



f[r_] := Union[
Take[
RecurrenceTable[
a[n + 1] == r*(1 - a[n])*a[n], a[1] == .5,
a, n, 1, 1000
],
-100]
]





share|improve this answer











$endgroup$








  • 2




    $begingroup$
    Or, a little more efficiently, f[r_] := Union[ RecurrenceTable[a[n + 1] == r*(1 - a[n])*a[n], a[1] == 0.5, a, n, 901, 1000]]
    $endgroup$
    – Bob Hanlon
    Apr 8 at 13:50


















3












$begingroup$

For a specific value of $r$ you can do



With[r = 3.7,
NestList[r*#*(1-#) &, 0.5, 1000][[-100 ;;]]]



0.783499, 0.627626, 0.864733, 0.432788, 0.908285, 0.308222,
0.788918, 0.616148, 0.875086, 0.404449, 0.891219, 0.358706, 0.851134,
0.468809, 0.9214, 0.26796, 0.725783, 0.736382, 0.718257, 0.748746,
0.696065, 0.782767, 0.629159, 0.863277, 0.436711, 0.910179, 0.302485,
0.780655, 0.63356, 0.858998, 0.448145, 0.915051, 0.287611, 0.758096,
0.67853, 0.80707, 0.576119, 0.903562, 0.32241, 0.808309, 0.573299,
0.905121, 0.317745, 0.802098, 0.587326, 0.896784, 0.34248, 0.833193,
0.514234, 0.92425, 0.259043, 0.710177, 0.761555, 0.67188, 0.815692,
0.556253, 0.913292, 0.293003, 0.766463, 0.662291, 0.827548, 0.528036,
0.922092, 0.265802, 0.722061, 0.74255, 0.707328, 0.765957, 0.663288,
0.826347, 0.530942, 0.921458, 0.267782, 0.725477, 0.736893, 0.717362,
0.750189, 0.6934, 0.786607, 0.621069, 0.870766, 0.41637, 0.899122,
0.335595, 0.824992, 0.534206, 0.920671, 0.270233, 0.729667, 0.729837,
0.729548, 0.730039, 0.729203, 0.730623, 0.728207, 0.732309, 0.72532,
0.737154, 0.716905, 0.750923




I don't think there are any duplicates in this list ($r$ is in the chaotic region). For other values of $r$ there are indeed duplicates:



With[r = 3.5,
NestList[r*#*(1 - #) &, 0.5, 1000][[-100 ;;]]] // DeleteDuplicates // Sort



0.38282, 0.500884, 0.826941, 0.874997




// Union does the same thing as // DeleteDuplicates // Sort if you prefer.






share|improve this answer











$endgroup$













    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "387"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );






    JacquesLeen is a new contributor. Be nice, and check out our Code of Conduct.









    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f194802%2fcorrectly-defining-the-return-of-a-procedure%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    6












    $begingroup$

    Try this:



    f[r_] := Union[
    Take[
    RecurrenceTable[
    a[n + 1] == r*(1 - a[n])*a[n], a[1] == .5,
    a, n, 1, 1000
    ],
    -100]
    ]





    share|improve this answer











    $endgroup$








    • 2




      $begingroup$
      Or, a little more efficiently, f[r_] := Union[ RecurrenceTable[a[n + 1] == r*(1 - a[n])*a[n], a[1] == 0.5, a, n, 901, 1000]]
      $endgroup$
      – Bob Hanlon
      Apr 8 at 13:50















    6












    $begingroup$

    Try this:



    f[r_] := Union[
    Take[
    RecurrenceTable[
    a[n + 1] == r*(1 - a[n])*a[n], a[1] == .5,
    a, n, 1, 1000
    ],
    -100]
    ]





    share|improve this answer











    $endgroup$








    • 2




      $begingroup$
      Or, a little more efficiently, f[r_] := Union[ RecurrenceTable[a[n + 1] == r*(1 - a[n])*a[n], a[1] == 0.5, a, n, 901, 1000]]
      $endgroup$
      – Bob Hanlon
      Apr 8 at 13:50













    6












    6








    6





    $begingroup$

    Try this:



    f[r_] := Union[
    Take[
    RecurrenceTable[
    a[n + 1] == r*(1 - a[n])*a[n], a[1] == .5,
    a, n, 1, 1000
    ],
    -100]
    ]





    share|improve this answer











    $endgroup$



    Try this:



    f[r_] := Union[
    Take[
    RecurrenceTable[
    a[n + 1] == r*(1 - a[n])*a[n], a[1] == .5,
    a, n, 1, 1000
    ],
    -100]
    ]






    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Apr 8 at 13:08









    MarcoB

    38.7k557116




    38.7k557116










    answered Apr 8 at 10:29









    Innerw0lfInnerw0lf

    814




    814







    • 2




      $begingroup$
      Or, a little more efficiently, f[r_] := Union[ RecurrenceTable[a[n + 1] == r*(1 - a[n])*a[n], a[1] == 0.5, a, n, 901, 1000]]
      $endgroup$
      – Bob Hanlon
      Apr 8 at 13:50












    • 2




      $begingroup$
      Or, a little more efficiently, f[r_] := Union[ RecurrenceTable[a[n + 1] == r*(1 - a[n])*a[n], a[1] == 0.5, a, n, 901, 1000]]
      $endgroup$
      – Bob Hanlon
      Apr 8 at 13:50







    2




    2




    $begingroup$
    Or, a little more efficiently, f[r_] := Union[ RecurrenceTable[a[n + 1] == r*(1 - a[n])*a[n], a[1] == 0.5, a, n, 901, 1000]]
    $endgroup$
    – Bob Hanlon
    Apr 8 at 13:50




    $begingroup$
    Or, a little more efficiently, f[r_] := Union[ RecurrenceTable[a[n + 1] == r*(1 - a[n])*a[n], a[1] == 0.5, a, n, 901, 1000]]
    $endgroup$
    – Bob Hanlon
    Apr 8 at 13:50











    3












    $begingroup$

    For a specific value of $r$ you can do



    With[r = 3.7,
    NestList[r*#*(1-#) &, 0.5, 1000][[-100 ;;]]]



    0.783499, 0.627626, 0.864733, 0.432788, 0.908285, 0.308222,
    0.788918, 0.616148, 0.875086, 0.404449, 0.891219, 0.358706, 0.851134,
    0.468809, 0.9214, 0.26796, 0.725783, 0.736382, 0.718257, 0.748746,
    0.696065, 0.782767, 0.629159, 0.863277, 0.436711, 0.910179, 0.302485,
    0.780655, 0.63356, 0.858998, 0.448145, 0.915051, 0.287611, 0.758096,
    0.67853, 0.80707, 0.576119, 0.903562, 0.32241, 0.808309, 0.573299,
    0.905121, 0.317745, 0.802098, 0.587326, 0.896784, 0.34248, 0.833193,
    0.514234, 0.92425, 0.259043, 0.710177, 0.761555, 0.67188, 0.815692,
    0.556253, 0.913292, 0.293003, 0.766463, 0.662291, 0.827548, 0.528036,
    0.922092, 0.265802, 0.722061, 0.74255, 0.707328, 0.765957, 0.663288,
    0.826347, 0.530942, 0.921458, 0.267782, 0.725477, 0.736893, 0.717362,
    0.750189, 0.6934, 0.786607, 0.621069, 0.870766, 0.41637, 0.899122,
    0.335595, 0.824992, 0.534206, 0.920671, 0.270233, 0.729667, 0.729837,
    0.729548, 0.730039, 0.729203, 0.730623, 0.728207, 0.732309, 0.72532,
    0.737154, 0.716905, 0.750923




    I don't think there are any duplicates in this list ($r$ is in the chaotic region). For other values of $r$ there are indeed duplicates:



    With[r = 3.5,
    NestList[r*#*(1 - #) &, 0.5, 1000][[-100 ;;]]] // DeleteDuplicates // Sort



    0.38282, 0.500884, 0.826941, 0.874997




    // Union does the same thing as // DeleteDuplicates // Sort if you prefer.






    share|improve this answer











    $endgroup$

















      3












      $begingroup$

      For a specific value of $r$ you can do



      With[r = 3.7,
      NestList[r*#*(1-#) &, 0.5, 1000][[-100 ;;]]]



      0.783499, 0.627626, 0.864733, 0.432788, 0.908285, 0.308222,
      0.788918, 0.616148, 0.875086, 0.404449, 0.891219, 0.358706, 0.851134,
      0.468809, 0.9214, 0.26796, 0.725783, 0.736382, 0.718257, 0.748746,
      0.696065, 0.782767, 0.629159, 0.863277, 0.436711, 0.910179, 0.302485,
      0.780655, 0.63356, 0.858998, 0.448145, 0.915051, 0.287611, 0.758096,
      0.67853, 0.80707, 0.576119, 0.903562, 0.32241, 0.808309, 0.573299,
      0.905121, 0.317745, 0.802098, 0.587326, 0.896784, 0.34248, 0.833193,
      0.514234, 0.92425, 0.259043, 0.710177, 0.761555, 0.67188, 0.815692,
      0.556253, 0.913292, 0.293003, 0.766463, 0.662291, 0.827548, 0.528036,
      0.922092, 0.265802, 0.722061, 0.74255, 0.707328, 0.765957, 0.663288,
      0.826347, 0.530942, 0.921458, 0.267782, 0.725477, 0.736893, 0.717362,
      0.750189, 0.6934, 0.786607, 0.621069, 0.870766, 0.41637, 0.899122,
      0.335595, 0.824992, 0.534206, 0.920671, 0.270233, 0.729667, 0.729837,
      0.729548, 0.730039, 0.729203, 0.730623, 0.728207, 0.732309, 0.72532,
      0.737154, 0.716905, 0.750923




      I don't think there are any duplicates in this list ($r$ is in the chaotic region). For other values of $r$ there are indeed duplicates:



      With[r = 3.5,
      NestList[r*#*(1 - #) &, 0.5, 1000][[-100 ;;]]] // DeleteDuplicates // Sort



      0.38282, 0.500884, 0.826941, 0.874997




      // Union does the same thing as // DeleteDuplicates // Sort if you prefer.






      share|improve this answer











      $endgroup$















        3












        3








        3





        $begingroup$

        For a specific value of $r$ you can do



        With[r = 3.7,
        NestList[r*#*(1-#) &, 0.5, 1000][[-100 ;;]]]



        0.783499, 0.627626, 0.864733, 0.432788, 0.908285, 0.308222,
        0.788918, 0.616148, 0.875086, 0.404449, 0.891219, 0.358706, 0.851134,
        0.468809, 0.9214, 0.26796, 0.725783, 0.736382, 0.718257, 0.748746,
        0.696065, 0.782767, 0.629159, 0.863277, 0.436711, 0.910179, 0.302485,
        0.780655, 0.63356, 0.858998, 0.448145, 0.915051, 0.287611, 0.758096,
        0.67853, 0.80707, 0.576119, 0.903562, 0.32241, 0.808309, 0.573299,
        0.905121, 0.317745, 0.802098, 0.587326, 0.896784, 0.34248, 0.833193,
        0.514234, 0.92425, 0.259043, 0.710177, 0.761555, 0.67188, 0.815692,
        0.556253, 0.913292, 0.293003, 0.766463, 0.662291, 0.827548, 0.528036,
        0.922092, 0.265802, 0.722061, 0.74255, 0.707328, 0.765957, 0.663288,
        0.826347, 0.530942, 0.921458, 0.267782, 0.725477, 0.736893, 0.717362,
        0.750189, 0.6934, 0.786607, 0.621069, 0.870766, 0.41637, 0.899122,
        0.335595, 0.824992, 0.534206, 0.920671, 0.270233, 0.729667, 0.729837,
        0.729548, 0.730039, 0.729203, 0.730623, 0.728207, 0.732309, 0.72532,
        0.737154, 0.716905, 0.750923




        I don't think there are any duplicates in this list ($r$ is in the chaotic region). For other values of $r$ there are indeed duplicates:



        With[r = 3.5,
        NestList[r*#*(1 - #) &, 0.5, 1000][[-100 ;;]]] // DeleteDuplicates // Sort



        0.38282, 0.500884, 0.826941, 0.874997




        // Union does the same thing as // DeleteDuplicates // Sort if you prefer.






        share|improve this answer











        $endgroup$



        For a specific value of $r$ you can do



        With[r = 3.7,
        NestList[r*#*(1-#) &, 0.5, 1000][[-100 ;;]]]



        0.783499, 0.627626, 0.864733, 0.432788, 0.908285, 0.308222,
        0.788918, 0.616148, 0.875086, 0.404449, 0.891219, 0.358706, 0.851134,
        0.468809, 0.9214, 0.26796, 0.725783, 0.736382, 0.718257, 0.748746,
        0.696065, 0.782767, 0.629159, 0.863277, 0.436711, 0.910179, 0.302485,
        0.780655, 0.63356, 0.858998, 0.448145, 0.915051, 0.287611, 0.758096,
        0.67853, 0.80707, 0.576119, 0.903562, 0.32241, 0.808309, 0.573299,
        0.905121, 0.317745, 0.802098, 0.587326, 0.896784, 0.34248, 0.833193,
        0.514234, 0.92425, 0.259043, 0.710177, 0.761555, 0.67188, 0.815692,
        0.556253, 0.913292, 0.293003, 0.766463, 0.662291, 0.827548, 0.528036,
        0.922092, 0.265802, 0.722061, 0.74255, 0.707328, 0.765957, 0.663288,
        0.826347, 0.530942, 0.921458, 0.267782, 0.725477, 0.736893, 0.717362,
        0.750189, 0.6934, 0.786607, 0.621069, 0.870766, 0.41637, 0.899122,
        0.335595, 0.824992, 0.534206, 0.920671, 0.270233, 0.729667, 0.729837,
        0.729548, 0.730039, 0.729203, 0.730623, 0.728207, 0.732309, 0.72532,
        0.737154, 0.716905, 0.750923




        I don't think there are any duplicates in this list ($r$ is in the chaotic region). For other values of $r$ there are indeed duplicates:



        With[r = 3.5,
        NestList[r*#*(1 - #) &, 0.5, 1000][[-100 ;;]]] // DeleteDuplicates // Sort



        0.38282, 0.500884, 0.826941, 0.874997




        // Union does the same thing as // DeleteDuplicates // Sort if you prefer.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Apr 8 at 15:04

























        answered Apr 8 at 14:01









        RomanRoman

        5,29511131




        5,29511131




















            JacquesLeen is a new contributor. Be nice, and check out our Code of Conduct.









            draft saved

            draft discarded


















            JacquesLeen is a new contributor. Be nice, and check out our Code of Conduct.












            JacquesLeen is a new contributor. Be nice, and check out our Code of Conduct.











            JacquesLeen is a new contributor. Be nice, and check out our Code of Conduct.














            Thanks for contributing an answer to Mathematica Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            Use MathJax to format equations. MathJax reference.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f194802%2fcorrectly-defining-the-return-of-a-procedure%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            រឿង រ៉ូមេអូ និង ហ្ស៊ុយលីយេ សង្ខេបរឿង តួអង្គ បញ្ជីណែនាំ

            Crop image to path created in TikZ? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Crop an inserted image?TikZ pictures does not appear in posterImage behind and beyond crop marks?Tikz picture as large as possible on A4 PageTransparency vs image compression dilemmaHow to crop background from image automatically?Image does not cropTikzexternal capturing crop marks when externalizing pgfplots?How to include image path that contains a dollar signCrop image with left size given

            Romeo and Juliet ContentsCharactersSynopsisSourcesDate and textThemes and motifsCriticism and interpretationLegacyScene by sceneSee alsoNotes and referencesSourcesExternal linksNavigation menu"Consumer Price Index (estimate) 1800–"10.2307/28710160037-3222287101610.1093/res/II.5.31910.2307/45967845967810.2307/2869925286992510.1525/jams.1982.35.3.03a00050"Dada Masilo: South African dancer who breaks the rules"10.1093/res/os-XV.57.1610.2307/28680942868094"Sweet Sorrow: Mann-Korman's Romeo and Juliet Closes Sept. 5 at MN's Ordway"the original10.2307/45957745957710.1017/CCOL0521570476.009"Ram Leela box office collections hit massive Rs 100 crore, pulverises prediction"Archived"Broadway Revival of Romeo and Juliet, Starring Orlando Bloom and Condola Rashad, Will Close Dec. 8"Archived10.1075/jhp.7.1.04hon"Wherefore art thou, Romeo? To make us laugh at Navy Pier"the original10.1093/gmo/9781561592630.article.O006772"Ram-leela Review Roundup: Critics Hail Film as Best Adaptation of Romeo and Juliet"Archived10.2307/31946310047-77293194631"Romeo and Juliet get Twitter treatment""Juliet's Nurse by Lois Leveen""Romeo and Juliet: Orlando Bloom's Broadway Debut Released in Theaters for Valentine's Day"Archived"Romeo and Juliet Has No Balcony"10.1093/gmo/9781561592630.article.O00778110.2307/2867423286742310.1076/enst.82.2.115.959510.1080/00138380601042675"A plague o' both your houses: error in GCSE exam paper forces apology""Juliet of the Five O'Clock Shadow, and Other Wonders"10.2307/33912430027-4321339124310.2307/28487440038-7134284874410.2307/29123140149-661129123144728341M"Weekender Guide: Shakespeare on The Drive""balcony"UK public library membership"romeo"UK public library membership10.1017/CCOL9780521844291"Post-Zionist Critique on Israel and the Palestinians Part III: Popular Culture"10.2307/25379071533-86140377-919X2537907"Capulets and Montagues: UK exam board admit mixing names up in Romeo and Juliet paper"Istoria Novellamente Ritrovata di Due Nobili Amanti2027/mdp.390150822329610820-750X"GCSE exam error: Board accidentally rewrites Shakespeare"10.2307/29176390149-66112917639"Exam board apologises after error in English GCSE paper which confused characters in Shakespeare's Romeo and Juliet""From Mariotto and Ganozza to Romeo and Guilietta: Metamorphoses of a Renaissance Tale"10.2307/37323537323510.2307/2867455286745510.2307/28678912867891"10 Questions for Taylor Swift"10.2307/28680922868092"Haymarket Theatre""The Zeffirelli Way: Revealing Talk by Florentine Director""Michael Smuin: 1938-2007 / Prolific dance director had showy career"The Life and Art of Edwin BoothRomeo and JulietRomeo and JulietRomeo and JulietRomeo and JulietEasy Read Romeo and JulietRomeo and Julieteeecb12003684p(data)4099369-3n8211610759dbe00d-a9e2-41a3-b2c1-977dd692899302814385X313670221313670221