simplifying an algebraic expression in two variables
9 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Danny Van Elsen
am 9 Feb. 2020
Beantwortet: Tanmay Das
am 6 Aug. 2021
hello
I know that
sqrt ((x-1)^2 + (y-2)^2) + sqrt ((x+1)^2 + (y+2)^2) = 6
and
8*(x^2) - 4*x*y + 5*(y^2) = 36
are equivalent, but is there a way of having matlab deduce the second statement from the first?
regards, Danny.
0 Kommentare
Akzeptierte Antwort
Tanmay Das
am 6 Aug. 2021
The following code may solve your problem:
clc;
clear ;
close all;
syms x y;
eqn = sqrt ((x-1)^2 + (y-2)^2) + sqrt ((x+1)^2 + (y+2)^2) == 6;
eqn1 = simplify(eqn^2);
eqn2 = expand(eqn1);
eqn3 = simplify(eqn2);
%As of now, MATLAB is not able to simplify expressions inside squre root by
%itself, so one needs to isolate it and then square both side
eqn4 = (x^2 - 2*x + y^2 - 4*y + 5)^(1/2)*(x^2 + 2*x + y^2 + 4*y + 5)^(1/2);
%isolating the square root term from rest of the equation
eqn5 = isolate(eqn3,eqn4);
%simplifying the equation
eqn6 = simplify(expand(eqn5^2));
%One can also solve the equation by executing the following line
sol = solve(eqn6,'ReturnConditions',true);
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Linear Algebra finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!