Skip to content

Commit 187f699

Browse files
committed
Fixed error in "The Quotient Rule"
Differentiation of a fraction is wrong if the numerator or denominator independent of the variable differentiated with respect to. It looks like somebody forgot to divide by (denominator)^2 for the special cases where one of the derivatives is 0
1 parent 9dfc02a commit 187f699

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/differentiate.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,9 @@ function differentiate(::SymbolParameter{:/}, args, wrt)
105105
if xp == 0 && yp == 0
106106
return 0
107107
elseif xp == 0
108-
return :( -$yp * $x )
108+
return :( -$yp * $x / $y^2 )
109109
elseif yp == 0
110-
return :( $xp * $y )
110+
return :( $xp / $y )
111111
else
112112
return :( ($xp * $y - $x * $yp) / $y^2 )
113113
end

0 commit comments

Comments
 (0)