Kernel: Octave
Octave 7.1.0 on CoCalc Ubuntu 20.04
In [1]:
Out[1]:
warning: using the gnuplot graphics toolkit is discouraged
The gnuplot graphics toolkit is not actively maintained and has a number
of limitations that are unlikely to be fixed. Communication with gnuplot
uses a one-directional pipe and limited information is passed back to the
Octave interpreter so most changes made interactively in the plot window
will not be reflected in the graphics properties managed by Octave. For
example, if the plot window is closed with a mouse click, Octave will not
be notified and will not update its internal list of open figure windows.
The qt toolkit is recommended instead.
error: the import function is not yet implemented in Octave
error: called from
import at line 63 column 3
x =
1 2 3 4 5 6 7 8 9
y1 =
1 3 5 3 1 3 5 3 1
y2 =
2 4 6 4 2 4 6 4 2
error: 'plt' undefined near line 1, column 1
error: 'plt' undefined near line 1, column 1
error: 'plt' undefined near line 1, column 1
error: 'plt' undefined near line 1, column 1
error: 'plt' undefined near line 1, column 1
error: 'plt' undefined near line 1, column 1
error: 'plt' undefined near line 1, column 1
error: 'plt' undefined near line 1, column 1
In [1]:
Out[1]:
warning: using the gnuplot graphics toolkit is discouraged
The gnuplot graphics toolkit is not actively maintained and has a number
of limitations that are unlikely to be fixed. Communication with gnuplot
uses a one-directional pipe and limited information is passed back to the
Octave interpreter so most changes made interactively in the plot window
will not be reflected in the graphics properties managed by Octave. For
example, if the plot window is closed with a mouse click, Octave will not
be notified and will not update its internal list of open figure windows.
The qt toolkit is recommended instead.
ans = 7.1.0
In [2]:
In [3]:
In [4]:
In [5]:
Out[5]:
ans = 46
In [6]:
Out[6]:
ans =
8 6 -2
12 9 -3
16 12 -4
In [7]:
Out[7]:
x =
0.8138 0.2395 0.1643
0.8725 0.2436 0.1806
0.6201 0.2097 0.1537
In [8]:
In [9]:
Out[9]:
In [10]:
Out[10]:
In [11]:
Out[11]:
Symbolic pkg v2.9.0: /usr/local/lib/python3.8/dist-packages/sympy/__init__.py:672: SymPyDeprecationWarning:
importing sympy.core.compatibility with 'from sympy import *' has been
deprecated since SymPy 1.6. Use import sympy.core.compatibility
instead. See https://github.com/sympy/sympy/issues/18245 for more
info.
self.Warn(
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 12, in octoutput_drv
File "<stdin>", line 54, in octoutput
File "<stdin>", line 55, in octoutput
File "/usr/local/lib/python3.8/dist-packages/sympy/__init__.py", line 677, in __getattr__
return getattr(self.mod, name)
AttributeError: module 'sympy.core.compatibility' has no attribute 'integer_types'
Waiting................warning: readblock: timeout of 30 exceeded, breaking out
warning: called from
readblock at line 101 column 7
python_ipc_popen2 at line 99 column 16
python_ipc_driver at line 62 column 15
pycall_sympy__ at line 163 column 11
valid_sym_assumptions at line 38 column 10
assumptions at line 82 column 7
syms at line 97 column 13
no output so far
error: ipc_popen2: something wrong? timed out starting python
error: called from
python_ipc_popen2 at line 101 column 7
python_ipc_driver at line 62 column 15
pycall_sympy__ at line 163 column 11
valid_sym_assumptions at line 38 column 10
assumptions at line 82 column 7
syms at line 97 column 13
error: diff: order K must be a scalar or []
In [12]:
Out[12]:
/usr/local/lib/python3.8/dist-packages/sympy/__init__.py:672: SymPyDeprecationWarning:
importing sympy.core.compatibility with 'from sympy import *' has been
deprecated since SymPy 1.6. Use import sympy.core.compatibility
instead. See https://github.com/sympy/sympy/issues/18245 for more
info.
self.Warn(
Traceback (most recent call last):
File "<stdin>", line 4, in <module>
File "<stdin>", line 12, in octoutput_drv
File "<stdin>", line 55, in octoutput
File "/usr/local/lib/python3.8/dist-packages/sympy/__init__.py", line 677, in __getattr__
return getattr(self.mod, name)
AttributeError: module 'sympy.core.compatibility' has no attribute 'integer_types'
error: Python exception: AttributeError: module 'sympy.core.compatibility' has no attribute 'integer_types'
occurred while copying variables to Python.
Try "sympref reset" and repeat your command?
(consider filing an issue at https://github.com/cbm755/octsympy/issues)
error: called from
pycall_sympy__ at line 191 column 5
valid_sym_assumptions at line 38 column 10
assumptions at line 82 column 7
syms at line 97 column 13
f =
2.9837 2.4703 2.3462
2.9776 2.4955 2.3597
2.9693 2.3961 2.2882
error: diff: order K must be a scalar or []
In [13]:
Out[13]:
warning: non-integer range used as index
error: f(-10): subscripts must be either integers 1 to (2^63)-1 or logicals
In [14]:
In [15]:
Out[15]:
ans = 46.021
This plot shows the famous 3D sombrero.
A quadratic meshgrid of and coordinates is evaluated via and the value is then the value plotted along the third dimension.
Reference: 3d plots
In [16]:
Out[16]:
In [17]:
Out[17]:
In [0]:
This draws the set of points, where the given equation is satisfied. Here, it shows a tilted ellipse.
Reference: ezplot
In [18]:
Out[18]:
Imagine you want to evaluate a binary function .
For evaluating it in vectorized notation, you need a grid for the cartesian product of all and .
In [19]:
Out[19]:
ans =
0 1 2 3
2 3 4 5
4 5 6 7
6 7 8 9
8 9 10 11
dsolve and sympy in symbolic
In [20]:
Out[20]:
Traceback (most recent call last):
File "<stdin>", line 4, in <module>
File "<stdin>", line 12, in octoutput_drv
File "<stdin>", line 55, in octoutput
File "/usr/local/lib/python3.8/dist-packages/sympy/__init__.py", line 677, in __getattr__
return getattr(self.mod, name)
AttributeError: module 'sympy.core.compatibility' has no attribute 'integer_types'
error: Python exception: AttributeError: module 'sympy.core.compatibility' has no attribute 'integer_types'
occurred while copying variables to Python.
Try "sympref reset" and repeat your command?
(consider filing an issue at https://github.com/cbm755/octsympy/issues)
error: called from
pycall_sympy__ at line 191 column 5
valid_sym_assumptions at line 38 column 10
assumptions at line 82 column 7
syms at line 97 column 13
error: 'dsolve' undefined near line 1, column 1
'dsolve' is a method of class 'sym'; it must be called with a 'sym'
argument (see 'help @sym/dsolve').
Please read <https://www.octave.org/missing.html> to learn how you can
contribute missing functionality.
Octave's ODE PKG in Action
In [21]:
In [22]:
Out[22]:
In [0]:
In [0]:
You can run numerical optimizations via the optim package.
In this example we minimize the classical Rosenbrock function in 20 dimensions using BFGS.
In [23]:
Out[23]:
Picked up _JAVA_OPTIONS: -Djava.io.tmpdir=/home/user/tmp -Xms64m
------------------------------------------------
bfgsmin final results: 65 iterations
function value: 2.17563e-16
STRONG CONVERGENCE
Function conv 1 Param conv 1 Gradient conv 1
used numeric gradient
param gradient (n) change
0.00000 0.00000 -0.00000
0.05000 -0.00000 0.00000
0.10000 0.00000 0.00000
0.15000 -0.00000 0.00000
0.20000 -0.00000 0.00000
0.25000 0.00000 0.00000
0.30000 -0.00000 0.00000
0.35000 -0.00000 0.00000
0.40000 -0.00000 0.00000
0.45000 0.00000 -0.00000
0.50000 0.00000 -0.00000
0.55000 -0.00000 0.00000
0.60000 0.00000 -0.00000
0.65000 0.00000 -0.00000
0.70000 -0.00000 0.00000
0.75000 -0.00000 0.00000
0.80000 0.00000 0.00000
0.85000 0.00000 0.00000
0.90000 0.00000 0.00000
0.95000 -0.00000 0.00000
1.00000 0.00000 0.00000
testing java support
In [24]:
Out[24]:
ans = 1
In [25]:
Out[25]:
STATIC JAVA PATH
- empty -
DYNAMIC JAVA PATH
- empty -
In [26]:
In [27]:
Out[27]:
ans = 1
ans = 1.000999999999999889865875957184471189975738525390625
In [28]:
Out[28]:
ans = 2.001999999999999779731751914368942379951477050781250
In [29]:
Out[29]:
ans =
3 4 5
In [30]:
Out[30]:
ans =
-0.942697 -0.918958 -0.773994 1.525281 -0.293934
0.785315 -0.110466 -1.004230 -1.230870 1.671303
0.715892 -1.477990 0.655675 0.209721 0.857702
1.417878 0.381071 0.755058 -0.022367 0.528578
0.345888 1.377642 0.830293 0.158387 -0.840260
In [31]:
Out[31]:
ans =
<Java object: java.math.BigInteger>
In [32]:
Out[32]:
Restarting kernel...
Done!
[Errno 9] Bad file descriptor
In [0]:
In [0]:
In [0]: