Message Boards Message Boards

0
|
5940 Views
|
2 Replies
|
2 Total Likes
View groups...
Share
Share this post:

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

Posted 10 years ago
Attachments:
POSTED BY: ver din
2 Replies
Posted 10 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