|Subject:||Re: Symbolica package warning: Using rat() heuristics for double-precision input (is this what you wanted?)|
|Date:||Fri, 17 Feb 2017 09:27:51 -0500|
SThanks, I will try that.So, I guess I'm looking for an option to subs or vpa that basically says "just use this value however you see fit and keep quiet about it".I'm not really bothered. The value given is just an example. In my production code I have a section before the symbolic stuff where some values are worked out and stored as doubles. I then want to use these in place of that value. I don't care whether they use the exact value or an approximation. I just want it to use whatever and do so without a warning."I guess the warning is caused by your numeric literal 3.141592654 in the code."Yes, indeed it is. If I use, say, 0 instead, then there is no warning.
"Do you want to use the exact decimal value 3.141592654 or do you want to use an approximation?"
"You can get the desired warning id with the lastwarn function (use it with 2 output arguments)."On 17 February 2017 at 11:28, Oliver Heimlich <address@hidden> wrote:I guess the warning is caused by your numeric literal 3.141592654 in the code.Am 17. Februar 2017 12:00:50 MEZ schrieb Stephen Biggs <address@hidden>:
>I am using the symbolic package (so include `pkg load symbolic` before
>following commands if necessary). If I run:
> syms x
> fsym = x * cos(x)
> fsymder = diff(fsym)
> vpa(subs(fsymder, x, 3.141592654), 8)
>Then I get the following:
> warning: Using rat() heuristics for double-precision input (is this
>what you wanted?)
> warning: called from
> sym at line 256 column 9
> subs at line 118 column 7
> ans = (sym) -1.0000000
>So the answer is correct but there is that warning about rat()
>How can I fix it so that the warning is not given. NB: I would rather
>**fix** the code so that the warning is not raised rather than just
>supressing the warning with `warning('off', '<warning_id>')`. However,
>the former is not possible, then I will accept the latter but I need to
>know the warning ID.
In Octave this would normally result in an approximation of this value in double precision. However, the symbolic package detects this and suggests that you should explicitly create a symbolic value for 3.141592654 with the desired conversion semantics that you intend. Do you want to use the exact decimal value 3.141592654 or do you want to use an approximation?
You can get the desired warning id with the lastwarn function (use it with 2 output arguments).
Help-octave mailing list
|[Prev in Thread]||Current Thread||[Next in Thread]|