Hi, Le lundi 24 février 2025 à 17:39:30 UTC+1, bernd.bre...@gmail.com a écrit :
So how should i define H in 'In [2]', so that 'In [4]' shows the expected result. Basically you should define H as a symbolic expression, not a function, and make a distinction between functions and symbolic variables. A solution is t = var('t') r = var('r') delta = var('delta') alpha = var('alpha') x = function('x') k = function('k') lambda_ = function('lambda_') X = var('X') K = var('K') L = var('L') H = K*(1 - X)*exp(-r*t) + L*(K^alpha*X - delta*K) to_functions = {X: x(t), K: k(t), L: lambda_(t)} # a dictionary to perform substitutions eq1 = (diff(H, X).subs(to_functions) == 0) eq2 = (diff(H, K).subs(to_functions) == - diff(lambda_(t), t)) Best wishes, Eric. . -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/sage-support/f95b5cb1-ae92-4d7f-9d81-a49340b11d5en%40googlegroups.com.