Search code examples
octave

Using vpasolve to find multiple solutions


I'm using GNU octave and the symbolic package there to solve numerical solutions. This is one of my sample session:

octave> pkg load symbolic
octave> syms x
octave> vpasolve(x^2 == 1)
ans = (sym) 1.0000000000000000000000000000000

What I'm expecting is a solution containing the answer both 1 and -1. How can I achieve that ?


Solution

  • Seems I have been using a wrong function. Using solve function fixes it for me:

    octave > pkg load symbolic
    octave > syms x
    octave > solve(x^2 == 1, x)
    
    : octave> ans = (sym 2×1 matrix)
    : 
    :   ⎡-1⎤
    :   ⎢  ⎥
    :   ⎣1 ⎦