(* :Title: Calculator Mimic *)(* :Author: Jack Courtney *)(* :Summary:    This package provides functions that mimic the Cartesian     plot displays of various graphing calculators.    The sketches produced by this program can easily     be incorporated into transparencies, exams, etc.    Calculators currently supported are:        Hewlett-Packard:    HP38G, HP48G, HP48GX        Texas Instruments:  TI82 (hence TI81, 83, 85, etc.)        Sharp Electronics:  EL9200, EL9200C, EL9300, EL9300C        CASIO:              FX9700GE, CFX9800G-w    An example of the usage is included at the end.  Remove the     outermost comment delimiters ( '(*' and '*)' ) to run the     example when the package is loaded.*)(* :Context: Calculator` *)(* :Package Version: 0.2 *)(* :Mathematica Version: 2.2.3 *)(* :Copyright: Copyright (c) 1995, Jack Courtney.  All Rights Reserved. *)(* :History: Created August 1995*)(* :Keywords:        GetKnownCalculators,    SetCalculator,    GetCalculatorDefaultRange,    CalcXYPlot,    CalcXYPlotArray*)(* :Current Restrictions:        Currently, the plots are restricted to Cartesian coordinates.*)BeginPackage["Calculator`XYPlot`"]GetKnownCalculators::usage = "GetKnownCalculators[] displays a list of names of \known calculators.";SetCalculator::usage = "SetCalculator[c_String] selects the calculator model named \in 'c'.";GetCalculatorDefaultRange::usage = "GetCalculatorDefaultRange[] returns the default \scope of the calculator's display window.";CalcXYPlot::usage = "CalcXYPlot[ f_, var_Symbol, opts___  ] sketches the graph of \the function 'f' of one variable 'var' using options 'opts' in the calculator's \standard window.";CalcXYPlotArray::usage = "CalcXYPlotArray[ eqnlist_List, var_Symbol, title_String, \opts___ ] sketches the graph of the functions of one variable 'var' that are listed \in 'eqnlist', using options 'opts' in the calculator's standard window.  This is \accomplished by calling CalcXYPlot repeatedly.  The arrangement of the plots in the \final sketch is determined by the structure of the input list 'eqnlist'";Begin["`Private`"]Off[ General::spell1 ];HP38G=HP48G=HP48GX={{-6.5,6.5},{-3.1,3.2}};                     (* Hewlett-Packard *)TI82={{-10,10},{-10,10}};                                     (* Texas Instruments *)EL9200=EL9200C=EL9300=EL9300C={{-4.6,4.6},{-3.1,3.1}};        (* Sharp Electronics *)FX9700GE={{-6.3,6.3},{-3.706,3.706}};                                     (* CASIO *)CFX9800GW={{-4.7,4.7},{-3.1,3.1}};                                        (* CASIO *)KnownCalcs={"HP38G","HP48G","HP48GX",            "TI82",            "EL9200","EL9200C","EL9300","EL9300C",            "FX9700GE","CFX9800GW"};GetKnownCalculators[]:=KnownCalcs;CALC={"Unknown Calculator"};ASPECTRATIO=.;SetCalculator::unknown = "You have specified an unknown calculator.";SetCalculator[ c_String ]:=          If[ MemberQ[ KnownCalcs, c ]            , CALC=ToExpression[ StringJoin[ Context[HP38G], c] ];              ASPECTRATIO=(CALC[[2,2]]-CALC[[2,1]])/(CALC[[1,2]]-CALC[[1,1]])            , CALC={"Unknown Calculator"}; Message[ SetCalculator::unknown ];              ASPECTRATIO=.;            ];GetCalculatorDefaultRange[] := CALC;CalcXYPlot[ f_, var_Symbol, opts___  ]:=  Module[ {p}        , If[ Head[CALC[[1]]]==String            , Message[ SetCalculator::unknown ]; Return[ Null ]            ];          Off[ Plot::plnr ];          SetOptions[ Plot, PlotRange->CALC                          , DisplayFunction->$DisplayFunction                          , PlotLabel->""                    ];          SetOptions[ Plot, opts ];          p=Plot[ Evaluate[f/.var->xx]                , { xx, CALC[[1,1]], CALC[[1,2]] }                , Ticks->None                , Frame->True                , FrameTicks->Automatic                , AspectRatio->ASPECTRATIO                , DefaultFont->{"Courier",8}                ];          On[ Plot::plnr ];          Return[p]        ];CalcXYPlotArray[ eqnlist_List, var_Symbol, title_String, opts___ ]:=   Module[ {ga}         , Block[ {$DisplayFunction=Identity}                , ga=GraphicsArray[ Map[ CalcXYPlot[ #, var, opts ]&                                  , eqnlist                                  , {Length[Dimensions[eqnlist]]}                                  ]                             ]                ];           Show[ ga               , DefaultFont->{"Courier",8}               , PlotLabel->title               ]       ];Protect[ GetKnownCalculators       , SetCalculator       , GetCalculatorDefaultRange       , CalcXYPlot       , CalcXYPlotArray       ];On[ General::spell1 ];End[];EndPackage[];(* Examples of usage:  (Uncomment to exercise) *)(*CALCNAME="HP38G";  (* Change to produce sample displays for another calculator. *)(* Boilerplate *)fns ={ { 3x^4-6x^2     , (x^4+4x^3)/27 },       { x*Sqrt[4-x]   , x*Sqrt[4-x^2] },       { (10*x)/(1+x^2), 10/(1+x^2)    } };title1=StringJoin["Demo of CalcXYPlot for the ",CALCNAME];title2=StringJoin["Demo of CalcXYPlotArray for the ",CALCNAME];SetCalculator[ CALCNAME ];Print[ "" ];Print[ "Subroutines available:" ];Message[ GetKnownCalculators::usage ];Message[ SetCalculator::usage ];Message[ GetCalculatorDefaultRange::usage ];Message[ CalcXYPlot::usage ];Message[ CalcXYPlotArray::usage ];Print[ "" ];Print[ "The following calculators are currently supported by this package:" ];Print[ "" ];Print[ GetKnownCalculators[] ];Print[ "" ];Print[ "Currently, we have selected the ",CALCNAME,"." ]Print[ "The range of its default display is ", GetCalculatorDefaultRange[], "." ];Print[ "" ];CalcXYPlot[ fns[[1,1]],x, PlotLabel->title1 ];CalcXYPlotArray[ fns, x, title2 ];Remove[fns];*)