Why does this command (dJ_dw.subs([(sd,d),(sx,x)])) NOT substitute for the value of ‘d’ which is calculated in one of the previous cells?

Prior to running this line, we arrived at dJ_dw = (d)(x).

Now we run the line dJ_dw.subs([(sd,d),(sx,x)]) to substitute the values of d and x in the derivative. Only x seems to be substituted as the output received is ‘2d’. Please clarify. Thanks

The command substitutes `d`

for `sd`

. I think the explanation is that, if you print `sd`

, it no longer represents the symbol for `d`

because it has been overwritten by `a - y`

. Therefore, it does not replaces the symbol `d`

with the value of `d`

.

Raymond

Thanks for the response. I tested that theory and it works. I defined a function whose derivative had two variables with direct assignments to integers. Subs was able to substitute both the variables with its integer values.

1 Like

Hey @Macwin_Savio_Dsouza, thank you for letting us know.

Cheers,

Raymond