• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# Untitled

a guest Mar 25th, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. Postupak polovljenja
2.
3. Polovi[izr_, var_, a0_, b0_, maxiter_] :=
4.  Module[{a = a0, b = b0, c, izrc, k = 0, radi = True, niz = {}},
5.   While[radi \[And] k++ < maxiter,
6.    c = (a + b)/2.;
7.    niz = Append[niz, c];
8.    izrc = izr /. var -> c;
9.    If[izrc == 0, radi = False];
10.    If[(izr /. var -> a) izrc < 0,
11.     b = c,
12.     a = c
13.     ]
14.    ];
15.   niz
16.   ]
17. f[x_] = Log[x - 1] - Sin[x]
18. Plot[f[x], {x, 2, 3}]
19. iterniz = Polovi[f[x], x, 2, 3, 5]
20. Map[{#, gr[#]} &, iterniz]
21.
22.
23. lagranzova ocena
24. gr[x0_] = Abs[f[x0]]/1.4
25.
26. \[Xi] = x /. FindRoot[f[x], {x, 2.6}]
27. Plot[{gr[x0], Abs[x0 - \[Xi]]}, {x0, 2, 3}]
28.
29.
30. njutnov postupak:
31. f1[x_] = D[f[x], x] // Simplify
32. njk[x_] := x - f[x]/f1[x]
33. x0 = 3.711;
34. x1 = njk[x0]
35. x2 = njk[x1]
36. x3 = njk[x2]
37. iterniz = {x0, x1, x2, x3, x4}
38. \[Xi] - iterniz // Abs
39.
40. NestList[njk, 3.711, 5]
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

Top