Need help scripting a double for/while loop



I’m trying to perform a number of summations, n, for different values of another parameter, s.

FresnelC expansion


However, I haven’t succeeded as my code returns an empty list for all the values of s.
I would be happy if someone could help me out here.

Fresnel Integrals for Clothoid Generation


  1. looks like your n and s variables are backwards when you call your function maybe.

2.why are you checking that j or i is less than a list? what does that mean? If you want to replicate, than try not typing s: as an array. (var[]).

3.try testing your function with 2 numbers first instead of two lists just to make sure it works as you intend in the simple case.



File: Fresnel.dyn



Thanks again Vikram, happy to have you around!

There’s still one problem though, the results computed for s=3…10 are false.

I don’t see how that can be.

Listed below are some correct results:

correct calculations


I think the problem is the Math.Factorial() function.

Math Factorial Bug From 13! results are falsely interpreted (out of range).
Furthermore, starting from 21! the factorial function starts returning wrong values itself.

Can anybody fix this?


Please report this issue here


Hello Daniel,

It’s actually working as expected. You’re getting an error because the node is trying to output this huge value as an integer and integers have a maximum value.

Once you go past the factorial of 12, you should really switch to complex numbers instead.

The problem is that if this node is changed to output complex numbers, then all other nodes will also have to be changed to handle complex numbers…

As a work-around, you could try to do your calculation in the python interpreter instead. There you can mix and match value types as much as you want.



Max value of number

Actually Daniel, your results for [3] and [4] don’t seem to be consistent with the rest of the sequence.

While there does seem to be a discrepancy in the value displayed in the Watch node, the factorial seems to be alright.


@ Vikram

Hmm, [3] and [4] actually seem okay in your example (even though there seems to be a minor discrepancy for all values calculated), but for [7], [8] and [9] the calculation goes very wrong.

correct calculations 3

PS how do you show so many decimals in Dynamo? I can only see four.


@ Dimitar

Thanks for the explanation. I’m gonna give Python a try then.