Why is this recursive code so slow? 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?What are the hidden specifications for FindRootWhy does this function inside FindRoot fail to evaluate?Very slow mathematica finite differencesUsing Mathematica to solve a recursive system of differential equationsImproving the speed on an iterated differential systemForward iterations of coupled recursion equationsManipulate+FindRoot+Plot3D very slow/crashAttacking a “Mathematica can't solve” problemErrors using FindRoot on slow numerical functionAvoiding a for loop to create a list

Why are the trig functions versine, haversine, exsecant, etc, rarely used in modern mathematics?

How to react to hostile behavior from a senior developer?

Generate an RGB colour grid

Do jazz musicians improvise on the parent scale in addition to the chord-scales?

Do I really need recursive chmod to restrict access to a folder?

How to Make a Beautiful Stacked 3D Plot

If a VARCHAR(MAX) column is included in an index, is the entire value always stored in the index page(s)?

Is it ethical to give a final exam after the professor has quit before teaching the remaining chapters of the course?

How to find all the available tools in mac terminal?

An adverb for when you're not exaggerating

How come Sam didn't become Lord of Horn Hill?

How to compare two different files line by line in unix?

Should I use a zero-interest credit card for a large one-time purchase?

Is grep documentation wrong?

Is it cost-effective to upgrade an old-ish Giant Escape R3 commuter bike with entry-level branded parts (wheels, drivetrain)?

How do I stop a creek from eroding my steep embankment?

Trademark violation for app?

Why wasn't DOSKEY integrated with COMMAND.COM?

When the Haste spell ends on a creature, do attackers have advantage against that creature?

Withdrew £2800, but only £2000 shows as withdrawn on online banking; what are my obligations?

Can a party unilaterally change candidates in preparation for a General election?

Do square wave exist?

Why do we bend a book to keep it straight?

Using et al. for a last / senior author rather than for a first author



Why is this recursive code so slow?



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?What are the hidden specifications for FindRootWhy does this function inside FindRoot fail to evaluate?Very slow mathematica finite differencesUsing Mathematica to solve a recursive system of differential equationsImproving the speed on an iterated differential systemForward iterations of coupled recursion equationsManipulate+FindRoot+Plot3D very slow/crashAttacking a “Mathematica can't solve” problemErrors using FindRoot on slow numerical functionAvoiding a for loop to create a list










5












$begingroup$


This code for the first five iterations the speed is okay, but after that the speed is very slow, I cannot understand what is wrong with this? Would you please help me fix it?



Clear[A, r, x, s, e]
s := 0.3405
e := 1.6539*10^-21
u[0] := 0.
u[1] := 0.1

A[r_] := A[r] =
Piecewise[r - 2.5 s - 48*e *s^12*r^-13 + 24*e*s^6*r^-7,
r > 2.5 s, -48*e*s^12*r^-13 + 24*e*s^6*r^-7,
s <= r <= 2.5 s, r - s -
24*e*s^-1, r < s]
For[i = 2, i < 101,
i++, u[i_] :=
x /. FindRoot[
u[i - 1] +
1/(i^2 (u[i - 1] - u[i - 2])^2) (u[i - 1] - u[i - 2]) -
0.9 A[x] == x , x, 1.]; Print[u[i]]]









share|improve this question











$endgroup$











  • $begingroup$
    How slow? How many minutes/seconds?
    $endgroup$
    – JonyD
    Apr 12 at 8:28















5












$begingroup$


This code for the first five iterations the speed is okay, but after that the speed is very slow, I cannot understand what is wrong with this? Would you please help me fix it?



Clear[A, r, x, s, e]
s := 0.3405
e := 1.6539*10^-21
u[0] := 0.
u[1] := 0.1

A[r_] := A[r] =
Piecewise[r - 2.5 s - 48*e *s^12*r^-13 + 24*e*s^6*r^-7,
r > 2.5 s, -48*e*s^12*r^-13 + 24*e*s^6*r^-7,
s <= r <= 2.5 s, r - s -
24*e*s^-1, r < s]
For[i = 2, i < 101,
i++, u[i_] :=
x /. FindRoot[
u[i - 1] +
1/(i^2 (u[i - 1] - u[i - 2])^2) (u[i - 1] - u[i - 2]) -
0.9 A[x] == x , x, 1.]; Print[u[i]]]









