Hi Yotam, On Sat, Nov 28, 2009 at 5:03 AM, Yotam Avital <yota...@gmail.com> wrote:
<SNIP> > As I far as I can understand, solution_dict tells sage that I want the > output to be in dictionary form(that is, {x:1, y:8 ...}) Yes, you're right. > I also know that the .n(30) tell sage I want the answer to have 30 digits > accuracy. Not quite. The method .n(30) tells Sage that you want an approximation with 30 bits of precision. The default is to use 53 bits of precision. This method has two keywords: "prec" for specifying the number of bits of precision; and "digits" for specifying the number of digits. For example, consider the following Sage session: {{{ [mv...@sage ~]$ sage ---------------------------------------------------------------------- | Sage Version 4.2.1, Release Date: 2009-11-14 | | Type notebook() for the GUI, and license() for information. | ---------------------------------------------------------------------- sage: var('x, y, p, q'); sage: eq1 = p + q == 9 sage: eq2 = q*y + p*x == -6 sage: eq3 = q*y^2 + p*x^2 == 24 sage: solns = solve([eq1, eq2, eq3, p==1], p, q, x, y, solution_dict=True) sage: sol = solns[0][p] sage: # approximate sol with 30 bits of precision sage: sol.n(30) 1.0000000 sage: sol.n(prec=30) 1.0000000 sage: # approximate sol with 30 digits of precision sage: sol.n(digits=30) 1.00000000000000000000000000000 }}} You can find out more about the method .n() by issuing "sol.n?" at the command line. > I can't understand though the logic of the last command. Can any > of you explain it to me? You were asking for an approximation with 30 bits of precision. If you want an approximation with 30 digits of precision, use the key word "digits" of the method .n(). -- Regards Minh Van Nguyen -- 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