Show HN: I made a spreadsheet where formulas also update backwards
252 points| fouronnes3 | 2 months ago |victorpoughon.github.io
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.
[+] [-] pedrozieg|2 months ago|reply
One way to make this less surprising might be to flip the default: treat all cells as fixed unless explicitly marked as solver variables, and give a lightweight visualization of “these are the cells that will move if you edit this one.” That keeps the power of a general constraint solver while preserving the mental model spreadsheet users already have, and it opens the door to more serious use cases (financial models, physics, scheduling) without feeling like spooky action at a distance.
[+] [-] fouronnes3|2 months ago|reply
[+] [-] willrshansen|2 months ago|reply
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.
[+] [-] rahimnathwani|2 months ago|reply
[+] [-] ximm|2 months ago|reply
[+] [-] areyousure|2 months ago|reply
As a more substantive comment: You may find the thesis "Propagation networks : a flexible and expressive substrate for computation" by Alexey Radul interesting. https://dspace.mit.edu/handle/1721.1/54635
[+] [-] fainpul|2 months ago|reply
Enter these formulas:
Drag fill everything down. At this point you get reference errors, but once you enter any two values (thereby overwriting the formulas in those cells), you get your result.[+] [-] culi|2 months ago|reply
[+] [-] davexunit|2 months ago|reply
[+] [-] SoftTalker|2 months ago|reply
[+] [-] spiderice|2 months ago|reply
[+] [-] fainpul|2 months ago|reply
You can query it, giving unknowns an uppercase `Name`, and it will give you the possible values for it:
You can try it here: https://swish.swi-prolog.org/So if you had a rule that defines RSA key calculation this way, you could enter a key and get all valid solutions for the primes. But of course complex calculations still take a long time. I assume it's similar to a brute force attack in that way (Prolog has clever strategies to explore the solution space though).
Disclaimer: I'm not an expert in Prolog or cryptography, so this might not be 100% accurate.
[+] [-] rvba|2 months ago|reply
[+] [-] yonatan8070|2 months ago|reply
[+] [-] b-karl|2 months ago|reply
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.
[+] [-] graemep|2 months ago|reply
If this was usual it would help a lot with people's tendency to hard code the correct answer rather than fix formulae. Just that aspect of it would be a huge improvement. People do this all the time with simple financial problem, for example.
A lot of what people use spreadsheets for is not all that simple. Again, especially with financial applications. People manage huge amounts of money using horribly complex models implemented in Excel.
[+] [-] moron4hire|2 months ago|reply
[+] [-] thomastay|2 months ago|reply
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?
[+] [-] fragmede|2 months ago|reply
[+] [-] amirhirsch|2 months ago|reply
Constraint propagation from SICP is a great reference here:
https://sicp.sourceacademy.org/chapters/3.3.5.html
[+] [-] fouronnes3|2 months ago|reply
[+] [-] adonovan|2 months ago|reply
[+] [-] big-chungus4|2 months ago|reply
I think you should be able to use bidi-calc to train a neural net, altough I haven't tried. You'd define a neural net, and then change it's random output to what you want it to output. However as I understand it, it won't find a good solution. It might find a least squares solution to the last layer, then you'd want previous layer to output something that reduces error of the last layer, but bidi-calc will no longer consider last layer at all.
[+] [-] uoaei|2 months ago|reply
The term of interest is "backpropagation".
[+] [-] PaulHoule|2 months ago|reply
[+] [-] RachelF|2 months ago|reply
[+] [-] jsax|2 months ago|reply
This functionality is called ‘break back’ in a lot of enterprise modelling software. See [IBM TM1](https://www.ibm.com/docs/en/cognos-planning/10.2.1?topic=bre...) and [Anaplan](https://help.anaplan.com/breakback-1b7aa87d-aa13-49f6-8f7d-d...). They generally work in terms of scaling the inputs to match the new output though, which is a bit more basic than this approach.
[+] [-] fouronnes3|2 months ago|reply
[+] [-] Animats|2 months ago|reply
Anyone remember?
[+] [-] kccqzy|2 months ago|reply
[+] [-] satvikpendem|2 months ago|reply
[+] [-] culi|2 months ago|reply
[+] [-] remywang|2 months ago|reply
[+] [-] penteract|2 months ago|reply
Since you've asked about bugs, I tried pushing the limits and found the following:
A2 can be successfully set to anything reasonable (up to 2500)However, setting A3 to exactly 100 doesn't work, even though setting it to 101 or 99 (or even 100.000001) does work.
Another limit:
Setting A4 to zero (or anything below 80) doesn't work. This doesn't improve if the constants in the A4 formula are moved a short distance away from 100.In case you can't tell from that last example, I think being able to fix the intended values of multiple outputs simultaneously would be interesting. If you were to give more details about the solver's internals, I'd be keen to hear them.
[+] [-] zkmon|2 months ago|reply
[+] [-] fouronnes3|2 months ago|reply
[+] [-] d--b|2 months ago|reply
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.
[+] [-] amelius|2 months ago|reply
People want them in general programming languages too. I can't count the number of times I had to implement the same function multiple times, but backwards in various ways.
[+] [-] fouronnes3|2 months ago|reply
I'd like to add more constraints in the future like a domain constraint for variables.
[+] [-] nico|2 months ago|reply
[+] [-] fouronnes3|2 months ago|reply
I think one issue will be that trig functions are kinda weird because they are non-injective. So they work but they are awkward (try solving cos(A1) = 0.5). Inverse kinematics is so well studied, you're probably better off using a dedicated algorithm.
[+] [-] amelius|2 months ago|reply
[+] [-] rvba|2 months ago|reply
[+] [-] jy14898|2 months ago|reply
[+] [-] fouronnes3|2 months ago|reply