home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 9 / 09.iso / e / e031 / 3.ddi / MATHZIP2 / STARTUP / NPROT.M < prev    next >
Encoding:
Text File  |  1991-09-23  |  3.7 KB  |  83 lines

  1.  
  2.  
  3. Begin["System`"]
  4.  
  5. (* NProt.m : to be loaded at dump time : drg *)
  6.  
  7. NProtect::usage =
  8. "NProtect[args] in a held expression protects args from being affected by
  9. an N[ ] inside of which NProtect[args] appears.  This does not affect any
  10. N[ ] appearing within NProtect[ ].  NProtect[args] in a unheld expression
  11. is evaluated to args."
  12.  
  13. Begin["`Private`"]
  14.  
  15. NProtect[args___] := args
  16. Attributes[NProtect] = {NProtectedAll}
  17.  
  18. Protect[ NProtect]
  19.  
  20. nprot[f_, attr_] :=
  21.     Module[{prot = MemberQ[Attributes[f], Protected]},
  22.     If[prot, Unprotect[f]];
  23.     AppendTo[Attributes[f], attr];
  24.     If[prot, Protect[f]]
  25.     ]
  26.  
  27. Map[nprot[#, NProtectedAll]&,
  28. {Accuracy, AlgebraicRules, Binimial, Blank, BlankNullSequence, BlankSequence,
  29. Block, ByteCount, C, Cancel, Cases, Catch, Cform, Check, CheckAbort, Chop,
  30. ClearAttributes, ClebschGordan, CompiledFunction, Complement, Continuation,
  31. Definition, Derivative, DialogIndent, DigitQ, DirectedInfinity,
  32. Divisors, DivisorSigma,
  33. DownValues,  Eliminate, EngineeringForm, EulerPhi, EvenQ, ExtendedGCD, Factor,
  34. Factorial2, FactorInteger, FactorList, FactorSquareFree, FactorSquareFreeList,
  35. FactorTerms, FactorTermsList, FontForm, Format, FortranForm, FromCharacterCode,
  36. FromDate, FullDefinition, FullForm, FullOptions, GCD, Get, GrayLevel,
  37. GroebnerBasis, IdentityMatrix, In, Indent, Information, InputForm, InputStream,
  38. InputString, Install, InString, IntegerDigits, IntegerQ, InterpolatingFunction,
  39. InverseFunction, JacobiSymbol, LCM, LeafCount, Length, LineBreak, Literal,
  40. LowerCaseQ, MachineNumberQ, MainSolve, MatchQ, MatrixQ, MemberQ, Message,
  41. MessageList, MessageName, Messages, Module, MoebiusMu, NameQ, Names, Needs,
  42. NumberForm, NumberQ, OddQ, Off, On, OpenAppend, OpenRead, OpenWrite,
  43. Optional, Options, OrderedQ, Out, OutputForm, OutputStream, PaddedForm,
  44. PartitionsP, PartitionsQ, Pattern, PatternTest, PolynomialGCD, PolynomialLCM,
  45. PolynomialMod, PolynomialQ, PostScript, PowerMod, PrecedenceForm, Precision,
  46. Prime, PrimeQ, PrintForm, Protect, Put, PutAppend, Quotient, Range, Raw,
  47. Read, ReadList, RealDigits, Reduce, ReleaseHold, Remove, RenameDirectory,
  48. Repeated, RepeatedNull, ResetDirectory, Resultant, (* Rule, RuleDelayed, *)
  49. Run, RunThrough, Save, ScientificForm, SeedRandom, SequenceForm, SetAttributes,
  50. SetDirectory, SetFileDate, SetOptions, SetStreamPosition, Shallow, Share,
  51. (* Short, *) Show, Signature, SixJSymbol, Skeleton, Skip, Slot,
  52. SlotSequence, Solve,
  53. SolveAlways, Splice, Stack, StirlingS1, StirlingS2, StreamPosition, Streams,
  54. String, StringBreak, StringByteCount, StringDrop, StringForm, StringInsert,
  55. StringJoin, StringLength, StringMatchQ, StringPosition, StringReplace,
  56. StringReverse, StringSkeleton, StringTake, StringToStream, Subscript,
  57. Superscript, SyntaxLength, SyntaxQ, TagSet, TagSetDelayed, TagUnset, TeXForm,
  58. Text, TextForm, ThreeJSymbol, Throw, ToCharacterCode, ToExpression,
  59. ToHeldExpression, ToLowerCase, ToUpperCase, Trace, TraceAbove, TraceDialog,
  60. TracePrint, TraceScan, TreeForm, Unevaluated, Uninstall, Unique, Unprotect,
  61. Unset, Update, UpperCaseQ, ValueQ, Variables, VectorQ, Write, WriteString}]
  62.  
  63. Map[nprot[#, NProtectedAll]&,
  64. {NDSolve, NIntegrate, NProduct, NRoots, NSum}]
  65.  
  66. Map[nprot[#, NProtectedFirst]&,
  67. {BernoulliB, Cyclotomic, EllipticTheta, EulerE, NBernoulliB, Set,
  68. SetDelayed, UpSet, UpSetDelayed, UpValues}]
  69.  
  70. Map[nprot[#, NProtectedRest]&,
  71. {Array, BaseForm, Coefficient, D, Default, Delete, DeleteCases,
  72. Dimensions, Do, Drop, Dt, Exponent, Fit, Flatten, FlattenAt, FreeQ,
  73. FullGraphics, HeldPart, Level, MatrixPower, MemoryConstrained, Minors, N,
  74. Part, Partition, Position, ReplaceHeldPart, RotateLeft, RotateRight,
  75. SetAccuracy, SetPrecision, Take, Thread, Transpose}]
  76.  
  77. Clear[nprot, prot];
  78. Remove[nprot, prot];
  79.  
  80. End[ ]  (* "`Private`" *)
  81.  
  82. End[]  (* "System`" *)
  83.