Ask Your Question
1

error interact in 9.6 on my computer but not on sagecell

asked 2022-07-24 13:45:52 +0200

ortollj gravatar image

updated 2022-07-24 15:08:51 +0200

HI

The code with interact still generate the same error in SageMath 9.6 in my computer than in 9.5 but this code in SageCell don't produce any error , why ?

when I type version() on sagecell I got:

'SageMath version 9.6, Release Date: 2022-05-15' same as mine.

@interact
def _(v=('vector', input_grid(1, 3, default=[[1,2,3]], to_value=lambda x: vector(flatten(x))))):
    print(v.norm())

TypeError: unable to find a common ring for all elements

related to question 63362 make-pb-when-installing-from-source

edit retag flag offensive close merge delete

Comments

I would like to know if the problem comes from my installation on my PC, or if it comes from the sage-9.5.tar.gz file or something is missing in relation to the installation on sagecell.or if there is a missing import needed for library ?. Does anyone encounter or not encounter the error on their PC with 9.5 or 9.6 ?

ortollj gravatar imageortollj ( 2022-07-24 18:05:13 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-07-24 20:26:52 +0200

Emmanuel Charpentier gravatar image

Same problem here (9.7.beta5 sompiled from Git on Deban testing). But this :

@interact
def _(v=input_grid(1, 3, 
                   default=[[1,2,3]],
                   to_value=lambda x: vector(SR, flatten(x)),
                   label='vector')):
    print(v.norm())

works as expected using either Jupyter or Jupyterlab and on Sagecell.

One may note that Sagecell automatically adds an auto_update=False argument. (This button, BTW, avoids the constant update during edition of the values, as well the error messages occurring when a value isn't evalable during edition, and might be a valuable addition to your controls...).

This implies that the interact engines of Jupyter and Sagecell aren't identical, which could explain that the form def _((<somelabel>, <somecontrol>),...) is no longer accepted by Sage's Jupyter and Jupyterlab, while still being acceptable by Sagecell.

But I am anything but familiar with interacts ; a question on sage-support would be in order...

HTH,

edit flag offensive delete link more

Comments

ortollj gravatar imageortollj ( 2022-07-24 20:38:19 +0200 )edit

But there is still a little problem, example try to change 3 in -4, when you want to change a value you can copy past -4 directly in the grid,but if you want to change an input by deleting a value and then enter the new value then you get : SyntaxError: unexpected EOF while parsing this problem is not present in SageCell (only on Jupyter notebook in SageMath 9.5 and 9.6 on my computer )

ortollj gravatar imageortollj ( 2022-07-30 16:28:08 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2022-07-24 13:45:52 +0200

Seen: 33 times

Last updated: Jul 24