Your second suggestion is perfect as it is exactly what I am looking to do - many thanks! You guys are so on the ball :- )
On Friday, 3 May 2013 13:49:23 UTC+10, smichr wrote: > > logs automatically simplify perfect powers. To create a log that doesn't > do this you can use evaluate=False: > > >>> log(4,evaluate=False) > log(4) > > To do this to an entire expression you can do > > >>> def logjoin(m): > ... if not m.is_Mul: return m > ... c, args = m.as_coeff_mul() > ... if c is S.One: return m > ... logs = [l for l in args if l.func is log and l.args[0].is_Number] > ... if len(logs) != 1: return m > ... args = list(args) > ... args.remove(logs[0]) > ... return log(logs[0].args[0]**c, evaluate=False)*Mul._from_args(args) > ... > >>> from sympy.simplify.simplify import bottom_up > >>> log(16)+log(9) > 2*log(3) + 4*log(2) > >>> bottom_up(_, logjoin) > log(9) + log(16) > > -- 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 http://groups.google.com/group/sympy?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.
