@@ -18,7 +18,7 @@ So what rule should we write for this case?
18
18
The obvious answer, would be to write a rule that throws an error if input at a point where calculus says the derivative is not defined.
19
19
Another option is to return some error signally value like ` NaN ` .
20
20
Which you * can* do.
21
- However, this is not useful.
21
+ However, there is no where to go with an error, the user still wants a derivative; so this is not useful.
22
22
23
23
Let us explore what is useful:
24
24
# Case Studies
@@ -65,9 +65,10 @@ plot(x-> x < 0 ? x : 5x)
65
65
```
66
66
67
67
Here was have 3 main options, all are good.
68
- We could say there derivative at 0 is
68
+
69
+ We could say there derivative at 0 is:
69
70
- 1: which agrees with backwards finite differencing
70
- - 5: which agrees with fowards finite differencing
71
+ - 5: which agrees with forwards finite differencing
71
72
- 3: which is the mean of ` [1, 5] ` , and agrees with central finite differencing
72
73
73
74
All of these options are perfectly nice members of the [ subderivative] ( https://en.wikipedia.org/wiki/Subderivative ) .
@@ -80,6 +81,13 @@ Saying it is `3` is the arguably the nicest, but it is also the most expensive t
80
81
plot(ceil)
81
82
```
82
83
84
+ Here it seems most useful to say the derivative is zero everywhere.
85
+ The limits are zero from both sides.
86
+
87
+ The other option for ` ceil ` would be to say it is 1 everywhere.
88
+ But that it too weird, if the use wanted a relaxation of the problem then they would provide one.
89
+ Imposing one on ` ceil ` for everyone is not reasonable.
90
+
83
91
### Primal finite, and derivative nonfinite and same on both sides
84
92
85
93
``` @example nondiff
0 commit comments