
From:  Doug Stewart 
Subject:  Re: use solution of solve (symbolic) 
Date:  Wed, 27 Mar 2019 17:21:28 0400 
Hello,
I must me missing something obvious, but can't find a simple solution:
I have two symbolic variables (a,b) and two other variables depending on
them (dbl_a, dbl_b).
I solve two equations, which I can solve for a and b.
How do I "substitute" those solutions into the depending variables, so I can
see what their values are?
pkg load symbolic
syms a b
dbl_a=2*a
dbl_b=2*b
eq1=dbl_a==9
eq2=dbl_b==10
solution=solve([eq1 eq2],[a b])
a=solution.a
b=solution.b
vpa(dbl_a)
vpa(dbl_b)
When I run this, I get:
a = (sym) 9/2
b = (sym) 5
ans = (sym) 2.0*a
ans = (sym) 2.0*b
But I need the last two lines to return "9" and "10", to inspect the values.
I allready tried to use "subs", without succes....
Of course, I can change the last two lines to "vpa(dbl_a=2*a)" and
"vpa(dbl_b=2*b)", but actually my calculations and equations are a lot more
complex, this is a MWE
Many thanks for any help,
Stef

Sent from: http://octave.1599824.n4.nabble.com/OctaveGeneralf1599825.html
[Prev in Thread]  Current Thread  [Next in Thread] 