finding the remainder of the division of two symbolic variables
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I want to get 2*V^2 from the operation below
syms A V
rem(2*V^2+3A,A)
but it seems like rem() function does not work with symbolic variables. Is there a way to achieve this in another way?
5 Kommentare
Umar
am 3 Aug. 2024
Bearbeitet: Walter Roberson
am 3 Aug. 2024
Hi @ Elif Cansu Akoguz,
If you manually expand the expression and then extract the coefficients, you can deduce the value of z as A^2 in the rewritten function. Let me illustrate it with example,
syms bL bH A V z t;
f = (A^2*bL^2 + 2*A^2*bL + A^2 + 4*bH^2*bL^2 - 8*bH*bL + 4)/(8*(bH*bL - 1)^2);
% Expand the expression
expanded_f = expand(f);
% Extract the coefficients
coeff_z = coeffs(expanded_f, A^2);
z = coeff_z(1); % Assuming z is the coefficient of A^2
% Verify the result
rewritten_f = z*(1+bL)^2 + t;
This approach will bypass the limitation of the coeffs function with complex arguments. Hope this helps.
Antworten (1)
Aditya
am 1 Aug. 2024
you can use "quorem" function to get the Quotient and remainder for a particular expression:
here is an example on how to do it:
[q, r] = quorem(expr, A, A);
To read more about this function refer to this link:
0 Kommentare
Siehe auch
Kategorien
Mehr zu Assumptions 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!