问题
As per the title - say you have a fixed parameter like air density. Is it worth defining the partial w.r.t this fixed parameter?
回答1:
If you know the value will be fixed forever (i.e. you'll never want to connect it to something else), the you don't need to declare derivatives for that combination of variables.
However I consider this to be a bad practice. In my experience, at some point in the future you will end up connecting something to that input, and then the total derivatives will be wrong. You could, of course, fix the derivatives at that point, but you might not remember and it will take you some time to debug the optimization and figure out the source of the bad derivatives. So as a best practice, I always differentiate all outputs with respect to all inputs.
Alternatively, you could declare density as an option instead of an input (see the docs on options) If you really want it to be a constant, this is the route I suggest.
来源:https://stackoverflow.com/questions/61432357/is-it-necessary-or-recommended-to-define-partials-w-r-t-fixed-parameters