Hello HN! I'm happy to release this project today. It's a bidirectional calculator (hence the name bidicalc).
I've been obsessed with the idea of making a spreadsheet where you can update both inputs and outputs, instead of regular spreadsheets where you can only update inputs.
Please let me know what you think! Especially if you find bugs or good example use cases.
“Formulas that update backwards” is the main idea behind neural networks such as LLMs: the computation network produces a value, the error in this value is computed, and then the error quantity is pushed backward through the network; this relies on the differentiability of the function computed at each node in the network.
Can you enter an RSA key and have it produce two prime numbers?
The idea is very interesting. As a default strategy you could preserve the ratio of inputs by scaling them to match the scaling of the output, instead of making them equal (for addition). Similarly, for multiplication, you could preserve the ratio of inputs as well, by scaling them by nth root of the scaling factor of the output.
The first example on the main page has a formula with two variables being updated from changing one value. The immediate question I have is if I change the output, where does the extra degree of freedom come from on the inputs? Does one stay locked in place? Unclear.
I am a huge fan of the concept though. It's been bugging me for years that my spreadsheet doesn't allow editing text fields after filtering and sorting them down to the subset I want. I have to go all the way back to the mess of unsorted input rows to actually edit them.
In Excel you have goal seek for this functionality. I believe it does some form of numerical solving of the equation system.
Good for every situation when you need to solve equations!
In the context of using spreadsheets I think about solving simple financial or maybe construction/mechanical design problems where you don’t want to solve it manually or program it and a spreadsheet is a quick and useful interface.
A 2d sketcher with constraints is kind of similar. For example the equation
A = B + C
Where A, B, C are the lengths of 3 parallel lines. Within the sketcher you can drag the length of any one of those lines and the other two will adjust to keep the constraints.
This is really cool! It's like Excel's goal seek but can also handle the case of arbitrary input cells. Goal seeek can only handle one input and one output cell.
But how do you handle the case where multiple variables can be changed? If multiple input cells is the key difference from Goal seek, i think some more rigor should be placed into the algorithm here
e.g. setting A1 + B1 and wanting the result to be 5. Currently it bumps both A1 and B1 equally. What's the thought process behind this?
Wow! See the classic https://en.wikipedia.org/wiki/TK_Solver
A bidirectional formula is also known as an integrity constraint in databases (plus some triggers for restoring the constraint upon updates)!
Cool!
Constraint propagation from SICP is a great reference here:
I think the concept is solid. I’ve only had a few minutes of playing with it, but I have the opinion is that from a UX perspective constants are more common than variables. So perhaps a cell containing a constant should not have a #, but a variable should.
Reminds me of functional logical programming languages like Verse. when you specify the output and ask for the inputs, you get all possible inputs.
Excellent (sorry accidental pun)
This is a nice exploration.
The examples are great and these bidirectional calculators are something that people would love to have in traditional spreadsheets.
So much so that Credit Suisse, which basically was running everything on heavily modded Excel, created a full language whose outputs were Excel spreadsheets capable of doing that. That thing called “paradise” was a total monstrosity but showed how much people wanted this.
That said, you really need a way to set which cells are fixed and which cells are allowed to move if you want to move past basic examples.
Most times you know what you want to do. like => if the user modifies that cell, find a solution for those specific ones.
If you can enter that info, then you have a lot more constrains for your solver and will avoid a lot of edge cases where everything goes to 0, and you can check that the calculation entered is indeed reversible or not, or if it could have multiple solutions, and so on.
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?
Super cool! Well done. Now take it down and never let Microsoft get their hands on the code, or the entire economic system will go down in flames.
Very cool!
I'd love to see a version where cells are "torn off" and named as they were in Lotus Improv and one had a "formula pane" where one could see all the formulae for a spreadsheet.
Would it be possible to create this in Python so that it could be a part of pyspread?
you might like https://omrelli.ug/g9/ which is a similar concept but for graphics
interesting. like Excel Solver? or OpenSolver, Gurobi, other optimizers? or different objective?
[dead]
[dead]
LOL! Gemini suggested to implement this to me literally yesterday: bidirectional computations. The example was that given a temperature in Celsius and Fahrenheit, modifying either of them should update their counterpart. In angular that would be two linked signals for instance, but even that is a bit fringe. Gemini was going for something even more elaborated.
I told Gemini that spreadsheets were actually not doing that and that I had ways to implement that behavior without the complexity.
Just writing that to show the rabbit hole people are going to fall into if they let their llms go brrr. ;D
Could you build an inverse kinematics solver with this? (I recently watched a youtube video of someone iteratively working out the solutions for a robotic arm, by alternating modifying the inputs and the results)