Convert symbolic answer to double gives me an error

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
RT
Reply | Threaded
Open this post in threaded view
|

Convert symbolic answer to double gives me an error

RT
I can get the answer using symbolic package in octave but when I go to convert them back to doubles I get an error see code and error below.  (Thanks to Mike Miller for getting me this far)

pkg load symbolic
syms a b

assume(a, 'positive')
assume(b, 'positive')
x1=2;y1=12;
x2=8;y2=768;
sol = solve (y1==a*b^x1, y2==a*b^x2, a, b)
a_val=double(a)
b_val=double(b)

I get an error
error: cannot convert to double
error: called from
    double at line 126 column 7
    test_symbolic at line 12 column 6

I'm use Octave 4.0 Ubuntu 16.04 64bit
symbolic *|   2.2.4 | /usr/share/octave/packages/symbolic-2.2.4  (from Ubuntu repos)


_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Convert symbolic answer to double gives me an error

Mike Miller-4
On Tue, Jul 11, 2017 at 20:43:27 -0400, RT wrote:

> I can get the answer using symbolic package in octave but when I go to
> convert them back to doubles I get an error see code and error below.
> (Thanks to Mike Miller for getting me this far)
>
> pkg load symbolic
> syms a b
>
> assume(a, 'positive')
> assume(b, 'positive')
> x1=2;y1=12;
> x2=8;y2=768;
> sol = solve (y1==a*b^x1, y2==a*b^x2, a, b)
> a_val=double(a)
> b_val=double(b)
>
> I get an error
> error: cannot convert to double
> error: called from
>     double at line 126 column 7
>     test_symbolic at line 12 column 6

I think you want

    a_val = double (sol.a)
    b_val = double (sol.b)

right?

--
mike

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave