How to solve the equation of this identity to obtain the specific values of coefficients A, B, and C?

1 view (last 30 days)
% Clear all variables
clear all;
close all;
clc;
% Define symbolic variables
syms x y k m A B C x0 y0 a b ln;
% Define the line equation
line = y == k*x + m;
% Define the equation eq
eq = A*((y - y0)/(x - x0))^2 + B*((y - y0)/(x - x0)) + C == 0;
% Define the line l1
l1 = y - y0 == k*(x - x0) + m - y0 + k*x0;
% Define the line l2
l2 = (y - y0 - k*(x - x0))/(m - y0 + k*x0) == 1;
% Extract the left - hand side of l2
ln = lhs(l2);
% Define the left - hand side and right - hand side of the equation
leftSide = A*((y - y0)/(x - x0))^2 + B*((y - y0)/(x - x0)) + C;
rightSide = (((x - x0 + x0*ln)^2/a^2 + (y - y0 + y0*ln)^2/b^2 - (ln)^2)/(x - x0)^2);
% Solve the identity equation
sol = solve(leftSide == rightSide, [A, B, C], 'ReturnConditions', true);
% Display the result
disp('Result of solving the identity equation:');
Result of solving the identity equation:
disp(sol);
A: -(z1*a^2*b^2*k^2*x^2*x0^2 + a^2*b^2*k^2*x^2 - 2*z1*a^2*b^2*k^2*x*x0^3 + z*a^2*b^2*k^2*x*x0^2*y - z*a^2*b^2*k^2*x*x0^2*y0 - 2*a^2*b^2*k^2*x*x0 + z1*a^2*b^2*k^2*x... B: z C: z1 parameters: [z z1] conditions: y ~= y0
% Solve for A, B, C that hold for all x, y
assume(x, 'real');
assume(y, 'real');
eq2 = leftSide == rightSide;
sol2 = solve(eq2, [A, B, C], 'ReturnConditions', true);
% Display the result
disp('Result of solving for A, B, C that hold for all x, y:');
Result of solving for A, B, C that hold for all x, y:
disp(sol2);
A: -(z1*a^2*b^2*k^2*x^2*x0^2 + a^2*b^2*k^2*x^2 - 2*z1*a^2*b^2*k^2*x*x0^3 + z*a^2*b^2*k^2*x*x0^2*y - z*a^2*b^2*k^2*x*x0^2*y0 - 2*a^2*b^2*k^2*x*x0 + z1*a^2*b^2*k^2*x... B: z C: z1 parameters: [z z1] conditions: y ~= y0
The code is as above, but the result obtained after running is not what I want. A, B, and C can only be expressed in terms of other parameters. Why does the result include z? How can I get the specific parameter values?
  4 Comments
Sam Chak
Sam Chak on 25 Mar 2025
Could you provide a geometric sketch of the lines? This would help us intuitively understand what you aim to solve.

Sign in to comment.

Answers (1)

Sameer
Sameer on 10 Apr 2025
It looks like your symbolic solution is returning parameters 'z' and 'z1' because the system of equations is underdetermined, there are infinitely many solutions for 'A', 'B', and 'C' in terms of these parameters. To obtain specific values for 'A', 'B', and 'C', you need additional constraints or specific values for other variables.
Hope this helps!

Tags

Community Treasure Hunt

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

Start Hunting!