Can this symbolic expression be simplified anymore?

100 views (last 30 days)
Hi guys,
I am perforning a task where one of the equations I am creating comes out very long and cumbersome. I am using the simplify function to simplify it, but I think I can see that it can be simplified more. I don't know why MATLAB isn't taking it all the way.
So, I was wondering if there is anyway I can get MATLAB to simplify it further? The equation of interest is KC in the code.
clear, clc, close all
syms Icm Ic Ib Acm Ac Ab L1 L2 z1 z2 Ig F Kc1 Kc2 Kb1 Kb2 Vx H
A1 = (Vx*(H-z1)/2)*18/Ig*Acm - ((Vx-F)*(H-z2)/2)*18/Ig*Acm;
A2 = ((Vx*(H-z1)/2)*6/Ig*Ac - ((Vx-F)*(H-z2)/2)*6/Ig*Ac) + (Vx*(H-z1)/2)*18/Ig*Acm - ((Vx-F)*(H-z2)/2)*18/Ig*Acm;
v1 = simplify((6*A1/4));
v2 = simplify((6*A1 + 3*A2)/4);
v3 = simplify((3*A2 + 3*A2)/4);
eq1 = v1 == Kc1;
eq2 = v2 == Kc2;
eq3 = v3 == Kc2;
ks1 = solve(eq1,Vx);
ks2 = solve(eq2,Vx);
ks3 = solve(eq3,Vx);
eq1 = v1 == Kc1;
eq2 = v2 == Kc2;
eq3 = v3 == Kc2;
ks1 = solve(eq1,Vx);
ks2 = solve(eq2,Vx);
ks3 = solve(eq3,Vx);
KC = simplify((1/ks1 + 1/ks2 + 1/ks3 + 1/ks2 + 1/ks1)^-1)
KC = 
I recommend running the code in a live script because the notation is a lot nicer and easier to read.
Many thanks
  5 Comments
Walter Roberson
Walter Roberson on 11 Jan 2026 at 18:39
You can simplify fractions or take partial fractions, but I don't think it makes it any simpler.
clear, clc, close all
syms Icm Ic Ib Acm Ac Ab L1 L2 z1 z2 Ig F Kc1 Kc2 Kb1 Kb2 Vx H
A1 = (Vx*(H-z1)/2)*18/Ig*Acm - ((Vx-F)*(H-z2)/2)*18/Ig*Acm;
A2 = ((Vx*(H-z1)/2)*6/Ig*Ac - ((Vx-F)*(H-z2)/2)*6/Ig*Ac) + (Vx*(H-z1)/2)*18/Ig*Acm - ((Vx-F)*(H-z2)/2)*18/Ig*Acm;
v1 = simplify((6*A1/4));
v2 = simplify((6*A1 + 3*A2)/4);
v3 = simplify((3*A2 + 3*A2)/4);
eq1 = v1 == Kc1;
eq2 = v2 == Kc2;
eq3 = v3 == Kc2;
ks1 = solve(eq1,Vx);
ks2 = solve(eq2,Vx);
ks3 = solve(eq3,Vx);
KC = simplify((1/ks1 + 1/ks2 + 1/ks3 + 1/ks2 + 1/ks1)^-1)
KC = 
simplifyFraction(KC)
ans = 
partfrac(KC, Acm)
ans = 
Scott Banks
Scott Banks on 12 Jan 2026 at 14:25
Edited: Scott Banks on 12 Jan 2026 at 14:27
Yes, Sam, I will do that.You can calculate Ks1, Ks2 etc, and then use Rakine's formula which you quoted. Breaking the procedure up in stages will make it a lot less tedious.

Sign in to comment.

Accepted Answer

Sam Chak
Sam Chak on 12 Jan 2026 at 15:47
As mentioned above, the general formula for n parallel-connected resistors is given by:
.
For two parallel-connected resistors, the formula is simplified as follows:
.
For four parallel-connected resistors, by applying the two-resistor formula recursively, one can observe the pattern of a continued fraction in computing the total resistance up to nth resistor.
Most journal editors and reviewers appreciate math equations that are presented elegantly. I did not delve deeper into this for your case, which is why I previously recommended using the Ramanujan machine to obtain a more refined presentation. I am not particularly good at using the Symbolic Math Toolbox. Perhaps @Paul could demonstrate a method for achieving that.
% Resistors
R1 = 2;
R2 = 4;
R3 = 8;
R4 = 16;
R = [R1, R2, R3, R4];
%% Method 1: By using conventional formula:
Total_R = inv(1/R1 + 1/R2 + 1/R3 + 1/R4) % 16/15
Total_R = 1.0667
%% Method 2: By applying the two-resistor formula recursively
Rp_total = R(1); % Initialize the total resistance with the first resistor
% Iteratively calculate the equivalent resistance by combining two resistors at a time
for i = 2:length(R)
Rp_total = parallelConnectedResistors(Rp_total, R(i));
end
% Result
disp(['Total Resistance: ', num2str(Rp_total)]);
Total Resistance: 1.0667
% Formula for two parallel-connected resistors
function Rp = parallelConnectedResistors(R1, R2)
Rp = (R1*R2)/(R1 + R2);
end
  2 Comments
Scott Banks
Scott Banks on 12 Jan 2026 at 19:39
Thanks, Sam.
My field is structural engineering and each Ks1, Ks2 etc represents the stiffness of a member in a storey of a multi storey building.
Did you know that my forumla:
Does the same as your Rtotal?
Sam Chak
Sam Chak on 17 Jan 2026 at 4:52
Yes, @Scott Banks. The total resistance in a parallel configuration has the same formulaic structure.
However, in the context of structural engineering, this same formulaic structure is applied to a system of multiple springs in series. If you wish to draw an analogy between the mechanical system and the electrical system, a system of multiple springs in series is equivalent to a system of multiple resistors in series. The total conductance of a series circuit of pure resistors can be calculated using the same formulaic structure,
as electrical conductance is a reciprocal quantity to resistance, .

Sign in to comment.

More Answers (1)

Paul
Paul on 11 Jan 2026 at 17:58
"In terms of simplifying, you could flip upside down to get rid of the one/over."
Can try using numden, though the result might be unpalatable. Maybe den can be further simplified. Is there an expected, simplest form for KC?
What exactly is the concern with KC being too big? How is KC going to be used?
clear, clc, close all
syms Icm Ic Ib Acm Ac Ab L1 L2 z1 z2 Ig F Kc1 Kc2 Kb1 Kb2 Vx H
A1 = (Vx*(H-z1)/2)*18/Ig*Acm - ((Vx-F)*(H-z2)/2)*18/Ig*Acm;
A2 = ((Vx*(H-z1)/2)*6/Ig*Ac - ((Vx-F)*(H-z2)/2)*6/Ig*Ac) + (Vx*(H-z1)/2)*18/Ig*Acm - ((Vx-F)*(H-z2)/2)*18/Ig*Acm;
v1 = simplify((6*A1/4));
v2 = simplify((6*A1 + 3*A2)/4);
v3 = simplify((3*A2 + 3*A2)/4);
eq1 = v1 == Kc1;
eq2 = v2 == Kc2;
eq3 = v3 == Kc2;
ks1 = solve(eq1,Vx);
ks2 = solve(eq2,Vx);
ks3 = solve(eq3,Vx);
KC = simplify((1/ks1 + 1/ks2 + 1/ks3 + 1/ks2 + 1/ks1)^-1)
KC = 
[num,den] = numden(KC)
num = 
den = 
KC = num/den
KC = 

Categories

Find more on Programming in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!