# Factor out known multipliers in algebraic expressions?

Posted 1 year ago
1125 Views
|
6 Replies
|
4 Total Likes
|
 Hi there,I have this function of a[t], and it's a long function of other variables in time and some constant parameter (Ixx, Iyy, Izz), which I really want to explicit in a somatory of any combination of those constant parameters. I've tried to Simplify and then Apart, but Mathematica doesn't group similar coefficients. I wonder if I could get this result applying some kind of mapping (...)?Well, below is the function a[t]: a[t_] := -((Cos[ϕ[t]]* Izz[t]*(Ty[t] - Cos[ϕ[t]]*Iyy[t]*Derivative[ϕ][t]* Derivative[ψ][t] + Cos[ϕ[t]]*(-Ixx[t] + Izz[t])* (Sin[ψ[t]]*Derivative[θ][t] + Derivative[ϕ][t])*((-Cos[ψ[t]])* Tan[ϕ[t]]*Derivative[θ][t] + Derivative[ψ][t]) + Iyy[t]*Derivative[θ][ t]*(Cos[ψ[t]]*Sin[ϕ[t]]* Derivative[ϕ][t] + Cos[ϕ[t]]*Sin[ψ[t]]* Derivative[ψ][t])) - Iyy[t]*Sin[ϕ[t]]*(Tz[t] + Izz[t]*Sin[ϕ[t]]*Derivative[ϕ][t]* Derivative[ψ][ t] + (Ixx[t] - Iyy[t])*(Sin[ψ[t]]*Derivative[θ][t] + Derivative[ϕ][t])* (Cos[ϕ[t]]*Cos[ψ[t]]* Derivative[θ][t] + Sin[ϕ[t]]*Derivative[ψ][t]) + Izz[t]*Derivative[θ][ t]*(Cos[ϕ[t]]*Cos[ψ[t]]* Derivative[ϕ][t] - Sin[ϕ[t]]*Sin[ψ[t]]* Derivative[ψ][t])))/((-Cos[ϕ[t]]^2)* Cos[ψ[t]]*Iyy[t]*Izz[t] - Cos[ψ[t]]*Iyy[t]*Izz[t]*Sin[ϕ[t]]^2)); Summarizing, what I want is a way to say : rewrite a[t] factorizing in a sum by these terms (Ixx, Iyy, Izz) on any combination between them. ( In other way, I could ask the same by rewriting a[t] factorizing in terms that don't vary in time? Would this be possible/easier? )Can anybody suggest a good thing to try?Thanks. Attachments: Answer
6 Replies
Sort By:
Posted 1 year ago
 I am not quite sure what you want to do, but first of all in a [ t ] your "constant parameter (Ixx, Iyy, Izz)" are functions of t as well.So I remove this num = Numerator[a[t]] /. {Ixx[t] -> Ixx, Iyy[t] -> Iyy, Izz[t] -> Izz} // Expand den = Denominator[a[t]] /. {Ixx[t] -> Ixx, Iyy[t] -> Iyy, Izz[t] -> Izz} // FullSimplify and Collect terms num1 = Collect[num, {Ixx, Iyy, Izz, Ixx Iyy, Ixx Izz, Iyy Izz}] Check it (a[t] - num1/den /. {Ixx[t] -> Ixx, Iyy[t] -> Iyy, Izz[t] -> Izz}) // Simplify You may well replace Ixx for Ixx [ t ] ans so on in num1 / den again....Hope this helps. Answer
Posted 1 year ago
 Thanks for the help. Check the new file that I've uploaded below. Answer
Posted 1 year ago
 Thanks for the help! You are right, sorry for the mistake, Ixx[t] is Ixx; e this also aplies to Iyy and Izz.However, I've tried to use it and still isn't what I want as an answer. To put in other example,... Let's say that I have this expression: y = A*Cos [\[Theta]] + (B/A)*Sin[\[Theta]] + (B*A)*x + A*Tan[x] + (B/A)*x^2 And, what I want to know is how to rewrite it like this, using Mathematica methods: y = A*(Cos [\[Theta]]+Tan[x]) + (B/A)*(Sin[\[Theta]]+x^2) + (B*A)*x Because I want "y" as a sum of the constant terms {A,B} in any combination between them, but also multiplying a function that do not include them, like above. For example, this format o y, applying Apart for "B" Apart[ y , {B}] Results in: {(B (A^2 x + x^2 + Sin[\[Theta]]))/A + A (Cos[\[Theta]] + Tan[x])} Which doesn't help, because the first polynomial term contains "A", that I want only as a coefficient.Thanks again for the help. Attachments: Answer
Posted 1 year ago
 hmmm - ok. perhaps you should disguise the mixed terms. Seems that this Collect[y /. {A B -> ab, A/B -> adb, B/A -> bda}, {A, B, ab, adb,bda}] /. {ab -> A B, adb -> A/B, bda -> B/A} works in your simple example, but for sure it will get tedious in more complicated cases.And what is wrong with the method I mentioned first? This gives num1 as a polynomial in Ixx, Ixx^2, Ixx * Iyy and so on with coefficients as functions depending only of t. Same for the denominator and then you can write your a [ t ] in the form you want. Answer
Posted 1 year ago
 Another method, perhaps easier to be made more general is: Find the "variables" - meaning the expressions not being dependet of A or B vv = Complement[Variables[y], {A, B}] Now find the coefficients of these variables cc = Coefficient[y, #] & /@ vv and then find the factors of these Collect[y, cc] Answer
Posted 1 year ago
 Thank you!This idea worked pretty neat! Precisely what I intended to obtain as an answer form of the equation. Very easy to understand.Now I will try to apply those methods into a[t]. Because I need to simplify redundant functions for applying linear solving methods (non singular matrix).I'm grateful! Thanks again. Answer
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.