Zohreh, I pulled the paper. I see no reason you need to use SymPy to do the numerical fitting. I would approach this by inputting the species in a dictionary or list and then use that to call functions that generate the computed value for each term/sum. Are you trying to keep track of the complete symbolic expression or do a numerical calculation?
If you are using chemical symbols or reactions, are you taking advantage of ChemPy? Jonathan On Tuesday, August 23, 2022 at 12:01:02 AM UTC-5 [email protected] wrote: > As following, I should generate each parameters dynamically (for 20-30 > terms): > > term_vnca = 0 > for k in anion: > for j in cation: > for i in neutral: > term_vnca += term_vncX - 4 * 3 * sp.symbols(f'X{str(k)}') * > sp.symbols('X{0}'.format(str(i))) \ > ** 2 * sp.symbols(f'V{str(i)}{str(j)}{str(k)}') > lnfXs = term_wnca + term_unca + term_vnca + termx_w_solvent1 + > termx_w_solvent2 > > Zohreh Karimzadeh > *https://www.researchgate.net/profile/Zohreh-Karimzadeh* > <https://www.researchgate.net/profile/Zohreh-Karimzadeh> > Skype Name 49a52224a8b6b38b > Twitter Account @zohrehkarimzad1 > [email protected] > +989102116325 <+98%20910%20211%206325> > > ((((((((((((((((Value Water))))))))))))))) > > > On Tue, Aug 23, 2022 at 9:26 AM Zohreh Karimzadeh <[email protected]> > wrote: > >> Not these model and parameters, My model is very complicated wit large >> number of parameters: >> [image: image.png] >> As a very simple example I raise this question. >> Zohreh Karimzadeh >> >> Contact me on >> +989102116325 <+98%20910%20211%206325> >> and at >> [email protected] >> 🌧️🌍🌱 >> >> >> On Tue, 23 Aug 2022, 05:16 Peter Stahlecker, <[email protected]> >> wrote: >> >>> Dear Zohreh, >>> >>> Just for my understanding: >>> 1. >>> You params are alpha, betta ,gamma, eta (?) >>> 2. >>> What do you mean by generating them dynamically? >>> >>> Peter >>> >>> On Tue 23. Aug 2022 at 02:44 Zohreh Karimzadeh <[email protected]> >>> wrote: >>> >>>> Dear Oscar >>>> BIG help ! >>>> Here I seriously need to use sympy to generate my params dynamically. >>>> All Bests >>>> Zohreh Karimzadeh >>>> *https://www.researchgate.net/profile/Zohreh-Karimzadeh* >>>> <https://www.researchgate.net/profile/Zohreh-Karimzadeh> >>>> Skype Name 49a52224a8b6b38b >>>> Twitter Account @zohrehkarimzad1 >>>> [email protected] >>>> +989102116325 <+98%20910%20211%206325> >>>> >>>> ((((((((((((((((Value Water))))))))))))))) >>>> >>>> >>>> On Mon, Aug 22, 2022 at 7:42 PM Oscar Benjamin <[email protected]> >>>> wrote: >>>> >>>>> On Mon, 22 Aug 2022 at 15:36, Peter Stahlecker >>>>> <[email protected]> wrote: >>>>> > >>>>> > Dear Oscar, >>>>> > >>>>> > Thanks for your hint about these parameters!. >>>>> > Probably dumb question of mine: >>>>> > Could one not define f_Vi_est directly as >>>>> > >>>>> > def_Vi_est(gamma, alfa, beta, eta, L, K, VA): >>>>> > Vi_est = gamma - (1 / eta)….. >>>>> > return np.sum(…..) >>>>> > >>>>> > without any ‚lambdification‘? >>>>> >>>>> Yes. In an earlier post the OP showed that they had working code like >>>>> that but wanted to know how to do it using SymPy and lambdify. I >>>>> presume there is a reason for wanting to use SymPy there (perhaps to >>>>> accomplish something slightly different from the exact code shown). >>>>> It's also possible that there isn't any actual reason to use SymPy for >>>>> this at all though. >>>>> >>>>> -- >>>>> Oscar >>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "sympy" group. >>>>> To unsubscribe from this group and stop receiving emails from it, send >>>>> an email to [email protected]. >>>>> To view this discussion on the web visit >>>>> https://groups.google.com/d/msgid/sympy/CAHVvXxQJUuZ4tVnECPyWE%3DLd03hhhUB5mqv1bjHcjSNf9WP22Q%40mail.gmail.com >>>>> . >>>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "sympy" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected]. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/sympy/CA%2B1XYLOMV_i3VJXwwVN7JWnuJ9Wo6ZPhULmC1SOubAfFLt-DBQ%40mail.gmail.com >>>> >>>> <https://groups.google.com/d/msgid/sympy/CA%2B1XYLOMV_i3VJXwwVN7JWnuJ9Wo6ZPhULmC1SOubAfFLt-DBQ%40mail.gmail.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>> -- >>> Best regards, >>> >>> Peter Stahlecker >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "sympy" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/sympy/CABKqA0YTOzyZkjhnQmKQKQh-Mrc_H_TcmD9FrXObaTadkfLpkQ%40mail.gmail.com >>> >>> <https://groups.google.com/d/msgid/sympy/CABKqA0YTOzyZkjhnQmKQKQh-Mrc_H_TcmD9FrXObaTadkfLpkQ%40mail.gmail.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/17d62c5c-11d8-4b1b-9a44-ae67c8021832n%40googlegroups.com.
