Thank you both, I will dive into this and see if it works.

El martes, 6 de abril de 2021 a las 4:39:57 UTC-3, Emmanuel Charpentier 
escribió:

> I am somewhat skeptical about getting such an R package in CRAN : the 
> dependency on Sagemath is probably a bit heavy for its platforms... and 
> heavily platform dependent (we have serious implementation differences 
> between Linux Mac and Windows versions).
>
> A few remarks below :
>
> Le lundi 5 avril 2021 à 22:47:22 UTC+2, [email protected] a écrit :
>
>> R has a package to use Python in its path, 
>>
>> https://cran.r-project.org/web/packages/reticulate/vignettes/calling_python.html
>>  
>>
>> So yes, you can make sure that Sage's Python comes first, 
>> and then you need to do 
>>
>> from sage.all import * 
>>
>> to load all Sage classes.
>
>
> Be aware, however, that the Sage preprocessor won’t be “automatically 
> available” ; you’ll have to preprocess your code in order to get what you 
> mean. Compare :
>
> ## In Sage
> sage: (2/3).parent()
> Rational Field
>
> with 
>
> ## In Sage's Python
> >>> from sage.all import *
> >>> (2/3).parent()
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> AttributeError: 'float' object has no attribute 'parent'
>
> “Preprocessing” by hand allows you to get what you mean…,
>
> >>> QQ(2/3).parent()
> Rational Field
>
> or by using the preparse Sage function :
>
> >>> eval(preparse("2/3")).parent()
> Rational Field
>
>
> In the (hopefully not too far) future, an alternative would be to use Sage 
> distributed as a library in the system's Python interpreter. See 
>
> this <https://pypi.org/project/sagemath-standard/> and the pages it 
> points to for further information. This would also alleviate the platforms 
> inconsistency problem...
>
> HTH,
>
> On Mon, Apr 5, 2021 at 3:10 PM Carlos Antunes <[email protected]> wrote: 
>> > 
>> > I have some functions and scripts written in sage that uses symmetric 
>> functions, integer partitions, some poset and matrix stuff. I want to offer 
>> this functions to R users but since the code is large and complicated 
>> enough I'd like to avoid rewriting it. 
>> > 
>> > Is there any way I can reuse what I have in sage? I know about the 
>> existence of SymPy, but I don't know if that's useful, because even while 
>> sympy has some code for, e.g, dealing with symmetric functions, it is 
>> probably not the same as the sage one, and still forces me rewrite a large 
>> amount of code. 
>> > 
>> > I don't even know if this can actually be done, but it would be really 
>> useful. 
>> > 
>> > Thanks in advance. 
>> > 
>> > -- 
>> > You received this message because you are subscribed to the Google 
>> Groups "sage-support" group. 
>> > To unsubscribe from this group and stop receiving emails from it, send 
>> an email to [email protected]. 
>> > To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/sage-support/07a6ede2-73d4-4a0b-8abc-e53fa0f09c18n%40googlegroups.com.
>>  
>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/9fb0018b-49d7-4440-acf4-96dd7aa0f5e0n%40googlegroups.com.

Reply via email to