logoalt Hacker News

throw310822last Friday at 11:57 PM4 repliesview on HN

Hm? I don't get it.

What's the point of calculating backwards non-invertible operations such as addition? Isn't the result just arbitrary?


Replies

fouronnes3last Saturday at 12:10 AM

I made this mostly as a fun challenge :)

You are right that there is some arbitrariness involved when picking a solution, however it's a bit more subtle than that.

Let's say our problem has N free variables.

Step 1 is finding the subset of R^N that is the solution to the root finding problem. If this subset is a point, we are done (return that point). Note that if there is no solution at all bidicalc should correctly report it.

Step 2 is if the solution subset is not a point. Then there is multiple (maybe even an infinity of) solutions, and picking one is indeed arbitrary.

show 1 reply
generalizationslast Saturday at 12:04 AM

They said this:

> Even a normal spreadsheet is fairly complex beast. But the novel thing about bidicalc is the backwards solver. Mathematically, updating a spreadsheet "backward" is a (potentially underdetermined) root finding problem, because we are trying to find a vector of unknowns such that , where F is the function computed by the cells formulas, and G is the objective value entered in the cell. Note that F is not necessarily a single formula, but the result of composing an upstream graph of cells into a single function.

> The actual root-finding solver is a custom algorithm that I made. It a general purpose algorithm that will find one root of any continuous-almost-everywhere function for which a complete syntactic expression is known. It uses a mix of continuous constraint propagation on interval union arithmetic , directional Newton's method and dichotomic search. It is of course limited by floating point precision and available computation time.

But that really doesn't answer your question. I see no reason why the solver wouldn't decide every time it had a two-variable summation that ADD(X+Y) doesn't reverse to X=-90 and Y=100.

esafaklast Saturday at 3:55 AM

It is for fun. Commercial products do not support this because functions are generally not invertible.

show 1 reply
nrhrjrjrjtntbtlast Saturday at 4:15 AM

You could add hints as a feature to this. E.g. interest = rate × principle

The user hints principle is preferred fixed so they can see what rate is needed for a givem amount of interest.

Hints could have a precedence order (then prefer to fix earlier terms on an operation on a tie breaker.)