OBLICZENIA NUMERYCZNE, Karolina Mikulska-Ruminska Kurs komputerowy S - Mathematica - cz. Suma i iloczyn elementow ciagu NSum[wyr, {zm, w_pocz, w_konc}], NProduct[wyr, {zm, w_pocz, w_konc}]? *Sum* System` DivisorSum NSum NSumTerms ParallelSum RootSum SumConvergence Sum UniformSumDistribution NSum@1 x ^, x, 1, 0<D 1.00 NSum@1 x ^, x, 1, Infinity<D 1.9 Sum@1 x ^, x, 1, Infinity<D Π Pi ^.0 1.9 Options@NSumD AccuracyGoal, Compiled Automatic, EvaluationMonitor None, Method Automatic, NSumTerms 1, PrecisionGoal Automatic, VerifyConvergence True, WorkingPrecision MachinePrecision< NSum@1 x ^, x, 1, Infinity<, WorkingPrecision 0D 1.90
KursS_cz.nb NSum@1 x ^, x, 1, <, WorkingPrecision 0, EvaluationMonitor :> Print@"x ", x, "\t", N@1 x ^, DDD x 1.0000000000000000000 1.0000 x.0000000000000000000 0.000 x.0000000000000000000 0.11111 x.0000000000000000000 0.000 x.0000000000000000000 0.00000 1.111111111111111 NProduct@x ^ Hx + L, x, 1, <D 19.1 Product@x ^ Hx + L, x, 1, <D 90 00 19 N@%D H* otrzymamy numeryczna postac wyrazenia *L 19.1 Rozwiazywanie rownan NSolve[rown, zm] rown x ^ + x - 0 - + x + x 0 NSolve@rown, xd x -.0<, x 0.0<< Solve@rown, xd 99x - -, 9x - + Clear@a, b, cd
KursS_cz.nb NSolve@a x ^ + b x + c 0, xd ::x 0. - 1. b - 1. b -. a c a >, :x b -. a c 0. - 1. b + a FindRoot[wielomian, zm] w x^ - x^ - x^ + x + FindRoot@w, x, 1<D + x - x - x + x x 1.< FindRoot@w, x, - 1<D x - 1.< Plot@w, x, -, <D 0 - -1 1 - -0 >>
KursS_cz.nb Interpolacja, ekstrapolacja, aproksymacja Interpolation[dane], gdzie dane {k1,k,k} lub dane{{x1,y1}, {x,y}, {x,y},.., {xn, yn}} lub dane {{{x1,k1,...}, y1}, {{x,k,..},y},...} Interpolation[dane, wart] f Interpolation@1,,,,,,,, <D InterpolatingFunction@1, 9<<, <>D f@.d.9 Plot@f@xD, x, 1, 9<D
KursS_cz.nb Show@%, ListPlot@1,,,,,,,, <DD k 1, 1<,, <,, <,, <,, <,, << 1, 1<,, <,, <,, <,, <,, << f1 Interpolation@kD InterpolatingFunction@1, <<, <>D Show@Plot@f1@xD, x, 1, <D, ListPlot@kDD Options@InterpolationD, Method Automatic, PeriodicInterpolation False< o 1,,,,,,,, < 1,,,,,,,, <
KursS_cz.nb o0 o1 o o o o o 0D; 1D; D; D; D; D; D; GraphicsGrid@Plot@o0@xD, x, 1, <D, Plot@o1@xD, x, 1, <D, Plot@o@xD, x, 1, <D, Plot@o@xD, x, 1, <D, Plot@o@xD, x, 1, <D, Plot@o@xD, x, 1, <D, Plot@o@xD, x, 1, <D<<D Fit[dane, funkcja, zm] o 1,,,,,,,, < n1 n n n Fit@o, Fit@o, Fit@o, Fit@o, 1, 1, 1, 1, x<, xd x, x ^, x ^ <, xd x, x ^, x ^, x ^, x ^ <, xd x, x ^, x ^, x ^, x ^, x ^, x ^ <, xd. + 0. x -.0 +.9 x - 1.1 x + 0.090 x 1. -. x + 1.19 x -.91 x + 0.0 x - 0.01 x - 9. + 1.0 x - 0.91 x + 9. x. x +. x - 0.0 x + 0.0091 x
KursS_cz.nb GraphicsGrid@ Show@Plot@n1, x, 0, 9<, PlotRange -> 0, 9<, -, 1<<D, ListPlot@oDD, Show@Plot@n, x, 0, 9<, PlotRange -> 0, 9<, -, 1<<D, ListPlot@oDD<, Show@Plot@n, x, 0, 9<, PlotRange -> 0, 9<, -, 1<<D, ListPlot@oDD, Show@Plot@n, x, 0, 9<, PlotRange -> 0, 9<, -, 1<<D, ListPlot@oDD<<D 1 1 0 0 - - 1 1 0 0 - - FindFit[dane, funkcja, param, zm] FindFit[dane, {funkcja, warunki}, param, zm] d@x1_, x_, x_d : x1 H1 - E ^ H- x Hx - xlll ^ dd d@1, 0., D I1 - ã-0. H-+xL M
KursS_cz.nb Plot@dd, x, 0, <D.0 1. 1.0 0. wartosci Table@x, dd<, x, 0, <D 0,.99<, 1, 0.09<,, 0.<,, 0.11<,, 0.99<,, 0.0<,, 0.<,, 0.<,, 0.9090<, 9, 0.901<,, 0.90<< fdd Fit@wartosci, 1, x, x ^, x ^, x ^, x ^ <, xd Show@Plot@fdd, x, 0, <D, ListPlot@wartosciDD.9 -.1 x + 1.011 x - 0. x + 0.00 x - 0.0009 x..0 1. 1.0 0.
KursS_cz.nb Clear@a, b, cd ffdd FindFit@wartosci, a H1 - E ^ H- b Hx - clll ^, a, b, c<, xd Show@Plot@d@a, b, cd. ffdd, x, 0, <D, ListPlot@wartosciDD a 1., b 0., c.<.0 1. 1.0 0. Maksimum i minimum funkcji FindMinimum[funkcja, {zm, wartosc}], NMinimize[funkcja, zm], FindMaximum[funkcja, {zm, wartosc}], NMaximize[funkcja, zm]. g x^ - x^ - x^ + x - 1 Plot@g, x, -,.<D - 1 + x - x - x + x 0 0 0 - -1 1-0 -0-0 FindMinimum@g, x, 0<D - 1.1, x - 0.11<< 9
KursS_cz.nb FindMinimum@g, x, 1<D -.9, x.<< NMinimize@g, xd -.9, x.<< FindMaximum@g, x, - 1<D FindMaximum::cvmit : Failed to converge to the requested accuracy or precision within 0 iterations. 9.009 1, 9x -.1 NMaximize@g, xd NMaximize::cvdiv : Failed to converge to a solution. The function may be unbounded. 9.900909, 9x -.1 i 1; FindMinimum@g, x, 1<, EvaluationMonitor :> HPrint@"i", i, " i1 x1. i x1. i x. i x1.1 i x. i x.9 i x.01 i x. i9 x.1 i ", "x", xd; i ++LD x. -.9, x.<< Calkowanie i rownania rozniczkowe W wyniku obliczen symbolicznych jako rozwiazanie otrzymujemy funkcje w postaci symbolicznej, a wyniku obliczen numerycznych otrzymujemy przyblizone wartoœci funkcji dla pewnych wybranych punktow z jej dziedziny. /http://pl.wikipedia.org/wiki/obliczenia_symboliczne/ Calkowanie
funkcje w postaci symbolicznej, a wyniku obliczen numerycznych KursS_cz.nb otrzymujemy przyblizone wartoœci funkcji dla pewnych wybranych punktow z jej dziedziny. /http://pl.wikipedia.org/wiki/obliczenia_symboliczne/ Calkowanie NIntegrate[funkcja, {zmiena, w_pocz, w_konc}] Options@NIntegrateD AccuracyGoal, Compiled Automatic, EvaluationMonitor None, Exclusions None, MaxPoints Automatic, MaxRecursion Automatic, Method Automatic, MinRecursion 0, PrecisionGoal Automatic, WorkingPrecision MachinePrecision< NIntegrate@Cos@xD ^, x, 0, 1<D 0. Rownania rozniczkowe NDSolve[{rownanie, warunki}, funkcja, {zm, w_pocz, w_konc}] DSolve@y '@xd Cos@xD, y@xd, xd y@xd C@1D + Sin@xD<<? *DSolve* System` DSolve NDSolve NDSolveValue ParametricNDSolve ds DSolve@y '@xd Cos@xD, y@0d 1<, y@xd, xd fds y@xd. ds@@1dd y@xd 1 + Sin@xD<< 1 + Sin@xD Table@fds, x, 0, <D N 1., 1.1, 1.909, 1.111, 0.19, 0.0, 0.0, 1.99, 1.99, 1.11, 0.99< ParametricNDSolveValue 11
1 KursS_cz.nb Plot@fds, y@xd. ds@@1dd<, x, 0, <D.0 1. 1.0 0. nds NDSolve@y '@xd Cos@xD, y@0d 1<, y@xd, x, 0, <D Table@y@xD. nds@@1dd, x, 0, <D y@xd InterpolatingFunction@0.,.<<, <>D@xD<< 1., 1.1, 1.9099, 1.111, 0.19, 0.0, 0.0, 1.9, 1.99, 1.11, 0.99<