On Mar 24, 4:26 pm, Michael <[EMAIL PROTECTED]> wrote:
> 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?
I am not sure, but we currently do not test the Octave interface
regularly since it is optional. What we need is to extend the optional
doctest framework to recognize when a given optional package is
installed and then test that code. It is very likely that I will run "-
long -optional" in the future instead of "-optional" now.
To get back to your original problem: We need more Octave users that
report issues with the current interface. That might be a little
painful in the short term, but in the long term the result should be
much better.
Cheers,
Michael
>
> ----------------------------------------------------------------------
> | 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 sage-support@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---