The following SymPy code was given to me by someone who wanted to see if Symbolics/SymbolicUtils/MTK can handle these sorts of situations.
using SymPy w_1, w_2 = symbols("w_1, w_2",real=true,positive=true) pi = symbols("pi") left = pi*(w_1/2)+(1-pi)w_1 right = pi*w_2+(1-pi)*w_2/2 prob_simp = solve(left-right,pi) prob = max(min(solve(left-right,pi),1),0) print(prob) y_1,y_2 = symbols("y_1,y_2") profit = (1-(1-prob)^2)*(y_1-w_1) print(profit) profit_simp = (1-(1-prob_simp)^2)*(y_1-w_1) dprofit = diff(profit_simp, w_1) print(dprofit) BR = solve(dprofit,w_1) print(BR) symmetric_sol = solve(w_2-BR(y_1 => 1)) print(symmetric_sol)
Can this be ported directly, and if not what are the missing features/overloads/etc.? By directly I mean that it is the symbolics output that the person cares about. The biggest thing I wasn’t sure about was how to handle the simple 1-D solve.