python - how can I use sympy to add expressions with index -
i have dataframe in pandas, first columns named x0
, second x1
. has many(like 100) rows. have 100 groups of [x0,x1]
, , want generate long expression every related 1 group. more clearly, task want generate expression:
exp(b0*x00+b1*x10)+exp(b0*x01+b1*x11)+...exp(b0*(x0 100) + b1*(x1 100))
b0
, b1
both unknown value (symbols) here , find solution later on.
in brief, need expression sigma(exp(b0*x0+b1*x1))
, sigma has 100 items x0,x1 n
dataframe, don't know how program loop.
please me.
i hope helps, i'm not familiar panda, need summation(f, (i, a, b)) sympy.
essentially, need declare expr = summation(exp, (i, 0, 101)) in case, 'exp' function has symbolic b0 , b1 terms inside it.
and when want pretty print out, need use pprint(expr) instead of print().
Comments
Post a Comment