Effacer les filtres
Effacer les filtres

How to access the values of sym?

2 vues (au cours des 30 derniers jours)
Kalasagarreddi Kottakota
Kalasagarreddi Kottakota le 16 Jan 2023
Réponse apportée : Paul le 16 Jan 2023
I am trying to solve an inequlaity using feval and the function return the limits in variable sym. May I know how to access the limits of values in sym?
syms b
a = 1;
feval(symengine, 'solve', (1-sqrt(5))*a^2 < b < (1+sqrt(5))*a^2)

Réponses (1)

Paul
Paul le 16 Jan 2023
Not sure why feval is used. Just using solve with ReturnConditions solves for the range of b that satisfies both inequalities.
syms b
a = 1;
eq1 = (1-sqrt(5))*a^2 < b;
eq2 = b < (1+sqrt(5))*a^2;
sol = solve([eq1;eq2],b,'ReturnConditions',true)
sol = struct with fields:
b: x parameters: x conditions: -347922205179541/281474976710656 < x & x < 910872158600853/281474976710656

Catégories

En savoir plus sur Function Creation dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by