ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sat, 20 Jun 2015 15:36:35 +0200Is the R interface identical to R in a R.<x> assignment?https://ask.sagemath.org/question/27166/is-the-r-interface-identical-to-r-in-a-rx-assignment/ `R` is a builtin identifier in Sage and refers to the `r` interface :
sage: R
sage.interfaces.r.R
sage: r
R Interpreter
Now I was wondering if the later R is related to the R letter used in a left hand side assignment for instance :
R.<x> = ZZ[]
Fri, 19 Jun 2015 20:48:51 +0200https://ask.sagemath.org/question/27166/is-the-r-interface-identical-to-r-in-a-rx-assignment/Answer by kcrisman for <p><code>R</code> is a builtin identifier in Sage and refers to the <code>r</code> interface :</p>
<pre><code>sage: R
sage.interfaces.r.R
sage: r
R Interpreter
</code></pre>
<p>Now I was wondering if the later R is related to the R letter used in a left hand side assignment for instance :</p>
<pre><code>R.<x> = ZZ[]
</code></pre>
https://ask.sagemath.org/question/27166/is-the-r-interface-identical-to-r-in-a-rx-assignment/?answer=27167#post-id-27167There is absolutely no connection whatsoever. It's coincidence that "rings" starts with "R" and so do the names of the original two developers of the R language (if you believe [CRAN's FAQ](http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-is-R-named-R_003f), though Ihaka's [musings on the history of R](https://www.stat.auckland.ac.nz/~ihaka/downloads/Massey.pdf) lend it credence).
In fact, using `R.<x>` will automatically reassign `R` to that ring, rather than to the R interface, so you won't have both at the same time (though it is easy to get the interface back).Fri, 19 Jun 2015 21:29:27 +0200https://ask.sagemath.org/question/27166/is-the-r-interface-identical-to-r-in-a-rx-assignment/?answer=27167#post-id-27167Comment by kcrisman for <p>There is absolutely no connection whatsoever. It's coincidence that "rings" starts with "R" and so do the names of the original two developers of the R language (if you believe <a href="http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-is-R-named-R_003f">CRAN's FAQ</a>, though Ihaka's <a href="https://www.stat.auckland.ac.nz/~ihaka/downloads/Massey.pdf">musings on the history of R</a> lend it credence).</p>
<p>In fact, using <code>R.<x></code> will automatically reassign <code>R</code> to that ring, rather than to the R interface, so you won't have both at the same time (though it is easy to get the interface back).</p>
https://ask.sagemath.org/question/27166/is-the-r-interface-identical-to-r-in-a-rx-assignment/?comment=27168#post-id-27168It would be worth learning a bit of Python syntax if you are going to use Sage - in particular, identifiers belong to whatever you assign them to, which can change any time you assign them to something else.Fri, 19 Jun 2015 21:31:01 +0200https://ask.sagemath.org/question/27166/is-the-r-interface-identical-to-r-in-a-rx-assignment/?comment=27168#post-id-27168Comment by candide for <p>There is absolutely no connection whatsoever. It's coincidence that "rings" starts with "R" and so do the names of the original two developers of the R language (if you believe <a href="http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-is-R-named-R_003f">CRAN's FAQ</a>, though Ihaka's <a href="https://www.stat.auckland.ac.nz/~ihaka/downloads/Massey.pdf">musings on the history of R</a> lend it credence).</p>
<p>In fact, using <code>R.<x></code> will automatically reassign <code>R</code> to that ring, rather than to the R interface, so you won't have both at the same time (though it is easy to get the interface back).</p>
https://ask.sagemath.org/question/27166/is-the-r-interface-identical-to-r-in-a-rx-assignment/?comment=27169#post-id-27169Thanks, I didn't realize that the R.<x> assignment rebinds R to a polynomial ring. But, as you can check, the docs misleadingly build polynomial ring generator with the syntax R.<some_id>, (nearly) always with the R name in such a way I thought that the letter R was mandatory. This is not true since S.<x> is valid and create a new binding from S to a polynomial ring. In fact, what your response just explains is the non-negligible difference between Python syntax and Sage syntax (I imagine, due to the Sage preprocessor). In Python, R.<x> raises a syntax error. And worse, in Python R.attr always refers to an R attribute (not the case here with Sage) and doesn't bind or rebind R. I consider the R.<x> as an unfortunate choice (the is no attribute setting) and R<x> would have been clearer.Fri, 19 Jun 2015 23:05:09 +0200https://ask.sagemath.org/question/27166/is-the-r-interface-identical-to-r-in-a-rx-assignment/?comment=27169#post-id-27169Comment by kcrisman for <p>There is absolutely no connection whatsoever. It's coincidence that "rings" starts with "R" and so do the names of the original two developers of the R language (if you believe <a href="http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-is-R-named-R_003f">CRAN's FAQ</a>, though Ihaka's <a href="https://www.stat.auckland.ac.nz/~ihaka/downloads/Massey.pdf">musings on the history of R</a> lend it credence).</p>
<p>In fact, using <code>R.<x></code> will automatically reassign <code>R</code> to that ring, rather than to the R interface, so you won't have both at the same time (though it is easy to get the interface back).</p>
https://ask.sagemath.org/question/27166/is-the-r-interface-identical-to-r-in-a-rx-assignment/?comment=27174#post-id-27174The rationale is that some other programs offered this syntax, so it was enabled (long, long ago) to make it easy to migrate. Most users of Magma are unlikely to be also needing R :)Sat, 20 Jun 2015 15:36:35 +0200https://ask.sagemath.org/question/27166/is-the-r-interface-identical-to-r-in-a-rx-assignment/?comment=27174#post-id-27174