开发者

Proportionality of parameter and mathematical expression

开发者 https://www.devze.com 2023-03-09 00:55 出处:网络
What is the best way to check if a parameter increase in a mathematical expression increases or decreases the expression as a whole (in Python, preferably SymPy)?

What is the best way to check if a parameter increase in a mathematical expression increases or decreases the expression as a whole (in Python, preferably SymPy)?

Assumptions: all parameters are positive (i.e. > 0).

Example A*B/(A+C): A should be found as proportional to the expressio开发者_开发技巧n and C should be found as inverse proportional.

One obvious solution would be to assign 1 to all parameters, 1 and 100 to C respectively and apply eval(), but that is very crude and might yield errors (e.g. with (A-B)/C where the best case would be to give an error instead of a wrong result).


I don't believe this can be solved in the general case. A simple counter-example is sin(A), which could be both proportional and inverse proportional, depending on what value of A you are evaluating it at.

However, you could use an automatic differentiation tool, such as PyDX or Theano, to compute the derivative of functions at various parameter values.

0

精彩评论

暂无评论...
验证码 换一张
取 消