Interact fails

17 views
Skip to first unread message

Kwankyu Lee

unread,
Mar 13, 2018, 8:53:52 PM3/13/18
to sage-cell
Hi,

@interact
def f(n=(100,(1,100000))):
   
def tossing():
       
return 1 if random() > 0.5 else 0
    k
=0
   
for i in range(n):
        a
= tossing()
        b
= tossing()
       
if a == b:
            k
+= 1
   
print(numerical_approx(k/n))

This fails in SageMathCell but works fine in jupyter notebook. What does this reveal?

(1) This is a just temporary bug in SageMathCell, and should be fixed by the normal procedure via Trac.

(2) SageMathCell is not maintained as much as Jupyter notebook 

(3) There is no test framework for sage interacts like our sage doctest framework

Which are true?


Kwankyu

Andrey Novoseltsev

unread,
Mar 13, 2018, 9:54:04 PM3/13/18
to sage-cell
What it reveals depends on your definitions. Interact implementations are different for each frontend (SageNB, SageMathCell, Jupyter, CoCalc) and have some small (or sometimes big) differences. It is on my long term TODO to look at interacts and unify them with Jupyter as much as possible, but I am not there yet. Feel free to join the effort!

Kwankyu Lee

unread,
Mar 13, 2018, 10:00:02 PM3/13/18
to sage-cell


On Wednesday, March 14, 2018 at 10:54:04 AM UTC+9, Andrey Novoseltsev wrote:
What it reveals depends on your definitions. Interact implementations are different for each frontend (SageNB, SageMathCell, Jupyter, CoCalc) and have some small (or sometimes big) differences. It is on my long term TODO to look at interacts and unify them with Jupyter as much as possible, but I am not there yet. Feel free to join the effort!

Ok.

Then for this specific case, is this a bug or a feature of sagemathcell? 

Kwankyu Lee

unread,
Mar 13, 2018, 10:02:30 PM3/13/18
to sage-cell
I am asking this because if this is a bug, then I can put efforts to fix it.

Kwankyu Lee

unread,
Mar 13, 2018, 10:08:23 PM3/13/18
to sage-cell
By the way, I put the same code into your new cosmos sagemathcell and evaluated, but there is no output. 

My browser is chrome on mac. It seems to be a  network problem, as I am in Korea.

Andrey Novoseltsev

unread,
Mar 13, 2018, 10:11:58 PM3/13/18
to sage-cell

I'd say it is a bug - the initial values seem to be integer, so it is a bit surprising to have float values.

Andrey Novoseltsev

unread,
Mar 13, 2018, 10:13:39 PM3/13/18
to sage-cell
On Tuesday, 13 March 2018 20:08:23 UTC-6, Kwankyu Lee wrote:
By the way, I put the same code into your new cosmos sagemathcell and evaluated, but there is no output. 

My browser is chrome on mac. It seems to be a  network problem, as I am in Korea.

Thanks for checking! Looks like the new code does not handle exceptions properly - will fix this.
Reply all
Reply to author
Forward
0 new messages