help-octave
[Top][All Lists]

## Re: Symbolica package warning: Using rat() heuristics for double-precisi

 From: Doug Stewart Subject: Re: Symbolica package warning: Using rat() heuristics for double-precision input (is this what you wanted?) Date: Fri, 17 Feb 2017 10:48:03 -0500

On Fri, Feb 17, 2017 at 6:00 AM, Stephen Biggs wrote:
Hi,

I am using the symbolic package (so include `pkg load symbolic` before the 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() heuristics. 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, if the former is not possible, then I will accept the latter but I need to know the warning ID.

Many thanks,
Steve

I am thinking of putting this on the wiki.

## Demo of how to use a number (which was calculated in octave
## variables) in a symbolic calculation.

## use octave to calculate some number:
a=pi/2

## now do some work with the symbolic pkg
syms x
f = x * cos(x)
df = diff(fsym)

## Next get the number into a symbolic variable
## convert to string first
aa=mat2str(a)
## and now to a symbolic variable.
ww=sym(aa)
## and now use it
vpa(subs(df, x, ww), 28)