Expression node giving unexpected results

The expression node is giving me unexpected results when I multiply the result of a trigonometric function for a constant. If I do the same thing with individual nodes it works. why is that? is it a bug or am I formatting the expression wrong?

I attach the gh file for testing.

diff result.gh (10.4 KB)

I think this bug was just answered just recently here. The exp component is case insensitive… R and r are the same.

Also note that this component comes with a significant performance loss on large data and you are not handling zero division here properly. Best is to avoid this component as much as possible.

You need to have different input names like R1 and r. R and r are treated as the same, so your expression gets confused.

AH! it might be usefull to have an alert in the node for this!

about the performance what do you mean? it is better to decompose the expression in individual nodes or they also have performance issues?

Thanks all.

It parses the statement and uses “Reflection” to invoke the involved code during runtime. So its not pre-compiled logic. This dynamic code execution can slow down performance easily by a magnitude. It depends on the amount of data. For a couple of hundreds of computations it won’t matter much I guess, but as soon as the expression gets more complicated and more data is involved you’ll see a performance hit. The solution then is to convert it into basic math components.

1 Like