help-octave
[Top][All Lists]

## Re: Error when using symbolic two solve for function given two points

 From: Doug Stewart Subject: Re: Error when using symbolic two solve for function given two points Date: Thu, 13 Jul 2017 10:41:23 -0400

On Wed, Jul 12, 2017 at 2:51 PM, RT wrote:
syms a b

assume(a, 'positive')
assume(b, 'positive')
pt1=[0,3591]  %could place all pts in one array
pt2=[66342,.01]

x1=pt1(1,1);y1=pt1(1,2)
x2=pt2(1,1);y2=pt2(1,2)

sol = solve (y1==a*b^x1, y2==a*b^x2, a, b); %creates a structure
a_val=double(sol.a) %converts structure to double
b_val=double(sol.b)

The error I get is:

warning: Using rat() heuristics for double-precision input (is this what you wanted?)
warning: called from
sym at line 221 column 7
binop_helper at line 54 column 5
ineq_helper at line 35 column 5
eq at line 53 column 5
test_symbolic at line 28 column 5
Waiting.....................

I tried it with geogebra and it came back with an answer and a plot is this a bug?
http://storage2.static.itmages.com/i/17/0712/h_1499885162_7988333_4ba02e452b.png

I'm using symbolic 2.2.4 and Ubuntu 16.04 64bit Octave 4.0

the symbolic pkg seems to have problems solving this problem, But you don't need the symbolic
pkg for this problem. I changed some of your numbers.

syms a b

assume(a, 'positive')
assume(b, 'positive')
pt1=[0.001,3591]  %could place all pts in one array
pt2=[.01,66342]

x1=pt1(1,1);y1=pt1(1,2);
x2=pt2(1,1);y2=pt2(1,2);

bb=(y2/y1)^(1/(x2-x1));
aa=y2/(bb^x2);
sola=solve(y2==a*bb^x2,a)
a1=double(sola)
aa
bb