Post Reply 
[only CAS Libraries]
12-13-2013, 03:29 PM (This post was last modified: 04-17-2017 01:03 AM by compsystems.)
Post: #1
[only CAS Libraries]
Library #0 HP_PrimeCASplus
http://www.hpcalc.org/details/7510
Find all posts by this user
Quote this message in a reply
12-15-2013, 02:34 AM
Post: #2
RE: [only CAS Libraries]
The included "User Guide" is not in English. Nor is there any description here. Can we please have at least a brief English description of the purpose of this software and how to use it? Thanks in advance!

<0|ΙΈ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
01-28-2014, 06:55 PM
Post: #3
RE: [only CAS Libraries]
(12-15-2013 02:34 AM)Joe Horn Wrote:  The included "User Guide" is not in English. Nor is there any description here. Can we please have at least a brief English description of the purpose of this software and how to use it? Thanks in advance!

The link is dead anyway.
Find all posts by this user
Quote this message in a reply
01-28-2014, 11:11 PM
Post: #4
RE: [only CAS Libraries]
Code

Code:
main( ):=
BEGIN
    CONJUGATE() := BEGIN true; END;
    SYMBOLIC() := BEGIN true; END;
    RETURN( OK );
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 == 9
        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;

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;

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, Cnt1, 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;
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)