[sage-support] Re: is it possible to show() a variable with it's name = in front of it

2008-11-10 Thread Stan Schymanski
In connection with another post by Andreas, I realised that the above ashow() definition does not create nice output if decimal numbers are involved: y = 0.5*x ashow('y') returns: y=0.500x Is there a way of manipulating the eval() command to round a decimal number? If so, I would be

[sage-support] Re: is it possible to show() a variable with it's name = in front of it

2008-10-07 Thread Stan Schymanski
This does not format things like a_2 very well. What about this one? def ashow(v): show(sage.calculus.calculus.var(v)==eval(v)) Show seems to format the equations nicely without explicitly using latex. If latex is desired explicitly, the following works, too: def ashow(v):

[sage-support] Re: is it possible to show() a variable with it's name = in front of it

2008-10-07 Thread William Stein
On Tue, Oct 7, 2008 at 2:50 AM, Stan Schymanski [EMAIL PROTECTED] wrote: This does not format things like a_2 very well. What about this one? def ashow(v): show(sage.calculus.calculus.var(v)==eval(v)) Show seems to format the equations nicely without explicitly using latex. If latex

[sage-support] Re: is it possible to show() a variable with it's name = in front of it

2008-10-06 Thread Samuel Gaehwiler
Thank you all for your replies! I was overwhelmed by your fast and helpful replies! I may should have described my desired result in more detail: I don't wanna display/print out the line a = \frac{{2 q}}{3} but I would like to Sage display it, as if it was processed by latex (the look of a

[sage-support] Re: is it possible to show() a variable with it's name = in front of it

2008-10-06 Thread kkwweett
Or is there a way to access the content of a variable, when you only have a string with its name? 'Eval' can do that : def ashow(v): show($+v+=%s$%latex(eval(v))) b=2/3 ashow('b') Hope that helps --~--~-~--~~~---~--~~ To post to this group, send email to

[sage-support] Re: is it possible to show() a variable with it's name = in front of it

2008-10-06 Thread Samuel Gaehwiler
On Oct 7, 12:27 am, kkwweett [EMAIL PROTECTED] wrote: 'Eval' can do that : def ashow(v):   show($+v+=%s$%latex(eval(v))) b=2/3 ashow('b') Thank you! That's it. --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To

[sage-support] Re: is it possible to show() a variable with it's name = in front of it

2008-10-03 Thread Neal Holtz
Or, if you don't like constantly having to repeat the variable name, something like: sage: def vshow(_v): : print '%s = %s\n' % (_v,latex(globals()[_v])) : sage: var('q') q sage: a = 3*q/2 sage: vshow('a') a = \frac{{3 q}}{2} This is far from an ideal solution, as if you call it

[sage-support] Re: is it possible to show() a variable with it's name = in front of it

2008-10-03 Thread Georg
Hi samuel, may you write yourself a wrapper which similar to this: def ashow(**args): ... for key in args: ... print key,'=',args[key] ... c = 345.45 ashow(c=c) c = 345.45 instead of print key,'=',args[key] one could write return str(key) + '=' + str(args[key]) the following

[sage-support] Re: is it possible to show() a variable with it's name = in front of it

2008-10-03 Thread Jason Grout
Samuel Gaehwiler wrote: hi, I use sage (in notebook mode) for basic calculations on a daily basis. I also like to print out my calculations and hand it in with my exercise. Since the people who correct them here at the ETH university in Zürich are not familiar with sage, I would like to