We are producing study materials where it's usual to use "a + b I".
The following occurs in Sage 7.6: sage: 1+2*I 2*I + 1 and the question is: how to rewrite the complex numbers way of printing. I've seen it's <Expression> type and maybe changing _repr_ but I have never tried. We have done the function below but I was wonder if a more standard way of printing them exists. Thank you! Pedro def cnice(x): if x.imag_part()<0: return "{0} - {1}I".format(x.real_part(), abs(x.imag_part())) elif x.imag_part()==0: return "{0}".format(x.real_part()) else: return "{0} + {1}I".format(x.real_part(), abs(x.imag_part())) terça-feira, 11 de Abril de 2017 às 20:25:46 UTC+1, Jeroen Demeyer escreveu: > > On 2017-04-11 18:25, Pedro Cruz wrote: > > Hello, > > > > sage is printing b*I + a and we want to see a + b * I > > Do you have a complete example? > > -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at https://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.