HP Prime vs TI : Factoring ? « Next Oldest | Next Newest »

 ▼ HP Pioneer Junior Member Posts: 4 Threads: 3 Joined: Oct 2013 10-29-2013, 11:59 AM factor(5x^4 + 20x^3 - 62x^2 - 8x +24) TI 200 returns (x-2)(x+6)(5x^2-2) HP Prime returns (x-2)(x+sqroot(10)/5)(x+6)(5x-sqroot(10)) Anyway to have the Prime avoid the sqroots? ▼ From Hong Kong Member Posts: 125 Threads: 5 Joined: Jun 2008 10-29-2013, 12:10 PM Uncheck 'Use ¡Ô ' in the CAS settings before doing the above factorisation. Edited: 29 Oct 2013, 12:11 p.m. CR Haeger Junior Member Posts: 37 Threads: 7 Joined: Sep 2013 10-29-2013, 12:14 PM Worked okay for me if CAS Settings set to: "Use sqrt to factor polynomials" set to UNCHECKED and "Simplify" set to NONE or MINIMUM. Best, Carl Tim Wessman Posting Freak Posts: 1,278 Threads: 44 Joined: Jul 2007 10-29-2013, 12:16 PM Here is a perfect example for the recent "collect vs factor" discussion! :-) Collect will return the same result as the TI, while factor will completely factor it as far as possible due to having more capable factoring capabilities. TW Edited: 29 Oct 2013, 12:19 p.m. ▼ CR Haeger Junior Member Posts: 37 Threads: 7 Joined: Sep 2013 10-29-2013, 12:49 PM Thanks Tim! It looks like you can also control the "extent" of terms COLLECTION by adjusting the CAS Simplify settings? Cool. CompSystems Member Posts: 213 Threads: 60 Joined: Mar 2013 10-29-2013, 12:54 PM Quote: Here is a perfect example for the recent "collect vs factor" discussion! :-) Collect will return the same result as the TI, while factor will completely factor it as far as possible due to having more capable factoring capabilities. TW collect == factor =( Collect (HP-Prime) this factoring in most cases and is not doing what it says catalog help. [ HP-PRIME CAS MODE & APPROX MODE ] collect( (-3*a*x^2 +7*a*x^1 -2*a-3*b*x^2 + 7*b*x^1 -2*b+3*x^3 -7*x^2 + 2*x^1)/3 ) ; [ENTER] => -1.*(x-2.)*(x-0.333333333333)*(a-x+b) factor( (-3*a*x^2 +7*a*x^1 -2*a-3*b*x^2 + 7*b*x^1 -2*b+3*x^3 -7*x^2 + 2*x^1)/3 ) ; [ENTER] => -1.*(x-2.)*(x-0.333333333333)*(a-x+b) [ HP-PRIME CAS MODE & EXACT MODE ] collect( (-3*a*x^2 +7*a*x^1 -2*a-3*b*x^2 + 7*b*x^1 -2*b+3*x^3 -7*x^2 + 2*x^1)/3 ) ; [ENTER] => (x-2)*(3*x-1)*(x-a-b)/3 factor( (-3*a*x^2 +7*a*x^1 -2*a-3*b*x^2 + 7*b*x^1 -2*b+3*x^3 -7*x^2 + 2*x^1)/3 ) ; [ENTER] => (x-2)*(3*x-1)*(x-a-b)/3 My collect collectPolTerms( (-3*a*x^2 +7*a*x^1 -2*a-3*b*x^2 + 7*b*x^1 -2*b+3*x^3 -7*x^2 + 2*x^1)/3, x ) ; => x^3 + ((-3*a-3*b-7)/3)*x² +((7*a+7*b+2)/3)*x + (-2*a-2*b)/3*x^0 // :) OK more info source code cas+ with real collect poly ```main( ):= BEGIN CONJUGATE() := BEGIN true; END; SYMBOLIC() := BEGIN true; END; RETURN( OK ); END; collectPolTerms( Poly, Var ):= BEGIN LOCAL FlagBadArg; FlagBadArg:= "false"; IF NOT( POS( { "AlgExpression", "Equation", "Identifier", "RealNumber", "IntegerNumber", "AlgComplexNumber", "RationalNumber", "RatComplexNumber" }, getType( Poly ) ) ) THEN FlagBadArg := "true"; IF NOT( MSGBOX( "collectPolTerms:Invalid Data Type for 1 arg", true ) ) THEN kill; END; END; IF NOT( getType( Var ) == "Identifier" ) THEN FlagBadArg := "true"; IF NOT( MSGBOX( "collectPolTerms:Invalid Data Type for 2 arg", true ) ) THEN kill; ELSE kill; END; END; IF FlagBadArg == "false" THEN IF isEquation( Poly ) == "true" THEN Poly := toEq( eqToExpr ); END; RETURN( sum( coeff( Poly, Var ) .* seq( Var^k, k, degree( Poly, Var ), 0, 1 ) )); ELSE RETURN( "Invalid Data Type" ); END; END; getType( Data0 ):= BEGIN LOCAL TypeN, TypeID, RealType, ObjStr; TypeID := type( Data0 ); IFERR TYPE( Data0 ) THEN RealType := "ERROR"; ObjStr := "ERROR"; ELSE TypeN := TYPE( Data0 ); ObjStr := STRING( Data0 ); END; CASE IF TypeID == DOM_FLOAT THEN RealType := "RealNumber"; END; IF TypeID == DOM_INT THEN RealType := "IntegerNumber"; END; IF TypeID == DOM_COMPLEX THEN IF inString( ObjStr,"(" ) >= 1 THEN RealType := "CooComplexNumber"; ELSE RealType := "AlgComplexNumber"; END; END; IF TypeID == DOM_RAT THEN IF inString( ObjStr, string( i ) ) >= 1 THEN RealType := "RatComplexNumber"; ELSE RealType := "RationalNumber"; END; END; IF TypeID == DOM_SYMBOLIC THEN IF inString( string( Data0 ), "=" ) >= 1 THEN RealType := "Equation"; ELSE RealType := "AlgExpression"; END; END; IF TypeID == DOM_IDENT THEN RealType := "Identifier"; END; IF TypeID == DOM_STRING THEN RealType := "String"; END; IF TypeID == DOM_FUNC THEN RealType := "Function"; END; IF TypeID == DOM_LIST THEN CASE IF inString( ObjStr, "poly1[" ) >= 1 THEN RealType := "PolynomialCoeff"; END; IF inString( ObjStr, "set[" )>= 1 THEN RealType := "Set"; END; IF inString( ObjStr, "[[" ) >= 1 THEN RealType := "Matrix"; END; IF inString( ObjStr, "[" ) >= 1 THEN RealType := "Vector"; END; IF inString( ObjStr, "{" ) >= 1 OR inString( ObjStr, "{[" ) >= 1 THEN RealType := "List"; END; DEFAULT RealType := "Other Type LIST"; END; END; IF TypeN == 8 THEN RealType := "Unit"; END; IF TypeID == 21 THEN RealType := "HMS"; END; IF TypeN == 1 THEN CASE IF inString( ObjStr, "d" ) >= 1 THEN RealType := "DecNumber"; END; IF inString( ObjStr, "b" ) >= 1 THEN RealType := "BinNumber"; END; IF inString( ObjStr, "h" ) >= 1 THEN RealType := "HexNumber"; END; IF inString( ObjStr, "o" ) >= 1 THEN RealType := "OctNumber"; END; DEFAULT RealType := "Other Base"; END; END; DEFAULT RealType := "Other"; END; RETURN( RealType ); END; partString( Str0, StrP ):= BEGIN LOCAL FlagBadArg; FlagBadArg:= "false"; IF NOT( ( getType( Str0 ) == "String" ) AND ( NOT( Str0 == "" ) ) ) THEN FlagBadArg := "true"; IF NOT( MSGBOX( "partString: Invalid Data Type for 1 Arg", true ) ) THEN kill; END; END; IF NOT( ( getType( StrP ) == "String" ) AND ( NOT( StrP == "" ) ) ) THEN FlagBadArg := "true"; IF NOT( MSGBOX( "partString: Invalid Data Type for 2 Arg", true ) ) THEN kill; ELSE kill; END; END; IF FlagBadArg == "false" THEN RETURN( convertToRealBoolean( inString( Str0, StrP ) ) ); ELSE RETURN( "Invalid Data Type" ); END; END; convertToRealBoolean( Object0 ):= BEGIN IF isBooleanDataType( Object0 ) == "true" THEN IF getType( Object0 ) == "String" THEN Object0 := expr( Object0 ); END; IF Object0 <= 0 THEN RETURN( "false" ); ELSE RETURN( "true" ); END; ELSE IF NOT( MSGBOX( "convertToRealBoolean: Invalid Data Type", true ) ) THEN kill; ELSE kill; END; END; END; isBooleanDataType( Object ):= BEGIN LOCAL FlagBadArg, ObjectType; FlagBadArg:= "false"; ObjectType := getType( Object ); IF NOT( POS( { "RealNumber", "IntegerNumber", "RationalNumber", "String" }, ObjectType ) ) THEN FlagBadArg := "true"; END; IF FlagBadArg == "true" THEN RETURN( "false" ); ELSE IF ObjectType == "String" THEN ObjectType:= expr( Object ); IF isNumber( ObjectType ) == "true" THEN RETURN( "true" ); ELSE RETURN( "false" ); END; ELSE RETURN( "true" ); END; END; END; isNumber( Object ):= BEGIN LOCAL ObjectType; ObjectType:= getType( Object ); IF POS( { "RealNumber", "IntegerNumber", "RationalNumber" }, ObjectType ) THEN RETURN( "true" ); ELSE RETURN( "false" ); END; END; isComplexNumber( Object ):= BEGIN LOCAL ObjectType; ObjectType:= getType( Object ); IF POS( { "CooComplexNumber", "AlgComplexNumber", "RatComplexNumber" }, ObjectType ) THEN RETURN( "true" ); ELSE RETURN( "false" ); END; END; isEquation( Object ):= BEGIN LOCAL FitObject; IFERR EVAL( Object ); THEN FitObject := Object; ELSE FitObject := EVAL( Object ); END; IF getType( FitObject ) == "Equation" THEN RETURN( "true" ); ELSE RETURN( "false" ); END; END; eqToExpr( Eq ):= BEGIN IF isEquation( Eq ) == "true" THEN RETURN( expr( replace( string( Eq ), "=" , "-(" ) + ")" ) ); ELSE RETURN( Eq ); END; END; transpose2( Array, Test0 ):= BEGIN LOCAL FlagBadArg; FlagBadArg:= "false"; IF NOT( POS( { "Vector", "Matrix" }, getType( Array ) ) ) THEN FlagBadArg := "true"; IF NOT( MSGBOX( "transpose2: Invalid Data Type for 1 arg", true ) ) THEN kill; END; END; IF NOT( isBooleanDataType( Test0 ) == "true" ) THEN FlagBadArg := "true"; IF NOT( MSGBOX( "transpose2: Invalid Data Type for 2 arg", true ) ) THEN kill; ELSE kill; END; ELSE Test0 := convertToRealBoolean( Test0 ); END; IF FlagBadArg == "false" THEN IF Test0 == "true" THEN RETURN( TRN( Array ) ); ELSE RETURN( transpose( Array ) ); END; ELSE RETURN( "Invalid Data Type" ); END; END; toPoly1var( Object, Var, Test ):= BEGIN LOCAL FlagBadArg, FitPoly, ObjectType; FlagBadArg:= "false"; ObjectType := getType( Object ); IF NOT( POS( { "AlgExpression", "Equation", "Identifier", "RealNumber", "IntegerNumber", "AlgComplexNumber", "RatComplexNumber", "RationalNumber", "PolynomialCoeff", "Vector" }, ObjectType ) ) THEN FlagBadArg := "true"; IF NOT( MSGBOX( "toPoly1var: Invalid Data Type for 1 arg", true ) ) THEN kill; END; END; IF NOT( getType( Var ) == "Identifier" ) THEN FlagBadArg := "true"; IF NOT( MSGBOX( "toPoly1var: Invalid Data Type for 2 arg", true ) ) THEN kill; END; END; IF NOT( isBooleanDataType( Test ) == "true" ) THEN FlagBadArg := "true"; IF NOT( MSGBOX( "toPoly1var: Invalid Data Type for 3 arg", true ) ) THEN kill; ELSE kill; END; ELSE Test := convertToRealBoolean( Test ); END; IF FlagBadArg == "false" THEN CASE IF ObjectType == "PolynomialCoeff" THEN IF Test == "true" THEN RETURN( poly2symb( ObjectType, Var ) ); ELSE RETURN( ObjectType ); END; END; IF ObjectType == "Vector" THEN FitPoly := expr( "poly1" + Object ); IF Test == "true" THEN RETURN( poly2symb( FitPoly, Var ) ); ELSE RETURN( FitPoly ); END; END; IF isEquation( Object ) == "true" THEN FitPoly := eqToExpr( Object ); IF Test == "false" THEN RETURN( symb2poly( FitPoly, Var ) ); ELSE RETURN( FitPoly ); END; END; DEFAULT IF Test == "false" THEN RETURN( symb2poly( Object, Var ) ); ELSE RETURN( Object ); END; END; ELSE RETURN( "Invalid Data Type" ); END; END; polyCoeffToArray( Poly ):= BEGIN LOCAL FlagBadArg; FlagBadArg:= "false"; IF NOT( POS( { PolynomialCoeff }, getType( Poly ) ) ) THEN FlagBadArg := "true"; IF NOT( MSGBOX( "polyCoeffToArray: Invalid Data Type for 1 arg", true ) ) THEN kill; END; END; IF FlagBadArg == "false" THEN RETURN := expr( replace( string( Poly ), "poly1" , "" ) ); ELSE RETURN( "Invalid Data Type" ); END; END; randPoly2( Pdim, Il, Sl, Var, Test ):= BEGIN LOCAL Rp; Rp := randPoly( Pdim, expr( Il + ".." + Sl ) ); RETURN( toPoly1var( Rp, Var, Test )); END; polyToCoeff( Poly, Var ):= BEGIN LOCAL PolyFnt, Out, Cnt0, Temp0; purge( Pol ); IF isEquation( Poly ) == "true" THEN Poly := eqToExpr( Poly ); END; expr( Pol(Var)+":="+string( Poly ) ); Out := MAKELIST( 0, Cnt1, degree( Poly ), 0, 1 ); Cnt0:=0; WHILE Pol(Var) <> 0 DO Temp0 := Pol(Var) / (Cnt0!) ; Out[ Cnt0 ] := ( Temp0 | Var=0 ); Cnt0 := Cnt0 + 1; Pol(Var) := diff( Pol(Var), Var); END; Out := expr( "poly1[" + string( REVERSE(Out) ) + "]"); RETURN( Out ); END; ``` Edited: 29 Oct 2013, 4:36 p.m. after one or more responses were posted ▼ CR Haeger Junior Member Posts: 37 Threads: 7 Joined: Sep 2013 10-29-2013, 01:27 PM Thanks Tim! It looks like you can control the "extent" of terms COLLECTION(or FACTORING) by adjusting the CAS Simplify settings? Again, Cool CompSystems Member Posts: 213 Threads: 60 Joined: Mar 2013 10-29-2013, 02:00 PM Re: HP-Prime vs TI-CAS (calculators): Factoring TI-CAS: TI92(+)/TI89(TITANIUM)/TIvoyage200/TInspire[CX]CAS/... HP-CAS: HP-Prime/HP50G [TI-CAS: EXACT MODE] factor(5*x^4+20*x^3-62*x^2-8*x+24,x) [ENTER] RETURN (x-2)*(x+6)*(5*x^2-2) [TI-CAS: APPROXIMATE MODE] factor(5*x^4+20*x^3-62*x^2-8*x+24,x) [ENTER] RETURN 5.*(x-2.)*(x-0.632455532034)*(x+0.632455532034)*(x+6.) [TI-CAS: AUTOMATIC MODE] factor(5*x^4+20*x^3-62*x^2-8*x+24,x) [ENTER] RETURN (x-2)*(x+6)*(5*x^2-2) //////////// [HP-CAS: EXACT MODE & NONE SIMPLIFY] factor(5*x^4+20*x^3-62*x^2-8*x+24,x) [ENTER] RETURN (x-2)*(x+6)*(5*x^2-2) [HP-CAS: APPROXIMATE MODE & NONE SIMPLIFY] factor(5*x^4+20*x^3-62*x^2-8*x+24,x); [ENTER] RETURN 5.*(x-2.)*(x-0.632455532034)*(x+0.632455532034)*(x+6.) [HP-CAS: EXACT MODE & MAX SIMPLIFY] factor(5*x^4+20*x^3-62*x^2-8*x+24,x); [ENTER] RETURN 5*x^4+20*x^3-62*x²-8*x+24 BUG IF MAX_SIMPLIFY == ON THEN SKIP FLAG... ... factor(y^3+(a+b+c)*y²+(a*b+b*c+c*a)*y+a*b*c,y); => (y+c)*(y+b )*(y+a) factor(y²+(a+b )*y+a*b,y);(y+b )*(y+a) cfactor(x^3-y^3,y) ? // Edited: 29 Oct 2013, 3:47 p.m.

 Possibly Related Threads... Thread Author Replies Views Last Post HP Prime works from the traditionally TI community... debrouxl 1 1,057 12-06-2013, 09:00 PM Last Post: Erwin Ried Are HP Prime CAS and TI NSpire CAS the same? hugh steers 14 3,256 10-31-2013, 04:54 PM Last Post: hugh steers Trading TI Nspire CX CAS for HP Prime Justin Sloan (Honolulu) 2 873 05-09-2013, 04:22 AM Last Post: Chris Smith HP & TI in the 70's revisited Palmer O. Hanson, Jr. 1 823 05-12-2012, 02:17 PM Last Post: John W Kercheval OT--HP & TI in the 70s Matt Agajanian 12 2,275 05-09-2012, 01:20 AM Last Post: Matt Agajanian HP vs TI's SR-50 Matt Agajanian 15 2,868 03-28-2012, 06:45 PM Last Post: Bill Carter HP-41 Expandability Then and Now… TI? Kerem Kapkin (Silicon Valley, CA) 4 1,316 02-14-2012, 02:05 PM Last Post: M. Joury Numerical Integration: HP, TI, etc. Chuck 30 4,949 05-28-2011, 10:51 PM Last Post: Gerson W. Barbosa TI bash - and HP too? Jim Horn 16 2,651 07-19-2010, 12:40 PM Last Post: Lincoln R. WAS: HP vs. TI on eBay auctions Joerg Woerner 21 3,379 05-02-2010, 02:23 AM Last Post: db (martinez, ca.)

Forum Jump: