Ask Your Question
1

problem with giac integration

asked 2021-01-03 11:19:39 +0100

ortollj gravatar image

updated 2024-08-26 11:20:58 +0100

FrédéricC gravatar image

problem with giac integration

this problem is present with W10 SageMath notebook 9.2

and also with W10 WSL Jupyter_lab SageMath notebook 9.2.

[edited 2021/5/1 :same problem with Ubuntu 18.04.5 LTS sagemath 9.1 Jupyter notebook]

you can run this code below many times but you can't use restart the kernel and run again it seems there is a socket problem

not sure its linked to :

https://ask.sagemath.org/question/427...

or https://ask.sagemath.org/question/491... or

https://ask.sagemath.org/question/491...

so I open a new question

var('x,y,z,')
var('xLow,xUp')
var('yLow,yUp')
rNum=1

#xLow=sqrt(4*y^2/(sqrt(2) - 2) + sqrt(2)/(sqrt(2) - 2) - 2/(sqrt(2) - 2))
#xUp=y*sin(1/9*pi)/cos(1/9*pi)

#yLow=0.379024477
#yUp=0.921891033
zLow=0
zUp=sqrt(-x^2 - y^2 + 1)
zInt=integrate(1,z,zLow,zUp)
show(zInt)
yIntegr=integrate(zInt,y,yLow,yUp,algorithm="giac")
xIntegr=integrate(zInt,x,xLow,xUp,algorithm="giac")
show("yIntegr : " , yIntegr)
show("xIntegr : " , xIntegr)

below after reset:

I 10:37:27.748 LabApp] Starting buffering for 4b9b134b-d60d-461f-a4fd-1bb57203ff69:709475c8-17b7-4321-959e-b3564d837fc3
Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/ortollj/sage-9.2/local/lib/python3.8/site-packages/sage/repl/ipython_kernel/__main__.py", line 3, in <module>
    IPKernelApp.launch_instance(kernel_class=SageKernel)
  File "/home/ortollj/sage-9.2/local/lib/python3.8/site-packages/traitlets/config/application.py", line 663, in launch_instance
    app.initialize(argv)
  File "</home/ortollj/sage-9.2/local/lib/python3.8/site-packages/decorator.py:decorator-gen-124>", line 2, in initialize
  File "/home/ortollj/sage-9.2/local/lib/python3.8/site-packages/traitlets/config/application.py", line 87, in catch_config_error
    return method(app, *args, **kwargs)
  File "/home/ortollj/sage-9.2/local/lib/python3.8/site-packages/ipykernel/kernelapp.py", line 547, in initialize
    self.init_sockets()
  File "/home/ortollj/sage-9.2/local/lib/python3.8/site-packages/ipykernel/kernelapp.py", line 266, in init_sockets
    self.shell_port = self._bind_socket(self.shell_socket, self.shell_port)
  File "/home/ortollj/sage-9.2/local/lib/python3.8/site-packages/ipykernel/kernelapp.py", line 213, in _bind_socket
    return self._try_bind_socket(s, port)
  File "/home/ortollj/sage-9.2/local/lib/python3.8/site-packages/ipykernel/kernelapp.py", line 189, in _try_bind_socket
    s.bind("tcp://%s:%i" % (self.ip, port))
  File "zmq/backend/cython/socket.pyx", line 550, in zmq.backend.cython.socket.Socket.bind
  File "zmq/backend/cython/checkrc.pxd", line 26, in zmq.backend.cython.checkrc._check_rc
    raise ZMQError(errno)
zmq.error.ZMQError: Address already in use
edit retag flag offensive close merge delete

Comments

I forgot to mention the distribution used in WSL: Ubuntu 20.04.1 LTS (GNU/Linux 4.19.128-microsoft-standard x86_64)

ortollj gravatar imageortollj ( 2021-01-03 17:46:13 +0100 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2021-01-03 20:14:04 +0100

Emmanuel Charpentier gravatar image

This works under Linux; First pass :

sage: %cpaste
Pasting code; enter '--' alone on the line to stop or use Ctrl-D.
:var('x,y,z,')
:var('xLow,xUp')
:var('yLow,yUp')
:rNum=1
:
:#xLow=sqrt(4*y^2/(sqrt(2) - 2) + sqrt(2)/(sqrt(2) - 2) - 2/(sqrt(2) - 2))
:#xUp=y*sin(1/9*pi)/cos(1/9*pi)
:
:#yLow=0.379024477
:#yUp=0.921891033
:zLow=0
:zUp=sqrt(-x^2 - y^2 + 1)
:zInt=integrate(1,z,zLow,zUp)
:print(zInt)
:yIntegr=integrate(zInt,y,yLow,yUp,algorithm="giac")
:xIntegr=integrate(zInt,x,xLow,xUp,algorithm="giac")
:print("yIntegr : " , yIntegr)
:print("xIntegr : " , xIntegr)
:--
(x, y, z)
(xLow, xUp)
(yLow, yUp)
sqrt(-x^2 - y^2 + 1)
yIntegr :  1/2*x^2*arcsin(yLow/sqrt(-x^2 + 1)) - 1/2*x^2*arcsin(yUp/sqrt(-x^2 + 1)) - 1/2*sqrt(-x^2 - yLow^2 + 1)*yLow + 1/2*sqrt(-x^2 - yUp^2 + 1)*yUp - 1/2*arcsin(yLow/sqrt(-x^2 + 1)) + 1/2*arcsin(yUp/sqrt(-x^2 + 1))
xIntegr :  1/2*y^2*arcsin(xLow/sqrt(-y^2 + 1)) - 1/2*y^2*arcsin(xUp/sqrt(-y^2 + 1)) - 1/2*sqrt(-xLow^2 - y^2 + 1)*xLow + 1/2*sqrt(-xUp^2 - y^2 + 1)*xUp - 1/2*arcsin(xLow/sqrt(-y^2 + 1)) + 1/2*arcsin(xUp/sqrt(-y^2 + 1))

Second pass :

sage: reset()
sage: %cpaste
Pasting code; enter '--' alone on the line to stop or use Ctrl-D.
:var('x,y,z,')
:var('xLow,xUp')
:var('yLow,yUp')
:rNum=1
:
:#xLow=sqrt(4*y^2/(sqrt(2) - 2) + sqrt(2)/(sqrt(2) - 2) - 2/(sqrt(2) - 2))
:#xUp=y*sin(1/9*pi)/cos(1/9*pi)
:
:#yLow=0.379024477
:#yUp=0.921891033
:zLow=0
:zUp=sqrt(-x^2 - y^2 + 1)
:zInt=integrate(1,z,zLow,zUp)
:print(zInt)
:yIntegr=integrate(zInt,y,yLow,yUp,algorithm="giac")
:xIntegr=integrate(zInt,x,xLow,xUp,algorithm="giac")
:print("yIntegr : " , yIntegr)
:print("xIntegr : " , xIntegr)
:--
(x, y, z)
(xLow, xUp)
(yLow, yUp)
sqrt(-x^2 - y^2 + 1)
yIntegr :  1/2*x^2*arcsin(yLow/sqrt(-x^2 + 1)) - 1/2*x^2*arcsin(yUp/sqrt(-x^2 + 1)) - 1/2*sqrt(-x^2 - yLow^2 + 1)*yLow + 1/2*sqrt(-x^2 - yUp^2 + 1)*yUp - 1/2*arcsin(yLow/sqrt(-x^2 + 1)) + 1/2*arcsin(yUp/sqrt(-x^2 + 1))
xIntegr :  1/2*y^2*arcsin(xLow/sqrt(-y^2 + 1)) - 1/2*y^2*arcsin(xUp/sqrt(-y^2 + 1)) - 1/2*sqrt(-xLow^2 - y^2 + 1)*xLow + 1/2*sqrt(-xUp^2 - y^2 + 1)*xUp - 1/2*arcsin(xLow/sqrt(-y^2 + 1)) + 1/2*arcsin(xUp/sqrt(-y^2 + 1))

This may be Windows (and Cygwin)-specific. You should open an issue on its Github page.

edit flag offensive delete link more

Comments

I disagree I get the same problem with Ubuntu 18.04.5 LTS sagemath 9.1 Jupyter notebook:

File "/home/ortollj/Downloads/SageMath/local/lib/python3.7/site-packages/ipykernel/kernelapp.py", line 238, in init_sockets self.shell_port = self._bind_socket(self.shell_socket, self.shell_port) File "/home/ortollj/Downloads/SageMath/local/lib/python3.7/site-packages/ipykernel/kernelapp.py", line 180, in _bind_socket s.bind("tcp://%s:%i" % (self.ip, port)) File "zmq/backend/cython/socket.pyx", line 550, in zmq.backend.cython.socket.Socket.bind File "zmq/backend/cython/checkrc.pxd", line 26, in zmq.backend.cython.checkrc._check_rc raise ZMQError(errno) zmq.error.ZMQError: Address already in use [W 10:34:01.054 NotebookApp] KernelRestarter: restart failed [W 10:34:01.055 Noteboo

ortollj gravatar imageortollj ( 2021-01-04 10:42:32 +0100 )edit

maybe a pb with Jupyter notebook and Giac ?

ortollj gravatar imageortollj ( 2021-01-04 10:51:20 +0100 )edit

I tried to report this bug on the Giac Forum but I gave up because of their too complicated registration procedure !

ortollj gravatar imageortollj ( 2021-01-05 08:15:01 +0100 )edit

I report this on Jupyter Community forum

ortollj gravatar imageortollj ( 2021-01-05 09:16:37 +0100 )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: 2021-01-03 11:19:39 +0100

Seen: 579 times

Last updated: Jan 05 '21