Message Boards Message Boards

0
|
4106 Views
|
6 Replies
|
4 Total Likes
View groups...
Share
Share this post:

Factor out known multipliers in algebraic expressions?

Posted 6 years ago

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[1][?][t]*
           Derivative[1][?][t] + 
          Cos[?[t]]*(-Ixx[t] + Izz[t])*
                    (Sin[?[t]]*Derivative[1][?][t] + 
             Derivative[1][?][t])*((-Cos[?[t]])*
              Tan[?[t]]*Derivative[1][?][t] + 
             Derivative[1][?][t]) + 

          Iyy[t]*Derivative[1][?][
            t]*(Cos[?[t]]*Sin[?[t]]*
              Derivative[1][?][t] + 
             Cos[?[t]]*Sin[?[t]]*
              Derivative[1][?][t])) - 

       Iyy[t]*Sin[?[t]]*(Tz[t] + 
          Izz[t]*Sin[?[t]]*Derivative[1][?][t]*
           Derivative[1][?][
            t] + (Ixx[t] - 
             Iyy[t])*(Sin[?[t]]*Derivative[1][?][t] + 
             Derivative[1][?][t])*
                    (Cos[?[t]]*Cos[?[t]]*
              Derivative[1][?][t] + 
             Sin[?[t]]*Derivative[1][?][t]) + 
          Izz[t]*Derivative[1][?][
            t]*(Cos[?[t]]*Cos[?[t]]*
              Derivative[1][?][t] - 

             Sin[?[t]]*Sin[?[t]]*
              Derivative[1][?][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:
POSTED BY: André Barbosa
6 Replies
Posted 6 years 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.

POSTED BY: André Barbosa

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]
POSTED BY: Hans Dolhaine

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.

POSTED BY: Hans Dolhaine
Posted 6 years ago

Thanks for the help. Check the new file that I've uploaded below.

POSTED BY: André Barbosa
Posted 6 years 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:
POSTED BY: André Barbosa

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.

POSTED BY: Hans Dolhaine
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract