i cannot find all x values from abs(x) using solve() function
Mostra commenti meno recenti
syms x
y=abs(x);
r=solve(y==1,x);
ans=
r = 1
but x can be 1 as well as -1,why doesnt they show -1 as well
Risposte (1)
Tell solve to show you the parameterized solution and the conditions that those parameters need to satisfy in order for the parameterized solution to be valid.
syms x
y=abs(x);
r=solve(y==1,x, 'ReturnConditions', true)
x isn't the set [1, -1]. But that's because there are complex solutions.
yy = exp(1i/2) % This is r.x with parameter y = 1/4
abs(yy)
Or if you only want real solutions tell solve that:
r=solve(y==1,x, 'ReturnConditions', true, 'Real', true)
r.x
1 Commento
VISHNU PADMAKUMAR
il 4 Ott 2021
Categorie
Scopri di più su Number Theory in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!