share|improve this question











$endgroup$











  • $begingroup$
    How slow? How many minutes/seconds?
    $endgroup$
    – JonyD
    Apr 12 at 8:28













5












5








5





$begingroup$


This code for the first five iterations the speed is okay, but after that the speed is very slow, I cannot understand what is wrong with this? Would you please help me fix it?



Clear[A, r, x, s, e]
s := 0.3405
e := 1.6539*10^-21
u[0] := 0.
u[1] := 0.1

A[r_] := A[r] =
Piecewise[r - 2.5 s - 48*e *s^12*r^-13 + 24*e*s^6*r^-7,
r > 2.5 s, -48*e*s^12*r^-13 + 24*e*s^6*r^-7,
s <= r <= 2.5 s, r - s -
24*e*s^-1, r < s]
For[i = 2, i < 101,
i++, u[i_] :=
x /. FindRoot[
u[i - 1] +
1/(i^2 (u[i - 1] - u[i - 2])^2) (u[i - 1] - u[i - 2]) -
0.9 A[x] == x , x, 1.]; Print[u[i]]]









share|improve this question











$endgroup$




This code for the first five iterations the speed is okay, but after that the speed is very slow, I cannot understand what is wrong with this? Would you please help me fix it?



Clear[A, r, x, s, e]
s := 0.3405
e := 1.6539*10^-21
u[0] := 0.
u[1] := 0.1

A[r_] := A[r] =
Piecewise[r - 2.5 s - 48*e *s^12*r^-13 + 24*e*s^6*r^-7,
r > 2.5 s, -48*e*s^12*r^-13 + 24*e*s^6*r^-7,
s <= r <= 2.5 s, r - s -
24*e*s^-1, r < s]
For[i = 2, i < 101,
i++, u[i_] :=
x /. FindRoot[
u[i - 1] +
1/(i^2 (u[i - 1] - u[i - 2])^2) (u[i - 1] - u[i - 2]) -
0.9 A[x] == x , x, 1.]; Print[u[i]]]






equation-solving recursion






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 12 at 8:27









Roman

5,56111131




5,56111131










asked Apr 12 at 4:08









morapimorapi

355




355











  • $begingroup$
    How slow? How many minutes/seconds?
    $endgroup$
    – JonyD
    Apr 12 at 8:28
















  • $begingroup$
    How slow? How many minutes/seconds?
    $endgroup$
    – JonyD
    Apr 12 at 8:28















$begingroup$
How slow? How many minutes/seconds?
$endgroup$
– JonyD
Apr 12 at 8:28




$begingroup$
How slow? How many minutes/seconds?
$endgroup$
– JonyD
Apr 12 at 8:28










1 Answer
1






active

oldest

votes


















12












$begingroup$

I recommend you learn the distinction between immediate (=) and delayed (:=) assignments. They make the difference between slow and fast code here. Start with this tutorial or this book chapter, then look at memoization.



s = 0.3405;
e = 1.6539*10^-21;
u[0] = 0.;
u[1] = 0.1;

A[r_] = Piecewise[r - 2.5 s - 48*e*s^12*r^-13 + 24*e*s^6*r^-7, r > 2.5 s,
-48*e*s^12*r^-13 + 24*e*s^6*r^-7, s <= r <= 2.5 s,
r - s - 24*e*s^-1, r < s];

u[i_] := u[i] = x /. FindRoot[
u[i - 1] + 1/(i^2 (u[i - 1] - u[i - 2])^2) (u[i - 1] - u[i - 2]) - 0.9 A[x] == x, x, 1.]

Array[u, 100]



