Message Boards Message Boards

GROUPS:

extract a common factor from denominator and numerator of a large fraction

Posted 9 years ago
5320 Views
|
2 Replies
|
2 Total Likes
|

I have a fraction which contains a great number of terms in numerator and denominator with cosine and sine functions along with other algebraic terms. Now as it seems to me apparently there is a common factor like (cos[eta] - sin[eta] ) or (cos[eta] + sin[eta] ) or its squared or (cos[eta]^2 - sin[eta]^2 ) in both denominator and numerator and I want to extract that common factor to bring it in a simplified form. Please throw a light on this how can I do it efficiently. Please find the attached notebook in rar file (since the size of notebook file is greater than 20 Mb). To open the attached file you have to rename the file with extension ".rar" (means rename the file with "Rdot_expr1.nb.rar" and then extract). Since I was not able to upload the .rar file hence I had to take that move. Please bear with me.

Many thanks in advance

Attachments:
POSTED BY: ver din
2 Replies
Posted 9 years ago

One idea:

Use replacement to turn all Cos[eta] into CosEta, Cos[eta]^2 into CosEta^2, etc. You will need to study how to use pattern matching and replacement to make certain you make no errors in this step.

Then use the Mathematica function PolynomialGCD to extract what you are looking for.

Then reverse the replacement to turn your CosEta back into Cos[eta], etc.

That won't be able to take advantage of all the possible trig transformations, but it might stumble onto a common factor within the time and memory available to you.

Test this idea on a simpler smaller example to ensure that it works for all possible ways that your trig functions might appear. Then time how long it takes on the first 10% of your terms and the first 20% of your terms. That might give some idea how long it will take for the complete problem to finish. Unfortunately I suspect that your Mathematica will begin to swap information out of memory onto your hard drive and that will be hundreds of times slower and so any estimate of how long this will take will only be very approximate.

Unfortunately, having tried to find smaller simpler ways of expressing big complicated problems in the past, I suspect the result of the GCD will likely be 1. My reasoning is based on examples which ended up being things like "almost a square of an expression half the size... except for a much smaller complicating bit added onto the end." Long long ago I asked various sources how difficult it would be to construct a "greedy" function FindMostly[hugeExpression, #1^2+#2&]. It did not need to be perfect, but it needed to mostly find what should be in each of those two "variables." It needed to work on very large problems and do this fairly quickly, much more quickly than exhaustive search of every possible alternative. In your case you might write (#1#2)/(#1#3)&. Unfortunately I was never able to implement this nor coax anyone else to do this.

POSTED BY: Bill Simpson

I'd advise to make a smaller example, one that fits into an attachable notebook. The substance of the problem almost surely does not require a huge example.

POSTED BY: Daniel Lichtblau
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