add real life examples + simplify multiply code.
This commit is contained in:
parent
88d37f174e
commit
6686e4f919
|
@ -90,6 +90,8 @@ help
|
|||
exit
|
||||
```
|
||||
|
||||
You can see real life examples [here](https://x.com/NunoSempere/status/1831106442721452312), [here](https://x.com/NunoSempere/status/1829525844169248912), [here](https://x.com/NunoSempere/status/1818810770932568308), [here](https://x.com/NunoSempere/status/1816605190415401100), [here](https://x.com/NunoSempere/status/1816604386703081894), [here](https://x.com/NunoSempere/status/1815169781907042504)
|
||||
|
||||
## Tips & tricks
|
||||
|
||||
- It's conceptually clearer to have all the multiplications first and then all the divisions
|
||||
|
|
11
fermi.go
11
fermi.go
|
@ -73,7 +73,7 @@ const HELP_MSG = " Operation | Variable assignment | Special\n" +
|
|||
" beta: beta alpha beta\n" +
|
||||
" Variable assignment: =: variable_name\n" +
|
||||
" Variable assignment and clear stack: =. variable_name\n" +
|
||||
" Special: \n" +
|
||||
" Special commands: \n" +
|
||||
" Comment: # this is a comment\n" +
|
||||
" Clear stack: clear | c | .\n" +
|
||||
" Print debug info: debug | d\n" +
|
||||
|
@ -209,8 +209,6 @@ func multiplyDists(old_dist Dist, new_dist Dist) (Dist, error) {
|
|||
return multiplyLogDists(o, n), nil
|
||||
case Scalar:
|
||||
return multiplyLogDists(o, Lognormal{low: float64(n), high: float64(n)}), nil
|
||||
default:
|
||||
return operateDistsAsSamples(old_dist, new_dist, "*")
|
||||
}
|
||||
}
|
||||
case Scalar:
|
||||
|
@ -223,20 +221,15 @@ func multiplyDists(old_dist Dist, new_dist Dist) (Dist, error) {
|
|||
return multiplyLogDists(Lognormal{low: float64(o), high: float64(o)}, n), nil
|
||||
case Scalar:
|
||||
return Scalar(float64(o) * float64(n)), nil
|
||||
default:
|
||||
return operateDistsAsSamples(old_dist, new_dist, "*")
|
||||
}
|
||||
}
|
||||
case Beta:
|
||||
switch n := new_dist.(type) {
|
||||
case Beta:
|
||||
return multiplyBetaDists(o, n), nil
|
||||
default:
|
||||
return operateDistsAsSamples(old_dist, new_dist, "*")
|
||||
}
|
||||
default:
|
||||
return operateDistsAsSamples(old_dist, new_dist, "*")
|
||||
}
|
||||
return operateDistsAsSamples(old_dist, new_dist, "*")
|
||||
}
|
||||
|
||||
func divideDists(old_dist Dist, new_dist Dist) (Dist, error) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user