algorithmic modeling for Rhino
Infinity is not a valid number and you cannot do any math with it. It's just there as a slightly more meaningful version of the NaN constant.
--
David Rutten
david@mcneel.com
Tirol, Austria
At the moment I am outputting -1 for non reachable nodes when preforming Dijkstra's algorithm on a graph, but +infinity would be more meaningful.
So for me the question is how Grasshopper deals with infinity (Galapagos seams to have a problem but beyond that?).
e.g.:
0 < Double.PositiveInfinity = ?
Double.MaxValue < Double.PositiveInfinity = ?
x = new Grasshopper.Kernel.Types.GH_Number(Double.PositiveInfinity)
sorry for all the strange questions lately. As summer is starting and all the students are gone, I spend my time reworking/adding new components/improving the SpiderWeb plugin. Hopefully making it better and maybe easier to understand.
thx
Richard
The rules regarding Double.PositiveInfinity and Double.NegativeInfinity are .NET rules. If you want to know how infinities behave in equality and smaller/larger than operators, just try them:
--
David Rutten
david@mcneel.com
Tirol, Austria
Did start testing +/-Infinity:
Found a few things that are inconsistent to msdn / Rhino.Geometry. .... .
Attached a file with things I tried.
Some outcome:
1. The subdivision by 0 would be nice if it would return +/- infinity instead of <null>.
2. As +Infinity <= +Infinity results in TRUE, I don't see why the "Include" component returns false when checking if +infinity is within the boundaries of the domain -Infinity to + Infinity
3. I do not understand why Galapagos has problems dealing with infinity. I do understand that as return value of a fitness function, infinity is rather unfeasible but as it can be used in comparing two numbers it shouldn't be a problem?
Compared to infinity everything else might as well be zero. That is probably why Galapagos can't handle it. Infinity really isn't a number and trying to treat it like one will result in all kinds of paradoxes and weird arithmetic exceptions.
If a domain or a point or vector contain an infinity they are considered to be invalid. This is a RhinoCommon enforced rule.
Also note that x/0 where x > 0 does not equal +infinity. This operation has no solution. The best you can say is that x/y where y approaches zero tends to infinity.
If you have a fitness function which sometimes awards +infinity or -infinity to a certain phase-state then you'll need to improve your function to return an actual number.
--
David Rutten
david@mcneel.com
Tirol, Austria
Do know that infinity is a little tricky in and brings a lot of problems. But e.g.:
"Also note that x/0 where x > 0 does not equal +infinity. This operation has no solution. The best you can say is that x/y where y approaches zero tendsto infinity."
Yes, mathematically speaking a division by 0 is not defined but the .NET environment handles it differently as pointed out on the linked page above.
"If a domain or a point or vector contain an infinity they are considered to be invalid. This is a RhinoCommon enforced rule."
As shown in the sample I attached I can e.g. create a valid domain from -infinity to +infinity but +infinity is not in the list. This is a little odd.
So I guess to answer the question from the beginning, there are a lot of problems with infinity such as inconsistencies between .NET and GH, and general difficulties with the value itself.
I do agree that as long as I support -infinity and +infinity I should make the comparison and smaller/larger than logic work and maybe even look into the stuff to do with Interval inclusion.
--
David Rutten
david@mcneel.com
Tirol, Austria
I don't want to start the discussion about the meaning of infinity again but I noticed something more that if using a number parameter to store (+Infinity) and making this parameter part of a cluster -> Rhino crashes.
However it would be great if the issues with infinity could be dealt with,
thx Richard
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by