help-octave
[Top][All Lists]
Advanced

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

Re: Octave Symbolic package: assign `nan` to symfun


From: Nicholas Jankowski
Subject: Re: Octave Symbolic package: assign `nan` to symfun
Date: Mon, 6 Feb 2017 10:17:46 -0500

On Mon, Feb 6, 2017 at 8:59 AM, NVS Abhilash <address@hidden> wrote:
> I am using the symbolic package, I have installed `2.5.0` from the source
> [1]. I get this error in Octave 4.3.0+
>
> ```
> syms x;
> f(x) = nan
> error: subscript indices must be integers or boolean
> error: called from
>     subsindex at line 64 column 5
>
> ```
>
> I am a bit confused. Is this expected?
> But if I do
> ```
> syms x;
> f(x) = nan + x
> f(x) = (symfun) nan
> ```
>
> Maybe Octave cannot identify `f(x) = nan` to be a symfun. But it gets to
> know that when we do `f(x) = nan + x` because x is a symbol.
>
> Is it a bug, or is it expected?

Whether or not it's expected, this is 'compatible' behavior.  In Matlab 2016b:

>> syms x
>> f(x) = nan
Error using sym/subsindex (line 769)
Invalid indexing or function definition. When defining a function,
ensure that the arguments are symbolic variables and the body of the
function is a SYM expression. When indexing, the input must be
numeric, logical, or ':'.

>> syms x
>> f(x) = nan + x

f(x) =

NaN



reply via email to

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