quantified-uncertainty / squiggle

An estimation language
https://squiggle-language.com
MIT License
150 stars 23 forks source link

Number->Dist|Number Functions could take in an additional previous param to "Condition" on. #3052

Open OAGr opened 7 months ago

OAGr commented 7 months ago

Description of suggestion or shortcoming:

image

It's often the case where we might want to show a value/distribution over a function as steadily increasing. One annoying thing is that each point is calculated separately.

One way of doing this is to have an optional second parameter that accepts a {X:... Y:...} value of a previous value to condition on.

For example,

myFunction(newX:numeric, conditional:numeric?) = {
  timeChange = 30 to 50
  if (conditional) then 
    diff = (newX - conditional.x)
    conditional.y + (diff * timeChange)
  else then newX * timeChange
}