help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Taylor expansion does not expand well


From: Nicholas Jankowski
Subject: Re: Taylor expansion does not expand well
Date: Thu, 10 Dec 2015 17:12:07 -0500

On Thu, Dec 10, 2015 at 4:15 PM, James Sherman Jr. <address@hidden> wrote:
On Thu, Dec 10, 2015 at 4:06 PM, Nicholas Jankowski <address@hidden> wrote:
> On Thu, Dec 10, 2015 at 3:42 PM, Nicholas Jankowski <address@hidden>
> wrote:
>>
>> On Thu, Dec 10, 2015 at 2:08 PM, James Sherman Jr. <address@hidden>
>> wrote:
>>>
>>> On Thu, Dec 10, 2015 at 12:36 PM, Nicholas Jankowski
>>> <address@hidden> wrote:
>>> > On Thu, Dec 10, 2015 at 12:05 PM, Andy Buckle <address@hidden>
>>> > wrote:
>>> >>
>>> >>
>>> >>
>>> >> On 10 December 2015 at 16:56, Jonathan Camilleri
>>> >> <address@hidden>
>>> >> wrote:
>>> >>>
>>> >>> How does this work please?
>>> >>>
>>> >>> f=[1,3,3]
>>> >>> f =
>>> >>>
>>> >>>    1   3   3
>>> >>>
>>> >>> octave:2> g = taylor(1,'expansionPoint',1,'order',4)
>>> >>>
>>> >>> Error:
>>> >>> error: 'taylor' undefined near line 1 column 5
>>> >>>
>>> >>> What does this error mean please?
>>> >>>
>>> >>>
>>> >>> I am using http://octave-online.net/.
>>> >>>
>>> >>> See post at
>>> >>>
>>> >>> http://math.stackexchange.com/questions/209320/where-do-the-factorials-come-from-in-the-taylor-series.
>>> >>> See https://en.wikipedia.org/wiki/Taylor_series.
>>> >>> Documentation at
>>> >>> http://octave.sourceforge.net/symbolic/function/@sym/taylor.html
>>> >>> would be
>>> >>> helpful if it included more clear examples, preferably ones which are
>>> >>> complete.
>>> >>>
>>> >>> You may use data sets to include tutorials if you wish, as I fail to
>>> >>> see
>>> >>> a complete implementation in place.
>>> >>>
>>> >>
>>> >> "'taylor' undefined" means it can't find the function, taylor. Do you
>>> >> have
>>> >> the symbolic package installed and loaded?
>>> >>
>>> >> If you do
>>> >>
>>> >> pkg list
>>> >>
>>> >> do you see a star next to symbolic?
>>> >>
>>> >>
>>> >>
>>> >> --
>>> >> /* andy buckle */
>>> >>
>>> >> _______________________________________________
>>> >> Help-octave mailing list
>>> >> address@hidden
>>> >> https://lists.gnu.org/mailman/listinfo/help-octave
>>> >>
>>> >
>>> > I just checked out octave-online.net, and symbolic 2.1.0 should be
>>> > installed
>>> > and loaded by default. (list below).  I'm running a newer version
>>> > (2,2,2).
>>> > Jon, it is part of the symbolic package, and for it to work you have to
>>> > call
>>> > it with symbolically declared variables.  (try: help sym)
>>> >
>>> > Depending on how I try to call taylor, I get the same response. I'm not
>>> > sure
>>> > what the expected behavior is:
>>> >
>>> >>> a = sym('a')
>>> > a = (sym) a
>>> >
>>> > taylor(a)
>>> > a = (sym) a
>>> >
>>> >>> taylor(sin(a))
>>> > ans = (sym)
>>> >
>>> >     5    3
>>> >    a    a
>>> >   --- - -- + a
>>> >   120   6
>>> >
>>> > Alll good.
>>> >
>>> > now, calling with a nonsymbolically defined argument:
>>> >
>>> >>> b = [1:10];
>>> >>> taylor(sin(b))
>>> > error: 'taylor' undefined near line 1 column 1
>>> >
>>> > Seems like it should give a better answer than that, as this seems like
>>> > it
>>> > can't find taylor, when it's just called incorrectly. does that have
>>> > something to do with how the interpreter looks for the package
>>> > function?
>>> >
>>> > What's more, trying the same on octave-online.net:
>>> >
>>> > octave:10> a=sym ('a')
>>> > a = (sym) a
>>> >
>>> > octave:11> taylor(a)
>>> > error: structure has no member '
>>> > '
>>> > error: called from:
>>> > error:   /usr/local/share/octave/packages/symbolic-2.1.0/@sym/symvar.m
>>> > at
>>> > line 98, column 14
>>> > error:   /usr/local/share/octave/packages/symbolic-2.1.0/@sym/taylor.m
>>> > at
>>> > line 46, column 7
>>> >
>>> >
>>> > Is this just a 2.1.0 bug?
>>> >
>>> > octave:2> pkg list
>>> >
>>> >  Package Name         | Version | Installation directory
>>> > ---------------------+---------+-----------------------
>>> >      communications *|   1.2.0 |
>>> > .../share/octave/packages/communications-1.2.0
>>> >             control *|   2.6.6 |
>>> > /usr/local/share/octave/packages/control-2.6.6
>>> >        econometrics *|   1.1.1 |
>>> > .../share/octave/packages/econometrics-1.1.1
>>> >           financial *|   0.4.0 |
>>> > .../local/share/octave/packages/financial-0.4.0
>>> > fuzzy-logic-toolkit *|   0.4.4 |
>>> > .../octave/packages/fuzzy-logic-toolkit-0.4.4
>>> >             general *|   1.3.4 |
>>> > /usr/local/share/octave/packages/general-1.3.4
>>> >            geometry *|   1.7.0 |
>>> > /usr/local/share/octave/packages/geometry-1.7.0
>>> >                  io *|   2.2.7 |
>>> > /usr/local/share/octave/packages/io-2.2.7
>>> >      linear-algebra *|   2.2.1 |
>>> > .../share/octave/packages/linear-algebra-2.2.1
>>> >           mechanics *|   1.3.1 |
>>> > .../local/share/octave/packages/mechanics-1.3.1
>>> >       miscellaneous *|   1.2.1 |
>>> > .../share/octave/packages/miscellaneous-1.2.1
>>> >                 nan  |   2.7.1 |
>>> > /usr/local/share/octave/packages/nan-2.7.1
>>> >              odepkg *|   0.8.4 |
>>> > /usr/local/share/octave/packages/odepkg-0.8.4
>>> >               optim *|   1.4.1 |
>>> > /usr/local/share/octave/packages/optim-1.4.1
>>> >         optiminterp *|   0.3.4 |
>>> > .../share/octave/packages/optiminterp-0.3.4
>>> >            parallel *|   2.2.0 |
>>> > /usr/local/share/octave/packages/parallel-2.2.0
>>> >              signal *|   1.3.0 |
>>> > /usr/local/share/octave/packages/signal-1.3.0
>>> >             splines *|   1.2.7 |
>>> > /usr/local/share/octave/packages/splines-1.2.7
>>> >          statistics *|   1.2.4 |
>>> > .../share/octave/packages/statistics-1.2.4
>>> >             strings *|   1.1.0 |
>>> > /usr/local/share/octave/packages/strings-1.1.0
>>> >              struct *|  1.0.10 |
>>> > /usr/local/share/octave/packages/struct-1.0.10
>>> >            symbolic *|   2.1.0 |
>>> > /usr/local/share/octave/packages/symbolic-2.1.0
>>> >
>>> >
>>> >
>>> >
>>> >
>>> > _______________________________________________
>>> > Help-octave mailing list
>>> > address@hidden
>>> > https://lists.gnu.org/mailman/listinfo/help-octave
>>> >
>>>
>>> Just to compare this to current MATLAB behavior, if you try and call
>>> taylor with a matrix of doubles, you get the following error message:
>>>
>>> > Undefined function 'taylor' for input arguments of type 'double'.
>>>
>>> So, I guess its slightly better error message, since you might be able
>>> to deduce from there that you're calling it incorrectly.
>>
>>
>>
>> Is this the expected/preferred behavior for this function? Can create a
>> bug report for either a 'correct' error message or at least 'improved
>> message requested'
>>
>
> my entirely fallible Google-fu failed to find a related bug report. Created
> one here: https://savannah.gnu.org/bugs/?46662

I guess my question would be, do you want an (I apologize for my lack
of knowledge in this area) an "Octave-level" type of solution where
octave would generate the error because there is no such thing as a
taylor function for non-symbolic variables, or would you just want
error message within the function "taylor" to do something like:

if ~issymbolic(inputs)
  error('inputs to taylor must be symbolic');


isn't there a standard error message:

'function' is not defined for input type 'foo'

I'd assume that's something to do with 'function' doing class-checks on the input. In this case, is that the problem? what is setting off the "'taylor' is undefined" error that makes it appear identical to when the function is not actually defined?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]