0.1, 1.77164, 1.37065, 1.04259, 0.887781, 0.708344, 0.59461,
0.457228, 0.367364, 0.296071, 0.256104, 0.20463, 0.208487, 1.20917,
1.04197, 0.939331, 0.879865, 0.827963, 0.774591, 0.72775, 0.67934,
0.63666, 0.592369, 0.553172, 0.512352, 0.476112, 0.438261, 0.404563,
0.369277, 0.339073, 0.321616, 0.301118, 0.296195, 0.224688, 0.273538,
0.31357, 0.33593, 0.366902, 0.38813, 0.417572, 0.437777, 0.465834,
0.48511, 0.511907, 0.530336, 0.55598, 0.573633, 0.598219, 0.615159,
0.638772, 0.655054, 0.677768, 0.693441, 0.715321, 0.73043, 0.751535,
0.766118, 0.786503, 0.800596, 0.820306, 0.833941, 0.852182, 0.85901,
0.874152, 0.871531, 0.78396, 0.781416, 0.696402, 0.693931, 0.611329,
0.608927, 0.528603, 0.526267, 0.448099, 0.445825, 0.369701, 0.367485,
0.315658, 0.325798, 0.341207, 0.351098, 0.366134, 0.375788, 0.390468,
0.399897, 0.414237, 0.42345, 0.437466, 0.446473, 0.46018, 0.46899,
0.4824, 0.491022, 0.504149, 0.51259, 0.525444, 0.533712, 0.546306,
0.554408, 0.56675




(takes about 1.3 seconds)



Alternatively, use



Table[u[i], i, 1, 100]


(same result). Your combination of For and Print shows the results but doesn't let you keep using them for more calculations.






share|improve this answer











$endgroup$












  • $begingroup$
    thank you very much. I really appreciate it.
    $endgroup$
    – morapi
    Apr 12 at 6:35






  • 1




    $begingroup$
    delayed assignments definitely sound slower than immediate, even if I have never worked with Mathematica
    $endgroup$
    – Roland
    Apr 12 at 10:07







  • 2




    $begingroup$
    @Roland it's not just that one is necessarily faster or slower than the other, it's more that they are completely different things with very different applications. For some reason this point is often overlooked by beginners in Mathematica.
    $endgroup$
    – Roman
    Apr 12 at 10:14











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
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f195054%2fwhy-is-this-recursive-code-so-slow%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









12












$begingroup$

I recommend you learn the distinction between immediate (=) and delayed (:=) assignments. They make the difference between slow and fast code here. Start with this tutorial or this book chapter, then look at memoization.



s = 0.3405;
e = 1.6539*10^-21;
u[0] = 0.;
u[1] = 0.1;

A[r_] = Piecewise[r - 2.5 s - 48*e*s^12*r^-13 + 24*e*s^6*r^-7, r > 2.5 s,
-48*e*s^12*r^-13 + 24*e*s^6*r^-7, s <= r <= 2.5 s,
r - s - 24*e*s^-1, r < s];

u[i_] := u[i] = x /. FindRoot[
u[i - 1] + 1/(i^2 (u[i - 1] - u[i - 2])^2) (u[i - 1] - u[i - 2]) - 0.9 A[x] == x, x, 1.]

Array[u, 100]



0.1, 1.77164, 1.37065, 1.04259, 0.887781, 0.708344, 0.59461,
0.457228, 0.367364, 0.296071, 0.256104, 0.20463, 0.208487, 1.20917,
1.04197, 0.939331, 0.879865, 0.827963, 0.774591, 0.72775, 0.67934,
0.63666, 0.592369, 0.553172, 0.512352, 0.476112, 0.438261, 0.404563,
0.369277, 0.339073, 0.321616, 0.301118, 0.296195, 0.224688, 0.273538,
0.31357, 0.33593, 0.366902, 0.38813, 0.417572, 0.437777, 0.465834,
0.48511, 0.511907, 0.530336, 0.55598, 0.573633, 0.598219, 0.615159,
0.638772, 0.655054, 0.677768, 0.693441, 0.715321, 0.73043, 0.751535,
0.766118, 0.786503, 0.800596, 0.820306, 0.833941, 0.852182, 0.85901,
0.874152, 0.871531, 0.78396, 0.781416, 0.696402, 0.693931, 0.611329,
0.608927, 0.528603, 0.526267, 0.448099, 0.445825, 0.369701, 0.367485,
0.315658, 0.325798, 0.341207, 0.351098, 0.366134, 0.375788, 0.390468,
0.399897, 0.414237, 0.42345, 0.437466, 0.446473, 0.46018, 0.46899,
0.4824, 0.491022, 0.504149, 0.51259, 0.525444, 0.533712, 0.546306,
0.554408, 0.56675




(takes about 1.3 seconds)



Alternatively, use



Table[u[i], i, 1, 100]


(same result). Your combination of For and Print shows the results but doesn't let you keep using them for more calculations.






share|improve this answer











$endgroup$












  • $begingroup$
    thank you very much. I really appreciate it.
    $endgroup$
    – morapi
    Apr 12 at 6:35






  • 1




    $begingroup$
    delayed assignments definitely sound slower than immediate, even if I have never worked with Mathematica
    $endgroup$
    – Roland
    Apr 12 at 10:07







  • 2




    $begingroup$
    @Roland it's not just that one is necessarily faster or slower than the other, it's more that they are completely different things with very different applications. For some reason this point is often overlooked by beginners in Mathematica.
    $endgroup$
    – Roman
    Apr 12 at 10:14















12












$begingroup$

I recommend you learn the distinction between immediate (=) and delayed (:=) assignments. They make the difference between slow and fast code here. Start with this tutorial or this book chapter, then look at memoization.



s = 0.3405;
e = 1.6539*10^-21;
u[0] = 0.;
u[1] = 0.1;

A[r_] = Piecewise[r - 2.5 s - 48*e*s^12*r^-13 + 24*e*s^6*r^-7, r > 2.5 s,
-48*e*s^12*r^-13 + 24*e*s^6*r^-7, s <= r <= 2.5 s,
r - s - 24*e*s^-1, r < s];

u[i_] := u[i] = x /. FindRoot[
u[i - 1] + 1/(i^2 (u[i - 1] - u[i - 2])^2) (u[i - 1] - u[i - 2]) - 0.9 A[x] == x, x, 1.]

Array[u, 100]



0.1, 1.77164, 1.37065, 1.04259, 0.887781, 0.708344, 0.59461,
0.457228, 0.367364, 0.296071, 0.256104, 0.20463, 0.208487, 1.20917,
1.04197, 0.939331, 0.879865, 0.827963, 0.774591, 0.72775, 0.67934,
0.63666, 0.592369, 0.553172, 0.512352, 0.476112, 0.438261, 0.404563,
0.369277, 0.339073, 0.321616, 0.301118, 0.296195, 0.224688, 0.273538,
0.31357, 0.33593, 0.366902, 0.38813, 0.417572, 0.437777, 0.465834,
0.48511, 0.511907, 0.530336, 0.55598, 0.573633, 0.598219, 0.615159,
0.638772, 0.655054, 0.677768, 0.693441, 0.715321, 0.73043, 0.751535,
0.766118, 0.786503, 0.800596, 0.820306, 0.833941, 0.852182, 0.85901,
0.874152, 0.871531, 0.78396, 0.781416, 0.696402, 0.693931, 0.611329,
0.608927, 0.528603, 0.526267, 0.448099, 0.445825, 0.369701, 0.367485,
0.315658, 0.325798, 0.341207, 0.351098, 0.366134, 0.375788, 0.390468,
0.399897, 0.414237, 0.42345, 0.437466, 0.446473, 0.46018, 0.46899,
0.4824, 0.491022, 0.504149, 0.51259, 0.525444, 0.533712, 0.546306,
0.554408, 0.56675




(takes about 1.3 seconds)



Alternatively, use



Table[u[i], i, 1, 100]


(same result). Your combination of For and Print shows the results but doesn't let you keep using them for more calculations.






share|improve this answer











$endgroup$












  • $begingroup$
    thank you very much. I really appreciate it.
    $endgroup$
    – morapi
    Apr 12 at 6:35






  • 1




    $begingroup$
    delayed assignments definitely sound slower than immediate, even if I have never worked with Mathematica
    $endgroup$
    – Roland
    Apr 12 at 10:07







  • 2




    $begingroup$
    @Roland it's not just that one is necessarily faster or slower than the other, it's more that they are completely different things with very different applications. For some reason this point is often overlooked by beginners in Mathematica.
    $endgroup$
    – Roman
    Apr 12 at 10:14













12












12








12





$begingroup$

I recommend you learn the distinction between immediate (=) and delayed (:=) assignments. They make the difference between slow and fast code here. Start with this tutorial or this book chapter, then look at memoization.



