ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 31 Oct 2010 21:56:26 -0500I need help with Sagetex/Sage (normal form&data file useage)http://ask.sagemath.org/question/7739/i-need-help-with-sagetexsage-normal-formdata-file-useage/Greetings!
I have two questions.
The easier is, how can i "ask" Sagemath to numerically calculate, and use normal form. For example i would like to see sqrt{2}/10 as 1.41 * 10^{-1}. It would be useful to always get the same precision. Like 2/10 as 2.00 * 10^{-1}
The harder question is, i want to make several calculations with the same data (about 10-20 lines, every line with 2-4 records). It is possible to copy and paste it every time, but i rather do it an easier way. Is it possible?
DanielWed, 27 Oct 2010 12:19:13 -0500http://ask.sagemath.org/question/7739/i-need-help-with-sagetexsage-normal-formdata-file-useage/Comment by Daniel Balog for <p>Greetings!</p>
<p>I have two questions. </p>
<p>The easier is, how can i "ask" Sagemath to numerically calculate, and use normal form. For example i would like to see sqrt{2}/10 as 1.41 * 10^{-1}. It would be useful to always get the same precision. Like 2/10 as 2.00 * 10^{-1}</p>
<p>The harder question is, i want to make several calculations with the same data (about 10-20 lines, every line with 2-4 records). It is possible to copy and paste it every time, but i rather do it an easier way. Is it possible?</p>
<p>Daniel</p>
http://ask.sagemath.org/question/7739/i-need-help-with-sagetexsage-normal-formdata-file-useage/?comment=22525#post-id-22525Hello!
(d/2)*sin(((360-f(344,04,32))/(180))*pi)).n() would be the example calculation. I'd like to get 4.47 e-7. Problem is, the other calculation is{(360-f(351,31,23)+f(8,29,18))/2.n() and it should give 8.48.
Ps. f calculates x°y'z'' to simple degreesSun, 31 Oct 2010 21:56:26 -0500http://ask.sagemath.org/question/7739/i-need-help-with-sagetexsage-normal-formdata-file-useage/?comment=22525#post-id-22525Comment by ccanonc for <p>Greetings!</p>
<p>I have two questions. </p>
<p>The easier is, how can i "ask" Sagemath to numerically calculate, and use normal form. For example i would like to see sqrt{2}/10 as 1.41 * 10^{-1}. It would be useful to always get the same precision. Like 2/10 as 2.00 * 10^{-1}</p>
<p>The harder question is, i want to make several calculations with the same data (about 10-20 lines, every line with 2-4 records). It is possible to copy and paste it every time, but i rather do it an easier way. Is it possible?</p>
<p>Daniel</p>
http://ask.sagemath.org/question/7739/i-need-help-with-sagetexsage-normal-formdata-file-useage/?comment=22534#post-id-22534I think if you reverse your order of questions, you will get a better answer. For example, if you tell us what you're trying to calculate, we can help. Then if you want to display the results in a certain format after the calculation, we can help with that too. =)Thu, 28 Oct 2010 19:00:24 -0500http://ask.sagemath.org/question/7739/i-need-help-with-sagetexsage-normal-formdata-file-useage/?comment=22534#post-id-22534Answer by ccanonc for <p>Greetings!</p>
<p>I have two questions. </p>
<p>The easier is, how can i "ask" Sagemath to numerically calculate, and use normal form. For example i would like to see sqrt{2}/10 as 1.41 * 10^{-1}. It would be useful to always get the same precision. Like 2/10 as 2.00 * 10^{-1}</p>
<p>The harder question is, i want to make several calculations with the same data (about 10-20 lines, every line with 2-4 records). It is possible to copy and paste it every time, but i rather do it an easier way. Is it possible?</p>
<p>Daniel</p>
http://ask.sagemath.org/question/7739/i-need-help-with-sagetexsage-normal-formdata-file-useage/?answer=11761#post-id-11761I don't know if scientific notation is available yet, but you can do the following:
<pre>sage: a = 2/10; a
1/5
sage: (parent(a), type(a))
(Rational Field, <type 'sage.rings.rational.Rational'>)
sage: a.n(4)
0.20
sage: (parent(a.n(4)), type(a.n(4)))
(Real Field with 4 bits of precision, <type 'sage.rings.real_mpfr.RealNumber'>)
sage: (a.n(), parent(a.n()), type(a.n()))
(0.200000000000000, Real Field with 53 bits of precision, <type 'sage.rings.real_mpfr.RealNumber'>)
</pre>Thu, 28 Oct 2010 18:31:23 -0500http://ask.sagemath.org/question/7739/i-need-help-with-sagetexsage-normal-formdata-file-useage/?answer=11761#post-id-11761Comment by Daniel Balog for <p>I don't know if scientific notation is available yet, but you can do the following:</p>
<pre>sage: a = 2/10; a
1/5
sage: (parent(a), type(a))
(Rational Field, <type 'sage.rings.rational.Rational'>)
sage: a.n(4)
0.20
sage: (parent(a.n(4)), type(a.n(4)))
(Real Field with 4 bits of precision, <type 'sage.rings.real_mpfr.RealNumber'>)
sage: (a.n(), parent(a.n()), type(a.n()))
(0.200000000000000, Real Field with 53 bits of precision, <type 'sage.rings.real_mpfr.RealNumber'>)
</pre>
http://ask.sagemath.org/question/7739/i-need-help-with-sagetexsage-normal-formdata-file-useage/?comment=22533#post-id-22533Hello!
I was aware of that trick, but still thanks. Any idea how could i ask for two digits precision instead of like four bits?
DanielFri, 29 Oct 2010 12:00:52 -0500http://ask.sagemath.org/question/7739/i-need-help-with-sagetexsage-normal-formdata-file-useage/?comment=22533#post-id-22533Comment by Daniel Balog for <p>I don't know if scientific notation is available yet, but you can do the following:</p>
<pre>sage: a = 2/10; a
1/5
sage: (parent(a), type(a))
(Rational Field, <type 'sage.rings.rational.Rational'>)
sage: a.n(4)
0.20
sage: (parent(a.n(4)), type(a.n(4)))
(Real Field with 4 bits of precision, <type 'sage.rings.real_mpfr.RealNumber'>)
sage: (a.n(), parent(a.n()), type(a.n()))
(0.200000000000000, Real Field with 53 bits of precision, <type 'sage.rings.real_mpfr.RealNumber'>)
</pre>
http://ask.sagemath.org/question/7739/i-need-help-with-sagetexsage-normal-formdata-file-useage/?comment=22530#post-id-22530Thanks! Still 1/9.n(digits=2) gets 0.11 and 10/9.n(digits=2) gets 1.1, but it's nearly perfect!Sat, 30 Oct 2010 00:09:29 -0500http://ask.sagemath.org/question/7739/i-need-help-with-sagetexsage-normal-formdata-file-useage/?comment=22530#post-id-22530Comment by Jason Bandlow for <p>I don't know if scientific notation is available yet, but you can do the following:</p>
<pre>sage: a = 2/10; a
1/5
sage: (parent(a), type(a))
(Rational Field, <type 'sage.rings.rational.Rational'>)
sage: a.n(4)
0.20
sage: (parent(a.n(4)), type(a.n(4)))
(Real Field with 4 bits of precision, <type 'sage.rings.real_mpfr.RealNumber'>)
sage: (a.n(), parent(a.n()), type(a.n()))
(0.200000000000000, Real Field with 53 bits of precision, <type 'sage.rings.real_mpfr.RealNumber'>)
</pre>
http://ask.sagemath.org/question/7739/i-need-help-with-sagetexsage-normal-formdata-file-useage/?comment=22532#post-id-22532a.n(digits=2) will do this.Fri, 29 Oct 2010 12:45:27 -0500http://ask.sagemath.org/question/7739/i-need-help-with-sagetexsage-normal-formdata-file-useage/?comment=22532#post-id-22532