Mathematica Asked by Skyhawk on June 22, 2021
I need to perform the following operations using Wolfram Mathematica.
I have these equations:
$$a b = c+d+e$$
$$frac{d}{f}=g h + i$$
$$k=frac{a}{c}$$
I need to obtain $k$ as a function of: $a,b,c,e,f,g,h,i$
Then I need to put the expression $k$ in the form: $$k= frac{1}{b}+frac{(f(g h + i))+e)}{(b c)}$$
I made this code:
In: Solve [a b == c + d + e, a]
Out: {{a -> (c + d + e)/b}}
In: Solve[d/f == g h + i, d]
Out: {{d -> f (g h + i)}}
In: k = a/c /. a -> (c + d + e)/b
Out: (c + d + e)/(b c)
In: k = k /. d -> f (g h + i)
Out: (c + e + f (g h + i))/(b c)
In: Simplify[k]
Out: (c + e + f g h + f i)/(b c)
I have 2 questions:
Is there a simpler way to perform that task? For example, using others commands.
Is there a way to obtain the expression of k in the form $k= frac{1}{b}+frac{(f(g h + i))+e)}{(b c)}$ ?
Clear["Global`*"]
eqns = {a*b == c + d + e, d/f == g*h + i, k == a/c};
With three equations you can solve for one variable while eliminating two others. To Solve for k
while eliminating {a, d}
sol = Solve[eqns, k, {a, d}][[1]] // Simplify
(* {k -> (c + e + f g h + f i)/(b c)} *)
To restructure the RHS
expr = 1/b + j/(b*c);
sol2 = {k -> expr} /. Solve[(k /. sol) == expr, j][[1]]
(* {k -> 1/b + (e + f g h + f i)/(b c)} *)
Verifying that both expressions for k
are equivalent
(k /. sol) == (k /. sol2) // Simplify
(* True *)
Correct answer by Bob Hanlon on June 22, 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