![]() |
Factoring NPC
Call 'onFactorSynDiv' and pass it an array of the coefficients.
i.e. 'x^2 + 7x + 12' would be passed as {1,7,12} The NPC only uses synthetic division; I had planned to try to make it use other methods (common factors, difference of cubes/squares, sum of cubes, ect.), but I didn't feel like it. PHP Code:
|
Some of you guys sure do like to take advantage of Graal to do your homework >_<
|
Make is complete the squares! ;o
ie: change x^2+2x+4 to (x+2)^2 |
Quote:
O_o Someone fails. |
"33.5x^2 - 1.5x + 4 cannot be factored by this method."
I inserted -33.5, so I also don't see why you abs it? Whilst my easy ABC theory can (Result: 0.368659933 or -0.323883813) Edit: Oh wait, that's not the point of it.. well anyway, it should also calculate what 'x' is :P |
It seems that it's putting negatives in the next highest degree if you call it with a '/npc' command, for some reason.. It wasn't doing this when I first made it, weird.
You take the negative and positive of each factor of the lowest degree (reason abs is used in the script) and divide them by the negative and positive of each factor of the highest degree, then do synthetic division of the top numbers by each of the bottom numbers. If the end result is 0, you have a factor of the equation. |
Quote:
|
| All times are GMT +2. The time now is 03:42 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.