Dear Maarten, Thank you very much for your effort. I use Google Chrome and 'tab' key is not working. Thank you again.
With regards, Santanu On 26 August 2011 03:22, Maarten Derickx <m.derickx.stud...@gmail.com>wrote: > Dear Santanu, > > I noticed that you asked quite a few "easy" questions in the last few day. > It might be usefull for you to walk trough a sage tutorial (to be found at > http://www.sagemath.org/doc/tutorial/ as soon as the site is working > again) and a python tutorial (since everything you can do in python you can > also do in sage). This might make it easier to come up with your own > solutions. > The solution to this question is: > > sage: a=4 > sage: pad_zeros(a.binary(),6) > '000100' > > Note that before reading your question I didn't know the awnser either. But > sage has a few nice features to help you discover some features. > > Suppose I want to do something with an integer I first do > > sage: a=4 > > so a is an integer. > > now I do > > sage: a. > > and the pres the <tab> key. > > The result is > > a.N a.is_idempotent > a.numerical_approx > a.abs a.is_integral a.ord > a.additive_order a.is_irreducible a.order > a.base_extend a.is_nilpotent a.ordinal_str > a.base_ring a.is_norm a.parent > a.binary a.is_one a.popcount > a.binomial a.is_perfect_power a.powermod > a.bits a.is_power > a.powermodm_ui > a.cartesian_product a.is_power_of > a.prime_divisors > a.category a.is_prime > a.prime_factors > a.ceil a.is_prime_power > a.prime_to_m_part > a.conjugate a.is_pseudoprime a.quo_rem > a.coprime_integers a.is_square a.radical > a.crt a.is_squarefree > a.rational_reconstruction > a.db a.is_unit a.real > a.degree a.is_zero a.rename > a.denominator a.isqrt a.reset_name > a.digits a.jacobi a.save > a.divide_knowing_divisible_by a.kronecker a.sqrt > a.divides a.lcm a.sqrt_approx > a.divisors a.leading_coefficient a.sqrtrem > a.dump a.list > a.squarefree_part > a.dumps a.log a.str > a.exact_log a.mod a.subs > a.exp a.multifactorial a.substitute > a.factor a.multiplicative_order a.support > a.factorial a.n a.test_bit > a.floor a.nbits > a.trailing_zero_bits > a.gamma a.ndigits > a.trial_division > a.gcd a.next_prime a.val_unit > a.imag a.next_probable_prime a.valuation > a.inverse_mod a.nth_root a.version > a.inverse_of_unit a.numerator a.xgcd > > > I scan the results for something that make a into something binary and > indeed there is a .binary method. > Now I do > > sage: a.binary? > > to see what it does, an it almost does what I want. > > I do > > sage: l = a.binary() > > and see then I want it to be of length 6 so I want to pad it with zero's. > > I do > > sage: l.pad > > and press tab. To bad there is no such function so I try > > sage: pad > > and press tab and see that there is indeed a funtion which pads zero's. > > > -- > To post to this group, send email to sage-support@googlegroups.com > To unsubscribe from this group, send email to > sage-support+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/sage-support > URL: http://www.sagemath.org > -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org