What is the recommended way to handle Octave functions with multiple
return values in Sage?
Like Magma, Octave functions can return multiple values. Working with
such Magma functions is documented in the Sage documentation (http://
modular.math.washington.edu/sage/doc/html/ref/node125.html), but I
cannot find similar documentation for Octave.
Here is how it works in Octave -- foo is a function that returns two
values:
octave:4> function [a b] = foo() a=1; b=2; endfunction
octave:5> foo()
ans = 1
octave:6> [c,d] = foo()
c = 1
d = 2
This code transliterated into Sage is shown below. What is the
correct way to do this?
----------------------------------------------------------------------
| SAGE Version 2.10.3, Release Date: 2008-03-11 |
| Type notebook() for the GUI, and license() for information. |
----------------------------------------------------------------------
sage: octave.eval("function [a b] = foo() a=1; b=2; endfunction")
''
sage: octave.foo()
1
sage: [c, d] = octave.foo()
---------------------------------------------------------------------------
<type 'exceptions.NotImplementedError'> Traceback (most recent call
last)
/home/login/<ipython console> in <module>()
/usr/local/sage/local/lib/python2.5/site-packages/sage/interfaces/
expect.py in __iter__(self)
1013
1014 def __iter__(self):
-> 1015 for i in range(1, len(self)+1):
1016 yield self[i]
1017
/usr/local/sage/local/lib/python2.5/site-packages/sage/interfaces/
expect.py in __len__(self)
1017
1018 def __len__(self):
-> 1019 raise NotImplementedError
1020
1021 def __reduce__(self):
<type 'exceptions.NotImplementedError'>:
sage:
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---