SlideServe
Menu
Préférences
© SlideServe · v2026

Function Call Trace

karsen avatar
36 diapositives · 503 Views · Sep 01, 2014

Function Call Trace. public class Newton { public static double sqrt ( double c ) { double epsilon = 1e-15 ; if ( c < 0 ) return Double . NaN ; double t = c ; while ( Math . abs ( t - c / t ) > epsilon * t ) t = ( c / t + t ) / 2.0 ;

Function Call Trace - slide 1
01 / 36Function Call Trace
1 / 17

Télécharger la présentation

Function Call Trace
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. Function Call Trace publicclass Newton { public staticdouble sqrt(double c) { double epsilon =1e-15; if (c < 0) return Double.NaN; double t = c; while(Math.abs(t - c/t)> epsilon * t) t =(c/t + t)/2.0; return t; } public static void main(String[] args) { double[] a = new double[args.length]; for (int i = 0; i < args.length; i++) a[i] = Double.parseDouble(args[i]); for (int i = 0; i < a.length; i++) System.out.println(sqrt(a[i])); } }

  2. Function Call Trace publicclass Newton { public staticdouble sqrt(double c) { double epsilon =1e-15; if (c < 0) return Double.NaN; double t = c; while(Math.abs(t - c/t)> epsilon * t) t =(c/t + t)/2.0; return t; } public static void main(String[] args) { double[] a = new double[args.length]; for (int i = 0; i < args.length; i++) a[i] = Double.parseDouble(args[i]); for (int i = 0; i < a.length; i++) System.out.println(sqrt(a[i])); } } % java Newton 1 2 3

  3. Function Call Trace publicclass Newton { public staticdouble sqrt(double c) { double epsilon =1e-15; if (c < 0) return Double.NaN; double t = c; while(Math.abs(t - c/t)> epsilon * t) t =(c/t + t)/2.0; return t; } public static void main(String[] args) { double[] a = new double[args.length]; for (int i = 0; i < args.length; i++) a[i] = Double.parseDouble(args[i]); for (int i = 0; i < a.length; i++) System.out.println(sqrt(a[i])); } } { "1", "2", "3" } args[] { "1", "2", "3" } % java Newton 1 2 3

  4. Function Call Trace publicclass Newton { public staticdouble sqrt(double c) { double epsilon =1e-15; if (c < 0) return Double.NaN; double t = c; while(Math.abs(t - c/t)> epsilon * t) t =(c/t + t)/2.0; return t; } public static void main(String[] args) { double[] a = new double[args.length]; for (int i = 0; i < args.length; i++) a[i] = Double.parseDouble(args[i]); for (int i = 0; i < a.length; i++) System.out.println(sqrt(a[i])); } } args[] { "1", "2", "3" } a[] { 0.0, 0.0, 0.0 } % java Newton 1 2 3

  5. Function Call Trace publicclass Newton { public staticdouble sqrt(double c) { double epsilon =1e-15; if (c < 0) return Double.NaN; double t = c; while(Math.abs(t - c/t)> epsilon * t) t =(c/t + t)/2.0; return t; } public static void main(String[] args) { double[] a = new double[args.length]; for (int i = 0; i < args.length; i++) a[i] = Double.parseDouble(args[i]); for (int i = 0; i < a.length; i++) System.out.println(sqrt(a[i])); } } args[] { "1", "2", "3" } a[] { 0.0, 0.0, 0.0 } i 0 % java Newton 1 2 3

  6. Function Call Trace publicclass Newton { public staticdouble sqrt(double c) { double epsilon =1e-15; if (c < 0) return Double.NaN; double t = c; while(Math.abs(t - c/t)> epsilon * t) t =(c/t + t)/2.0; return t; } public static void main(String[] args) { double[] a = new double[args.length]; for (int i = 0; i < args.length; i++) a[i] = Double.parseDouble(args[i]); for (int i = 0; i < a.length; i++) System.out.println(sqrt(a[i])); } } args[] { "1", "2", "3" } a[] { 1.0, 0.0, 0.0 } i 0 % java Newton 1 2 3

  7. Function Call Trace publicclass Newton { public staticdouble sqrt(double c) { double epsilon =1e-15; if (c < 0) return Double.NaN; double t = c; while(Math.abs(t - c/t)> epsilon * t) t =(c/t + t)/2.0; return t; } public static void main(String[] args) { double[] a = new double[args.length]; for (int i = 0; i < args.length; i++) a[i] = Double.parseDouble(args[i]); for (int i = 0; i < a.length; i++) System.out.println(sqrt(a[i])); } } args[] { "1", "2", "3" } a[] { 1.0, 0.0, 0.0 } i 1 % java Newton 1 2 3

  8. Function Call Trace publicclass Newton { public staticdouble sqrt(double c) { double epsilon =1e-15; if (c < 0) return Double.NaN; double t = c; while(Math.abs(t - c/t)> epsilon * t) t =(c/t + t)/2.0; return t; } public static void main(String[] args) { double[] a = new double[args.length]; for (int i = 0; i < args.length; i++) a[i] = Double.parseDouble(args[i]); for (int i = 0; i < a.length; i++) System.out.println(sqrt(a[i])); } } args[] { "1", "2", "3" } a[] { 1.0, 2.0, 0.0 } i 1 % java Newton 1 2 3

  9. Function Call Trace publicclass Newton { public staticdouble sqrt(double c) { double epsilon =1e-15; if (c < 0) return Double.NaN; double t = c; while(Math.abs(t - c/t)> epsilon * t) t =(c/t + t)/2.0; return t; } public static void main(String[] args) { double[] a = new double[args.length]; for (int i = 0; i < args.length; i++) a[i] = Double.parseDouble(args[i]); for (int i = 0; i < a.length; i++) System.out.println(sqrt(a[i])); } } args[] { "1", "2", "3" } a[] { 1.0, 2.0, 0.0 } i 2 % java Newton 1 2 3

  10. Function Call Trace publicclass Newton { public staticdouble sqrt(double c) { double epsilon =1e-15; if (c < 0) return Double.NaN; double t = c; while(Math.abs(t - c/t)> epsilon * t) t =(c/t + t)/2.0; return t; } public static void main(String[] args) { double[] a = new double[args.length]; for (int i = 0; i < args.length; i++) a[i] = Double.parseDouble(args[i]); for (int i = 0; i < a.length; i++) System.out.println(sqrt(a[i])); } } args[] { "1", "2", "3" } a[] { 1.0, 2.0, 3.0 } i 2 % java Newton 1 2 3

  11. Function Call Trace publicclass Newton { public staticdouble sqrt(double c) { double epsilon =1e-15; if (c < 0) return Double.NaN; double t = c; while(Math.abs(t - c/t)> epsilon * t) t =(c/t + t)/2.0; return t; } public static void main(String[] args) { double[] a = new double[args.length]; for (int i = 0; i < args.length; i++) a[i] = Double.parseDouble(args[i]); for (int i = 0; i < a.length; i++) System.out.println(sqrt(a[i])); } } args[] { "1", "2", "3" } a[] { 1.0, 2.0, 3.0 } i 3 goes outof scope % java Newton 1 2 3

  12. Function Call Trace publicclass Newton { public staticdouble sqrt(double c) { double epsilon =1e-15; if (c < 0) return Double.NaN; double t = c; while(Math.abs(t - c/t)> epsilon * t) t =(c/t + t)/2.0; return t; } public static void main(String[] args) { double[] a = new double[args.length]; for (int i = 0; i < args.length; i++) a[i] = Double.parseDouble(args[i]); for (int i = 0; i < a.length; i++) System.out.println(sqrt(a[i])); } } args[] { "1", "2", "3" } a[] { 1.0, 2.0, 3.0 } i 0 % java Newton 1 2 3

  13. Function Call Trace publicclass Newton { public staticdouble sqrt(double c) { double epsilon =1e-15; if (c < 0) return Double.NaN; double t = c; while(Math.abs(t - c/t)> epsilon * t) t =(c/t + t)/2.0; return t; } public static void main(String[] args) { double[] a = new double[args.length]; for (int i = 0; i < args.length; i++) a[i] = Double.parseDouble(args[i]); for (int i = 0; i < a.length; i++) System.out.println(sqrt(a[i])); } } 1.0 args[] { "1", "2", "3" } a[] { 1.0, 2.0, 3.0 } i 0 1.0 % java Newton 1 2 3

  14. Function Call Trace publicclass Newton { public staticdouble sqrt(double c) { double epsilon =1e-15; if (c < 0) return Double.NaN; double t = c; while(Math.abs(t - c/t)> epsilon * t) t =(c/t + t)/2.0; return t; } public static void main(String[] args) { double[] a = new double[args.length]; for (int i = 0; i < args.length; i++) a[i] = Double.parseDouble(args[i]); for (int i = 0; i < a.length; i++) System.out.println(sqrt(a[i])); } } 1.0 c 1.0 args[] { "1", "2", "3" } a[] { 1.0, 2.0, 3.0 } i 0 1.0 % java Newton 1 2 3

  15. Function Call Trace publicclass Newton { public staticdouble sqrt(double c) { double epsilon =1e-15; if (c < 0) return Double.NaN; double t = c; while(Math.abs(t - c/t)> epsilon * t) t =(c/t + t)/2.0; return t; } public static void main(String[] args) { double[] a = new double[args.length]; for (int i = 0; i < args.length; i++) a[i] = Double.parseDouble(args[i]); for (int i = 0; i < a.length; i++) System.out.println(sqrt(a[i])); } } c 1.0 args[] { "1", "2", "3" } a[] { 1.0, 2.0, 3.0 } i 0 % java Newton 1 2 3

  16. Function Call Trace publicclass Newton { public staticdouble sqrt(double c) { double epsilon =1e-15; if (c < 0) return Double.NaN; double t = c; while(Math.abs(t - c/t)> epsilon * t) t =(c/t + t)/2.0; return t; } public static void main(String[] args) { double[] a = new double[args.length]; for (int i = 0; i < args.length; i++) a[i] = Double.parseDouble(args[i]); for (int i = 0; i < a.length; i++) System.out.println(sqrt(a[i])); } } c 1.0 args[] { "1", "2", "3" } a[] { 1.0, 2.0, 3.0 } i 0 % java Newton 1 2 3

  17. Function Call Trace publicclass Newton { public staticdouble sqrt(double c) { double epsilon =1e-15; if (c < 0) return Double.NaN; double t = c; while(Math.abs(t - c/t)> epsilon * t) t =(c/t + t)/2.0; return t; } public static void main(String[] args) { double[] a = new double[args.length]; for (int i = 0; i < args.length; i++) a[i] = Double.parseDouble(args[i]); for (int i = 0; i < a.length; i++) System.out.println(sqrt(a[i])); } } c t 1.0 1.0 args[] { "1", "2", "3" } a[] { 1.0, 2.0, 3.0 } i 0 % java Newton 1 2 3

  18. Function Call Trace publicclass Newton { public staticdouble sqrt(double c) { double epsilon =1e-15; if (c < 0) return Double.NaN; double t = c; while(Math.abs(t - c/t)> epsilon * t) t =(c/t + t)/2.0; return t; } public static void main(String[] args) { double[] a = new double[args.length]; for (int i = 0; i < args.length; i++) a[i] = Double.parseDouble(args[i]); for (int i = 0; i < a.length; i++) System.out.println(sqrt(a[i])); } } c t 1.0 1.0 args[] { "1", "2", "3" } a[] { 1.0, 2.0, 3.0 } i 0 % java Newton 1 2 3

  19. Function Call Trace publicclass Newton { public staticdouble sqrt(double c) { double epsilon =1e-15; if (c < 0) return Double.NaN; double t = c; while(Math.abs(t - c/t)> epsilon * t) t =(c/t + t)/2.0; return t; } public static void main(String[] args) { double[] a = new double[args.length]; for (int i = 0; i < args.length; i++) a[i] = Double.parseDouble(args[i]); for (int i = 0; i < a.length; i++) System.out.println(sqrt(a[i])); } } c t 1.0 1.0 args[] 1.0 { "1", "2", "3" } a[] { 1.0, 2.0, 3.0 } i 0 1.0 % java Newton 1 2 3

  20. Function Call Trace publicclass Newton { public staticdouble sqrt(double c) { double epsilon =1e-15; if (c < 0) return Double.NaN; double t = c; while(Math.abs(t - c/t)> epsilon * t) t =(c/t + t)/2.0; return t; } public static void main(String[] args) { double[] a = new double[args.length]; for (int i = 0; i < args.length; i++) a[i] = Double.parseDouble(args[i]); for (int i = 0; i < a.length; i++) System.out.println(sqrt(a[i])); } } args[] { "1", "2", "3" } a[] { 1.0, 2.0, 3.0 } i 0 1.0 % java Newton 1 2 3 1.0

  21. Function Call Trace publicclass Newton { public staticdouble sqrt(double c) { double epsilon =1e-15; if (c < 0) return Double.NaN; double t = c; while(Math.abs(t - c/t)> epsilon * t) t =(c/t + t)/2.0; return t; } public static void main(String[] args) { double[] a = new double[args.length]; for (int i = 0; i < args.length; i++) a[i] = Double.parseDouble(args[i]); for (int i = 0; i < a.length; i++) System.out.println(sqrt(a[i])); } } args[] { "1", "2", "3" } a[] { 1.0, 2.0, 3.0 } i 1 % java Newton 1 2 3 1.0

  22. Function Call Trace publicclass Newton { public staticdouble sqrt(double c) { double epsilon =1e-15; if (c < 0) return Double.NaN; double t = c; while(Math.abs(t - c/t)> epsilon * t) t =(c/t + t)/2.0; return t; } public static void main(String[] args) { double[] a = new double[args.length]; for (int i = 0; i < args.length; i++) a[i] = Double.parseDouble(args[i]); for (int i = 0; i < a.length; i++) System.out.println(sqrt(a[i])); } } 2.0 c 2.0 args[] { "1", "2", "3" } a[] { 1.0, 2.0, 3.0 } i 1 2.0 % java Newton 1 2 3 1.0

  23. Function Call Trace publicclass Newton { public staticdouble sqrt(double c) { double epsilon =1e-15; if (c < 0) return Double.NaN; double t = c; while(Math.abs(t - c/t)> epsilon * t) t =(c/t + t)/2.0; return t; } public static void main(String[] args) { double[] a = new double[args.length]; for (int i = 0; i < args.length; i++) a[i] = Double.parseDouble(args[i]); for (int i = 0; i < a.length; i++) System.out.println(sqrt(a[i])); } } c 2.0 args[] { "1", "2", "3" } a[] { 1.0, 2.0, 3.0 } i 1 % java Newton 1 2 3 1.0

  24. Function Call Trace publicclass Newton { public staticdouble sqrt(double c) { double epsilon =1e-15; if (c < 0) return Double.NaN; double t = c; while(Math.abs(t - c/t)> epsilon * t) t =(c/t + t)/2.0; return t; } public static void main(String[] args) { double[] a = new double[args.length]; for (int i = 0; i < args.length; i++) a[i] = Double.parseDouble(args[i]); for (int i = 0; i < a.length; i++) System.out.println(sqrt(a[i])); } } c 2.0 args[] { "1", "2", "3" } a[] { 1.0, 2.0, 3.0 } i 1 % java Newton 1 2 3 1.0

  25. Function Call Trace publicclass Newton { public staticdouble sqrt(double c) { double epsilon =1e-15; if (c < 0) return Double.NaN; double t = c; while(Math.abs(t - c/t)> epsilon * t) t =(c/t + t)/2.0; return t; } public static void main(String[] args) { double[] a = new double[args.length]; for (int i = 0; i < args.length; i++) a[i] = Double.parseDouble(args[i]); for (int i = 0; i < a.length; i++) System.out.println(sqrt(a[i])); } } c t 2.0 2.0 args[] { "1", "2", "3" } a[] { 1.0, 2.0, 3.0 } i 1 % java Newton 1 2 3 1.0

  26. Function Call Trace publicclass Newton { public staticdouble sqrt(double c) { double epsilon =1e-15; if (c < 0) return Double.NaN; double t = c; while(Math.abs(t - c/t)> epsilon * t) t =(c/t + t)/2.0; return t; } public static void main(String[] args) { double[] a = new double[args.length]; for (int i = 0; i < args.length; i++) a[i] = Double.parseDouble(args[i]); for (int i = 0; i < a.length; i++) System.out.println(sqrt(a[i])); } } c t 2.0 2.0 args[] { "1", "2", "3" } a[] { 1.0, 2.0, 3.0 } i 1 % java Newton 1 2 3 1.0

  27. Function Call Trace publicclass Newton { public staticdouble sqrt(double c) { double epsilon =1e-15; if (c < 0) return Double.NaN; double t = c; while(Math.abs(t - c/t)> epsilon * t) t =(c/t + t)/2.0; return t; } public static void main(String[] args) { double[] a = new double[args.length]; for (int i = 0; i < args.length; i++) a[i] = Double.parseDouble(args[i]); for (int i = 0; i < a.length; i++) System.out.println(sqrt(a[i])); } } c t 2.0 1.41 args[] { "1", "2", "3" } a[] { 1.0, 2.0, 3.0 } i 1 % java Newton 1 2 3 1.0

  28. Function Call Trace publicclass Newton { public staticdouble sqrt(double c) { double epsilon =1e-15; if (c < 0) return Double.NaN; double t = c; while(Math.abs(t - c/t)> epsilon * t) t =(c/t + t)/2.0; return t; } public static void main(String[] args) { double[] a = new double[args.length]; for (int i = 0; i < args.length; i++) a[i] = Double.parseDouble(args[i]); for (int i = 0; i < a.length; i++) System.out.println(sqrt(a[i])); } } c t 2.0 1.41 args[] { "1", "2", "3" } a[] { 1.0, 2.0, 3.0 } i 1 % java Newton 1 2 3 1.0

  29. Function Call Trace publicclass Newton { public staticdouble sqrt(double c) { double epsilon =1e-15; if (c < 0) return Double.NaN; double t = c; while(Math.abs(t - c/t)> epsilon * t) t =(c/t + t)/2.0; return t; } public static void main(String[] args) { double[] a = new double[args.length]; for (int i = 0; i < args.length; i++) a[i] = Double.parseDouble(args[i]); for (int i = 0; i < a.length; i++) System.out.println(sqrt(a[i])); } } c t 2.0 1.41 args[] 1.414213562373095 { "1", "2", "3" } a[] { 1.0, 2.0, 3.0 } i 1 1.414213562373095 % java Newton 1 2 3 1.0

  30. Function Call Trace publicclass Newton { public staticdouble sqrt(double c) { double epsilon =1e-15; if (c < 0) return Double.NaN; double t = c; while(Math.abs(t - c/t)> epsilon * t) t =(c/t + t)/2.0; return t; } public static void main(String[] args) { double[] a = new double[args.length]; for (int i = 0; i < args.length; i++) a[i] = Double.parseDouble(args[i]); for (int i = 0; i < a.length; i++) System.out.println(sqrt(a[i])); } } args[] { "1", "2", "3" } a[] { 1.0, 2.0, 3.0 } i 1 1.414213562373095 % java Newton 1 2 3 1.0 1.414213562373095

  31. Function Call Trace publicclass Newton { public staticdouble sqrt(double c) { double epsilon =1e-15; if (c < 0) return Double.NaN; double t = c; while(Math.abs(t - c/t)> epsilon * t) t =(c/t + t)/2.0; return t; } public static void main(String[] args) { double[] a = new double[args.length]; for (int i = 0; i < args.length; i++) a[i] = Double.parseDouble(args[i]); for (int i = 0; i < a.length; i++) System.out.println(sqrt(a[i])); } } args[] { "1", "2", "3" } a[] { 1.0, 2.0, 3.0 } i 2 % java Newton 1 2 3 1.0 1.414213562373095

  32. Function Call Trace publicclass Newton { public staticdouble sqrt(double c) { double epsilon =1e-15; if (c < 0) return Double.NaN; double t = c; while(Math.abs(t - c/t)> epsilon * t) t =(c/t + t)/2.0; return t; } public static void main(String[] args) { double[] a = new double[args.length]; for (int i = 0; i < args.length; i++) a[i] = Double.parseDouble(args[i]); for (int i = 0; i < a.length; i++) System.out.println(sqrt(a[i])); } } 3.0 c 3.0 args[] { "1", "2", "3" } a[] { 1.0, 2.0, 3.0 } i 2 3.0 % java Newton 1 2 3 1.0 1.414213562373095

  33. Function Call Trace publicclass Newton { public staticdouble sqrt(double c) { double epsilon =1e-15; if (c < 0) return Double.NaN; double t = c; while(Math.abs(t - c/t)> epsilon * t) t =(c/t + t)/2.0; return t; } public static void main(String[] args) { double[] a = new double[args.length]; for (int i = 0; i < args.length; i++) a[i] = Double.parseDouble(args[i]); for (int i = 0; i < a.length; i++) System.out.println(sqrt(a[i])); } } c 3.0 args[] 1.7320508075688772 { "1", "2", "3" } a[] { 1.0, 2.0, 3.0 } i 2 1.7320508075688772 % java Newton 1 2 3 1.0 1.414213562373095

  34. Function Call Trace publicclass Newton { public staticdouble sqrt(double c) { double epsilon =1e-15; if (c < 0) return Double.NaN; double t = c; while(Math.abs(t - c/t)> epsilon * t) t =(c/t + t)/2.0; return t; } public static void main(String[] args) { double[] a = new double[args.length]; for (int i = 0; i < args.length; i++) a[i] = Double.parseDouble(args[i]); for (int i = 0; i < a.length; i++) System.out.println(sqrt(a[i])); } } args[] { "1", "2", "3" } a[] { 1.0, 2.0, 3.0 } i 2 % java Newton 1 2 3 1.0 1.414213562373095 1.7320508075688772

  35. Function Call Trace publicclass Newton { public staticdouble sqrt(double c) { double epsilon =1e-15; if (c < 0) return Double.NaN; double t = c; while(Math.abs(t - c/t)> epsilon * t) t =(c/t + t)/2.0; return t; } public static void main(String[] args) { double[] a = new double[args.length]; for (int i = 0; i < args.length; i++) a[i] = Double.parseDouble(args[i]); for (int i = 0; i < a.length; i++) System.out.println(sqrt(a[i])); } } args[] { "1", "2", "3" } a[] { 1.0, 2.0, 3.0 } i 3 % java Newton 1 2 3 1.0 1.414213562373095 1.7320508075688772

  36. Function Call Trace publicclass Newton { public staticdouble sqrt(double c) { double epsilon =1e-15; if (c < 0) return Double.NaN; double t = c; while(Math.abs(t - c/t)> epsilon * t) t =(c/t + t)/2.0; return t; } public static void main(String[] args) { double[] a = new double[args.length]; for (int i = 0; i < args.length; i++) a[i] = Double.parseDouble(args[i]); for (int i = 0; i < a.length; i++) System.out.println(sqrt(a[i])); } } args[] { "1", "2", "3" } a[] { 1.0, 2.0, 3.0 } % java Newton 1 2 3 1.0 1.414213562373095 1.7320508075688772