Posted by fouronnes3 4 days ago
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.
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.
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.
Does one stay locked in place? Unclear.
If you set C1=A1+B1 then, when you set a value for C1, A1 and B1 are each half of that value, even if they started off unbalanced.It also doesn't help that in the example, the expected outcome of 53.3333/46.6667 isn't even considered.
A1 = 1.0 // the scale, your variable
A2 = 6 * A1 // intermediate values
A3 = 8 * A1
A4 = A2 + A3 // the sum
Now update A4 (or any other cell!) and the scale (A1, the only variable) will update as you expect.In the future I'd like to support more user input constraints, in particular domain constraints for variables. So you could tell the solver that this cell must remain in some interval, and it would respect that interval instead of assigning any real value.
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
Enter these formulas:
distance = time / pace
time = distance * pace
pace = time / distance
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.This particular example may be unlikely, but it's a very fun idea.
Primarily because the learnings you make are the same as the original “discoverer”. Without those learnings, you might not be able to arrive at your true destination.
Luckily no one is suggesting that.
I remember reading, about a year or two ago, about a medical doctor that published a paper rediscovering calculus (I just looked it up, it happened in 1994, there’s been many articles and videos about it)
This is such a great story
This is also true with patents.
:- use_module(library(clpr)).
pace(Km, Minutes, Pace) :-
{ Minutes = Km * Pace }.
Even though the rule only specifies how Minutes are calculated, Prolog can now also calculate the other values.You can query it, giving unknowns an uppercase `Name`, and it will give you the possible values for it:
pace(5, 24.5, Pace)
pace(40, Min, 5)
pace(Km, 24.5, 5)
pace(Km, Time, 5)
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.
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.
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.
Anyone remember?
Constraint propagation from SICP is a great reference here:
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.
The term of interest is "backpropagation".
Wasn’t Prolog invented to formalise these kinds of problems of making the inputs match what the desired output should be.
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.