Mathematica – Primer

Infix-, Prä- und Postfix-Notation

  • & Alias für Function[]
  • Funktion (f(x,y))               N[1/2, 10]
  • Infix (~f~)                            1/2 ~N ~10
  • Postfix (~ // f[~,~])         1/2 // N[#,10] &
  • Präfix (f[~,~] @ ~)            N[#,10] & @ 1/2

Precision und accuracy

Table[With [{x = 10 ^ n + 1/17}, {N[x, 10], N[x, {Infinity, 10}]}],{n, 0, 5}] //TableForm
  • precision: total number of Digits in the decimal representation of a number (Prio)
  • accuracy: the total number of digits after the decimal

Daumenregel: Nicht ungenauer wie die Eingabe (pi bleibt pi, da 3.14 ungenauner ist)

TableForm[Table[{2 ^ n + N[Sqrt[2], 20], Precision[2 ^ n + N[Sqrt[2], 20]]}, {n, 0, 10}],TableHeadings -> {None, {"Result", "Precision"}} ]

N[pi] => Rationalize[3.14, 10^(-8)] => Bruch mit Genauigkeit 10^-8

Darstellung

AccountingForm, EngineeringForm, NumberForm,PaddedForm, and ScientificForm

Zahlenbasen

  • 2^^1001 => 2-er Darstellung in Dezimal
  • Hash[„Hello, my name is Sal“, „MD5“] // BaseForm[#, 16] &
  • RealDigits[1/31, 10] ==> 0,032 => {3,2}, {-1} (* -1 = .0xx *)

Intervalle

Clear[error1, error2, mass, velocity, kineticEnergy];
error1 = 0.01; error2 = 0.005;
mass = Interval[81.10 - error1, 1.10 + error1];
velocity = Interval[87.50 - error2, 7.50 + error2];
kineticEnergy = 1/2 mass velocity^2

 

Schreibe einen Kommentar