Hi Aaron, Thanks for helping!
In this case I'll probably implement a wrapper parser to roll out the indexes first and then feed the generated equations to sympy. Any plan on automating this in future release? Best, Will On Thursday, April 20, 2017 at 12:28:25 PM UTC-7, Aaron Meurer wrote: > > The code generation functionality needed to make this sort of thing > automatic isn't implemented yet. Ideally, you'd be able to lambdify the two > statements as a single block of code. Also, for solve(), elimination is not > implemented yet (https://github.com/sympy/sympy/issues/2720 > <https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fsympy%2Fsympy%2Fissues%2F2720&sa=D&sntz=1&usg=AFQjCNFMZgyGEZnDyNWjZeTDoUh5DtxoJQ>). > For > now, your best bet is to simply substitute the one expression in the other > (m.subs(y[i], sqrt(x[i]))). > > Aaron Meurer > > On Wed, Apr 19, 2017 at 7:08 PM, Will <[email protected] <javascript:>> > wrote: > >> Dear all, >> >> So I'm trying to use Sympy to solve a simple system with indexed symbols, >> something like this: >> >> Eq 1. y[i] = sqrt(x[i]) >> Eq 2. m = Sum(z[i] * y[i], (i, 0, n)) / Sum(x[i], (i, 0, >> n)) >> >> where, *x, y, z, i, n and m* are symbols (x, y and z are *IndexedBase* >> and i is *Idx*, n and m are *Symbol*). >> >> Now given each x[i], n and z[i], I'd like to lambdify a callable function >> to evaluate m, how can I achieve this? >> >> Issue with my attempt: I tried using *solve([Eq1, Eq2])* to generate a >> symbolic solution for m first, but it seems that y[i] is not resolved as >> sqrt(x[i]) but kept in its original form y[i]. >> >> Any help is appreciated! >> >> -- >> 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] <javascript:>. >> To post to this group, send email to [email protected] <javascript:> >> . >> Visit this group at https://groups.google.com/group/sympy. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/sympy/470f6d1b-534e-47ad-87a3-acdab0362b3e%40googlegroups.com >> >> <https://groups.google.com/d/msgid/sympy/470f6d1b-534e-47ad-87a3-acdab0362b3e%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > > -- 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 post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/422ff8d1-83a7-472b-9556-e5da4c74168c%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
