OK, many thanks. What I need is the second solution (indeed for interactive usage), to do similar things as easily achievable in Matlab.

The first solution is too tedious for my goals, my original solution (using copy-paste) is quicker .... But I agree, for programming purposes the first approach is more logical.

Any idea when the first solution wiil be available? I would like to apply this for my students next academic year (september?)

Stef

-----Oorspronkelijk bericht-----

Van: Help-octave <help-octave-bounces+stef.pillaert=

[hidden email]> Namens Colin Macdonald

Verzonden: woensdag 27 maart 2019 23:52

Aan:

[hidden email]
Onderwerp: Re: use solution of solve (symbolic)

On 2019-03-27 6:21 p.m., Doug Stewart wrote:

> here is one way

>

> solution=solve([eq1 eq2],[a b])

> a1=solution.a

> b1=solution.b

> double(subs(dbl_a,a,a1))

> double(subs(dbl_b,b,b1))

I agree with Doug.

In the *next* version of Symbolic (2.8.0, not out yet) you will also be able to use subs and/or eval to shortcut this a little bit:

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

eval(dbl_a)

eval(dbl_b)

The eval command will search your workspace for variables whose names match the symbols a and b.

Note: IMHO, this sort of thing might be nice for interactive command-line usage, but Doug's approach is better for code.

Colin