s = 0.3405;
e = 1.6539*10^-21;
u[0] = 0.;
u[1] = 0.1;

A[r_] = Piecewise[r - 2.5 s - 48*e*s^12*r^-13 + 24*e*s^6*r^-7, r > 2.5 s,
-48*e*s^12*r^-13 + 24*e*s^6*r^-7, s <= r <= 2.5 s,
r - s - 24*e*s^-1, r < s];

u[i_] := u[i] = x /. FindRoot[
u[i - 1] + 1/(i^2 (u[i - 1] - u[i - 2])^2) (u[i - 1] - u[i - 2]) - 0.9 A[x] == x, x, 1.]

Array[u, 100]



0.1, 1.77164, 1.37065, 1.04259, 0.887781, 0.708344, 0.59461,
0.457228, 0.367364, 0.296071, 0.256104, 0.20463, 0.208487, 1.20917,
1.04197, 0.939331, 0.879865, 0.827963, 0.774591, 0.72775, 0.67934,
0.63666, 0.592369, 0.553172, 0.512352, 0.476112, 0.438261, 0.404563,
0.369277, 0.339073, 0.321616, 0.301118, 0.296195, 0.224688, 0.273538,
0.31357, 0.33593, 0.366902, 0.38813, 0.417572, 0.437777, 0.465834,
0.48511, 0.511907, 0.530336, 0.55598, 0.573633, 0.598219, 0.615159,
0.638772, 0.655054, 0.677768, 0.693441, 0.715321, 0.73043, 0.751535,
0.766118, 0.786503, 0.800596, 0.820306, 0.833941, 0.852182, 0.85901,
0.874152, 0.871531, 0.78396, 0.781416, 0.696402, 0.693931, 0.611329,
0.608927, 0.528603, 0.526267, 0.448099, 0.445825, 0.369701, 0.367485,
0.315658, 0.325798, 0.341207, 0.351098, 0.366134, 0.375788, 0.390468,
0.399897, 0.414237, 0.42345, 0.437466, 0.446473, 0.46018, 0.46899,
0.4824, 0.491022, 0.504149, 0.51259, 0.525444, 0.533712, 0.546306,
0.554408, 0.56675




(takes about 1.3 seconds)



Alternatively, use



Table[u[i], i, 1, 100]


(same result). Your combination of For and Print shows the results but doesn't let you keep using them for more calculations.






share|improve this answer











$endgroup$



I recommend you learn the distinction between immediate (=) and delayed (:=) assignments. They make the difference between slow and fast code here. Start with this tutorial or this book chapter, then look at memoization.



s = 0.3405;
e = 1.6539*10^-21;
u[0] = 0.;
u[1] = 0.1;

A[r_] = Piecewise[r - 2.5 s - 48*e*s^12*r^-13 + 24*e*s^6*r^-7, r > 2.5 s,
-48*e*s^12*r^-13 + 24*e*s^6*r^-7, s <= r <= 2.5 s,
r - s - 24*e*s^-1, r < s];

u[i_] := u[i] = x /. FindRoot[
u[i - 1] + 1/(i^2 (u[i - 1] - u[i - 2])^2) (u[i - 1] - u[i - 2]) - 0.9 A[x] == x, x, 1.]

Array[u, 100]



0.1, 1.77164, 1.37065, 1.04259, 0.887781, 0.708344, 0.59461,
0.457228, 0.367364, 0.296071, 0.256104, 0.20463, 0.208487, 1.20917,
1.04197, 0.939331, 0.879865, 0.827963, 0.774591, 0.72775, 0.67934,
0.63666, 0.592369, 0.553172, 0.512352, 0.476112, 0.438261, 0.404563,
0.369277, 0.339073, 0.321616, 0.301118, 0.296195, 0.224688, 0.273538,
0.31357, 0.33593, 0.366902, 0.38813, 0.417572, 0.437777, 0.465834,
0.48511, 0.511907, 0.530336, 0.55598, 0.573633, 0.598219, 0.615159,
0.638772, 0.655054, 0.677768, 0.693441, 0.715321, 0.73043, 0.751535,
0.766118, 0.786503, 0.800596, 0.820306, 0.833941, 0.852182, 0.85901,
0.874152, 0.871531, 0.78396, 0.781416, 0.696402, 0.693931, 0.611329,
0.608927, 0.528603, 0.526267, 0.448099, 0.445825, 0.369701, 0.367485,
0.315658, 0.325798, 0.341207, 0.351098, 0.366134, 0.375788, 0.390468,
0.399897, 0.414237, 0.42345, 0.437466, 0.446473, 0.46018, 0.46899,
0.4824, 0.491022, 0.504149, 0.51259, 0.525444, 0.533712, 0.546306,
0.554408, 0.56675




(takes about 1.3 seconds)



Alternatively, use



Table[u[i], i, 1, 100]


(same result). Your combination of For and Print shows the results but doesn't let you keep using them for more calculations.







share|improve this answer














share|improve this answer



share|improve this answer








edited Apr 12 at 8:53

























answered Apr 12 at 4:43









RomanRoman

5,56111131




5,56111131











  • $begingroup$
    thank you very much. I really appreciate it.
    $endgroup$
    – morapi
    Apr 12 at 6:35






  • 1




    $begingroup$
    delayed assignments definitely sound slower than immediate, even if I have never worked with Mathematica
    $endgroup$
    – Roland
    Apr 12 at 10:07







  • 2




    $begingroup$
    @Roland it's not just that one is necessarily faster or slower than the other, it's more that they are completely different things with very different applications. For some reason this point is often overlooked by beginners in Mathematica.
    $endgroup$
    – Roman
    Apr 12 at 10:14
















  • $begingroup$
    thank you very much. I really appreciate it.
    $endgroup$
    – morapi
    Apr 12 at 6:35






  • 1




    $begingroup$
    delayed assignments definitely sound slower than immediate, even if I have never worked with Mathematica
    $endgroup$
    – Roland
    Apr 12 at 10:07







  • 2




    $begingroup$
    @Roland it's not just that one is necessarily faster or slower than the other, it's more that they are completely different things with very different applications. For some reason this point is often overlooked by beginners in Mathematica.
    $endgroup$
    – Roman
    Apr 12 at 10:14















$begingroup$
thank you very much. I really appreciate it.
$endgroup$
– morapi
Apr 12 at 6:35




$begingroup$
thank you very much. I really appreciate it.
$endgroup$
– morapi
Apr 12 at 6:35




1




1




$begingroup$
delayed assignments definitely sound slower than immediate, even if I have never worked with Mathematica
$endgroup$
– Roland
Apr 12 at 10:07





$begingroup$
delayed assignments definitely sound slower than immediate, even if I have never worked with Mathematica
$endgroup$
– Roland
Apr 12 at 10:07





2




2




$begingroup$
@Roland it's not just that one is necessarily faster or slower than the other, it's more that they are completely different things with very different applications. For some reason this point is often overlooked by beginners in Mathematica.
$endgroup$
– Roman
Apr 12 at 10:14




$begingroup$
@Roland it's not just that one is necessarily faster or slower than the other, it's more that they are completely different things with very different applications. For some reason this point is often overlooked by beginners in Mathematica.
$endgroup$
– Roman
Apr 12 at 10:14

















draft saved

draft discarded
















































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%2f195054%2fwhy-is-this-recursive-code-so-slow%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

Club Baloncesto Breogán Índice Historia | Pavillón | Nome | O Breogán na cultura popular | Xogadores | Adestradores | Presidentes | Palmarés | Historial | Líderes | Notas | Véxase tamén | Menú de navegacióncbbreogan.galCadroGuía oficial da ACB 2009-10, páxina 201Guía oficial ACB 1992, páxina 183. Editorial DB.É de 6.500 espectadores sentados axeitándose á última normativa"Estudiantes Junior, entre as mellores canteiras"o orixinalHemeroteca El Mundo Deportivo, 16 setembro de 1970, páxina 12Historia do BreogánAlfredo Pérez, o último canoneiroHistoria C.B. BreogánHemeroteca de El Mundo DeportivoJimmy Wright, norteamericano do Breogán deixará Lugo por ameazas de morteResultados de Breogán en 1986-87Resultados de Breogán en 1990-91Ficha de Velimir Perasović en acb.comResultados de Breogán en 1994-95Breogán arrasa al Barça. "El Mundo Deportivo", 27 de setembro de 1999, páxina 58CB Breogán - FC BarcelonaA FEB invita a participar nunha nova Liga EuropeaCharlie Bell na prensa estatalMáximos anotadores 2005Tempada 2005-06 : Tódolos Xogadores da Xornada""Non quero pensar nunha man negra, mais pregúntome que está a pasar""o orixinalRaúl López, orgulloso dos xogadores, presume da boa saúde económica do BreogánJulio González confirma que cesa como presidente del BreogánHomenaxe a Lisardo GómezA tempada do rexurdimento celesteEntrevista a Lisardo GómezEl COB dinamita el Pazo para forzar el quinto (69-73)Cafés Candelas, patrocinador del CB Breogán"Suso Lázare, novo presidente do Breogán"o orixinalCafés Candelas Breogán firma el mayor triunfo de la historiaEl Breogán realizará 17 homenajes por su cincuenta aniversario"O Breogán honra ao seu fundador e primeiro presidente"o orixinalMiguel Giao recibiu a homenaxe do PazoHomenaxe aos primeiros gladiadores celestesO home que nos amosa como ver o Breo co corazónTita Franco será homenaxeada polos #50anosdeBreoJulio Vila recibirá unha homenaxe in memoriam polos #50anosdeBreo"O Breogán homenaxeará aos seus aboados máis veteráns"Pechada ovación a «Capi» Sanmartín e Ricardo «Corazón de González»Homenaxe por décadas de informaciónPaco García volve ao Pazo con motivo do 50 aniversario"Resultados y clasificaciones""O Cafés Candelas Breogán, campión da Copa Princesa""O Cafés Candelas Breogán, equipo ACB"C.B. Breogán"Proxecto social"o orixinal"Centros asociados"o orixinalFicha en imdb.comMario Camus trata la recuperación del amor en 'La vieja música', su última película"Páxina web oficial""Club Baloncesto Breogán""C. B. Breogán S.A.D."eehttp://www.fegaba.com

Vilaño, A Laracha Índice Patrimonio | Lugares e parroquias | Véxase tamén | Menú de navegación43°14′52″N 8°36′03″O / 43.24775, -8.60070

Cegueira Índice Epidemioloxía | Deficiencia visual | Tipos de cegueira | Principais causas de cegueira | Tratamento | Técnicas de adaptación e axudas | Vida dos cegos | Primeiros auxilios | Crenzas respecto das persoas cegas | Crenzas das persoas cegas | O neno deficiente visual | Aspectos psicolóxicos da cegueira | Notas | Véxase tamén | Menú de navegación54.054.154.436928256blindnessDicionario da Real Academia GalegaPortal das Palabras"International Standards: Visual Standards — Aspects and Ranges of Vision Loss with Emphasis on Population Surveys.""Visual impairment and blindness""Presentan un plan para previr a cegueira"o orixinalACCDV Associació Catalana de Cecs i Disminuïts Visuals - PMFTrachoma"Effect of gene therapy on visual function in Leber's congenital amaurosis"1844137110.1056/NEJMoa0802268Cans guía - os mellores amigos dos cegosArquivadoEscola de cans guía para cegos en Mortágua, PortugalArquivado"Tecnología para ciegos y deficientes visuales. Recopilación de recursos gratuitos en la Red""Colorino""‘COL.diesis’, escuchar los sonidos del color""COL.diesis: Transforming Colour into Melody and Implementing the Result in a Colour Sensor Device"o orixinal"Sistema de desarrollo de sinestesia color-sonido para invidentes utilizando un protocolo de audio""Enseñanza táctil - geometría y color. Juegos didácticos para niños ciegos y videntes""Sistema Constanz"L'ocupació laboral dels cecs a l'Estat espanyol està pràcticament equiparada a la de les persones amb visió, entrevista amb Pedro ZuritaONCE (Organización Nacional de Cegos de España)Prevención da cegueiraDescrición de deficiencias visuais (Disc@pnet)Braillín, un boneco atractivo para calquera neno, con ou sen discapacidade, que permite familiarizarse co sistema de escritura e lectura brailleAxudas Técnicas36838ID00897494007150-90057129528256DOID:1432HP:0000618D001766C10.597.751.941.162C97109C0155020