Mathematica Asked by Sea cucumber on July 5, 2021
I want to extract a factor from the equations, it’s not a common factor, just a factor defined by myself, like this:
(ac+b) –> c(a+b/c)
I have tried Factor
,FactorTerms
,Eliminate
, but it do not work as I expect, if the factor do not contained in the terms, it could not be extracted, like:
b=c*(b/c)
I turn to MATHEMATICA for its ability on symbolic calculations, I want to replace pen and paper with the computer program, for convenient and accuracy. Sometimes I need to rearrange the equations to extract some factors or apply some math skills, but the MATHEMATICA always automatically simplify my expression.
This is my equation:
-((b La r [Omega] - b k La^2 [Omega]^2)/(
g h k w + g h k^3 La^2 w)) == 1
I want to extract ([Omega]^2*b)/(k^2*g*h*w)
and put this part on one side and the other parts on the other side, like this:
([Omega]^2*b)/(k^2*g*h*w) == the other part
I have tried:
eq11=-((b La r [Omega] - b k La^2 [Omega]^2)/(
g h k w + g h k^3 La^2 w)) == 1
eq12 = Times[([Omega]^2*b)/(k^2*g*h*w),
Divide[eq11[[1]], ([Omega]^2*b)/(k^2*g*h*w)]]
and
factorOut[fac_][expr_] :=
Replace[expr, p_Plus :> fac Simplify[p/fac], All]
factorOut[([Omega]^2*b)/(k^2*g*h*w)][eq11]
I would appreciate it if who can fix my problem
May be this way
eq = -((b La r [Omega] - b k La^2 [Omega]^2)/(g h k w +
g h k^3 La^2 w)) == 1
sub1 = (b [Omega]^2)/(g h k^2 w)
eq2 = eq[[1]]*sub2/sub1 == eq[[2]]
sol = First@Solve[eq2, sub2]
(* {sub2 -> ((1 + k^2 La^2) [Omega])/(k La (-r + k La [Omega]))} *)
sub1 == sub2 /. sol // Simplify
(* (b [Omega]^2)/(g h k^2 w) ==
-(([Omega] + k^2 La^2 [Omega])/(k La r - k^2 La^2 [Omega])) *)
sub1 == sub2 /. sol // Simplify[#, eq] &
(* True *)
Correct answer by Akku14 on July 5, 2021
There is no special built-in function doing this. You can use the following customwritten one:
factor[expr_, fact_, funExpr_ : Expand, funFact_ : Identity] :=
Module[{a = fact, b = expr/fact},
funFact[Evaluate[a]]*funExpr[Evaluate[b]]]
Here expr
is the expression to factor, the fact
is the factor to take out of the parentheses, funExpr
is an optional function to apply to the rest of the expression after the factorization. By default, it is Expand
. funFact
is an optional function to apply to the factor if needed. By default, it is Identity
.
Returning to your expression:
expr = -((b La r [Omega] - b k La^2 [Omega]^2)/(g h k w +
g h k^3 La^2 w));
factor[expr, ([Omega]^2*b)/(k^2*g*h*w), Simplify, HoldForm]
Have fun!
Answered by Alexei Boulbitch on July 5, 2021
I guess, the simplest way to make desired is to do it semi-manually:
aaa=-((b La r [Omega] - b k La^2 [Omega]^2)/(g h k w + g h k^3 La^2 w));
bbb=[Omega] b/(k^2 g h w);
res=Simplify[aaa/bbb]==1/bbb
All rest, like a creation of superfunctions that refines your equation, is just sophistication..
Answered by Rom38 on July 5, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP