Számítógépes Modellezés 3 Limesz, Derivált, Integrál Direkt (normál) értékadás (=) p legyen a. Chebysev polinom. p ChebyshevT, x 8 x 48 x 4 3 x Helyettesítési érték meghatározásához a változó/határozatlan helyébe konkrét értéket teszünk TableForm Table ChebyshevT n, x, n, x x 3 x 4 x 3 8 x 8 x 4 x 0 x 3 x 8 x 48 x 4 3 x p. x 3 (Formális) derivált D p, x 3 x 9 x 3 9 x D p, x, 3 7 x 90 x 4 D p, x, x 3 7 x 90 x 4 Ugyanez, ha polinomfüggvényt definiálunk hozzárendelési szabállyal: q x_ : ChebyshevT, x ; q D q x, x 3 x 9 x 3 9 x Határértékek
szm0903x.nb Limit p, x Infinity Limit x^ x 3 x^, x Infinity 3 Limit Sin x x, x 0 Integrálok E x x Π Erf x Π E x x exp E x x Π Erf N.493 N exp.493 NIntegrate E^ x^, x,,.493 Integrate E^ x^, x,, Π Erf 3 x^ x Sorozatok, Függvények Sorozat: Hozzárendelési szabály vagy a képhalmaz egy véges szelete vagy grafikon := (SetDelayed, késleltetett értékadás)
szm0903x.nb 3 n a n_ : ; n a a 9 N a 0. Véges sorozatok generálása Table i^, i, 9, 8, 00,, 44 Table i^3, i,,,, 7, Az a sorozat elsõ tíz eleme Ábrák Table a n, n, 0, 9, 3 4, 4,, 4, 7 4, 8 t Table n, a n, n, 0 9, 9 8,,,, 3 4, 3,, 4, 9 4,,,, 4, 7, 7 8, 8, 4 9, 9, 9 8, 0, TableForm t 3 4 7 8 9 9 3 4 4 4 7 4 8 9 9 8 0
4 szm0903x.nb ListPlot t 0.0 0.8 0. 0.4 0. Options ListPlot AlignmentPoint Center, AspectRatio, Axes True, GoldenRatio AxesLabel None, AxesOrigin Automatic, AxesStyle, Background None, BaselinePosition Automatic, BaseStyle, ClippingStyle None, ColorFunction Automatic, ColorFunctionScaling True, ColorOutput Automatic, ContentSelectable Automatic, CoordinatesToolOptions Automatic, DataRange Automatic, DisplayFunction $DisplayFunction, Epilog, Filling None, FillingStyle Automatic, FormatType TraditionalForm, Frame False, FrameLabel None, FrameStyle, FrameTicks Automatic, FrameTicksStyle, GridLines None, GridLinesStyle, ImageMargins 0., ImagePadding All, ImageSize Automatic, ImageSizeRaw Automatic, InterpolationOrder None, Joined False, LabelStyle, MaxPlotPoints, Mesh None, MeshFunctions &, MeshShading None, MeshStyle Automatic, Method Automatic, PerformanceGoal $PerformanceGoal, PlotLabel None, PlotMarkers None, PlotRange Automatic, PlotRangeClipping True, PlotRangePadding Automatic, PlotRegion Automatic, PlotStyle Automatic, PreserveImageOptions Automatic, Prolog, RotateLabel True, Ticks Automatic, TicksStyle ListPlot t, PlotStyle Red, PointSize.03, AxesOrigin 0, 0, PlotRange 0,, 0,. 0. 0.4 0.3 0. 0. 0.0
szm0903x.nb ListPlot Table n, a n, n, 0, 00, PlotStyle RGBColor, 0, 0, PointSize.0, PlotRange 49, 0, 0,.0 0.8 0. 0.4 0.?? ListPlot ListPlot y, y, plots points corresponding to a list of values, assumed to correspond to x coordinates,,. ListPlot x, y, x, y, plots a list of points with specified x and y coordinates. ListPlot list, list, plots several lists of points. Attributes ListPlot Protected Options ListPlot AlignmentPoint Center, AspectRatio GoldenRatio, Axes True, AxesLabel None, AxesOrigin Automatic, AxesStyle, Background None, BaselinePosition Automatic, BaseStyle, ClippingStyle None, ColorFunction Automatic, ColorFunctionScaling True, ColorOutput Automatic, ContentSelectable Automatic, CoordinatesToolOptions Automatic, DataRange Automatic, DisplayFunction $DisplayFunction, Epilog, Filling None, FillingStyle Automatic, FormatType TraditionalForm, Frame False, FrameLabel None, FrameStyle, FrameTicks Automatic, FrameTicksStyle, GridLines None, GridLinesStyle, ImageMargins 0., ImagePadding All, ImageSize Automatic, ImageSizeRaw Automatic, InterpolationOrder None, Joined False, LabelStyle, MaxPlotPoints, Mesh None, MeshFunctions &, MeshShading None, MeshStyle Automatic, Method Automatic, PerformanceGoal $PerformanceGoal, PlotLabel None, PlotMarkers None, PlotRange Automatic, PlotRangeClipping True, PlotRangePadding Automatic, PlotRegion Automatic, PlotStyle Automatic, PreserveImageOptions Automatic, Prolog, RotateLabel True, Ticks Automatic, TicksStyle Ha az {{,a},{,a},{n,an}} pontokat akarjuk ábrázolni:
szm0903x.nb In[7]:= ListPlot Table n, n, 0, Axes False Out[7]= Grafikus objektumok ábrázolása Show Graphics PointSize.0, Hue.0, Point 0, 0, Graphics Point,, Graphics Line 4, 4, 3 4, 3 4 Show Table Graphics PointSize.0, Point a n, 0, n, 0, Axes True, PlotRange 0,,.03,.03 0.0 0.0 0.00 0.0 0.0 0.03 0. 0. 0.3 0.4 Show Table Graphics PointSize.0, Point a n, 0, n, 0, Axes False, PlotRange 0,,.03,.03 Függvény: Hozzárendelési szabály vagy grafikon f x_ : x x; Plot f x, x,, 0 4 4 0
szm0903x.nb 7 Plot x, x^, x,,, PlotStyle Green, Blue 0 0 4 4 Plot x, x^, x,, 0 0 4 4 MyFun x_ : ArcTan x ; MyDFun x_ : D MyFun x, x ; MyDFun x x? Plot?? Plot Plot Sin x, Cos x, x,,, PlotStyle, RGBColor, 0, 0, Axes False?? Plot Plot f, x, x min, x max generates a plot of f as a function of x from x min to x max. Plot f, f,, x, x min, x max plots several functions f i.
8 szm0903x.nb L MyFun x, MyDFun x ArcTan x, x Plot L, x,,, PlotStyle, RGBColor, 0, 0.0 0. 4 4 0..0 Plot Evaluate MyFun x, MyDFun x, x,,, PlotStyle, RGBColor, 0, 0.0 0. 4 4 0..0 Gyakorló feladatok Rajzoljunk le egy rac törtfgv (p/q) száml, nev + egy 3. konstans függvényt, ami piros ha p/q>0 és kék ha negatív! Pl. f[x_]:=(x^+x+)/(x^-x-8) Hint?PlotStyle?If? ColorFunction MyCF x_, y_ : If y 0, Red, Blue MyCF, RGBColor, 0, 0 MyCF, 3 RGBColor 0, 0,
szm0903x.nb 9 Clear p, q ; p x_ x^ x ; q x_ x^ x 8;? ColorFunction ColorFunction is an option for graphics functions which specifies a function to apply to determine colors of elements. 3 Tiszta függvények (pure function) ^3 & 3 8 Sq x_ : x^ Sq 3 g Plot p x q x, x,,, ColorFunction MyCF, &, ColorFunctionScaling False, PlotRange, 4 4 4 4 g Plot p x q x, x,,, ColorFunction If 0, Red, Blue &, ColorFunctionScaling False, PlotRange 0, 0
0 szm0903x.nb g Plot 3, x,,, ColorFunction If p q 0, Red, Blue &, ColorFunctionScaling False, PlotRange 0, 0 4 4 g Plot p x, q x, x,,, PlotStyle Black, PlotRange 0, 0 4 4 Show g, g 4 4
szm0903x.nb Show g, g 4 4 Rajzoljuk le Sin[x] grafikonját 0 körüli Taylor polinomjaival Tp expr_, var_, n_ : Sum D expr, var, k. var 0 var^k k, k, 0, n Normal Series Sin x, x, 0, 3 x x3 Listamüveletek Prepend, 3, 4,,, 3, 4,, 3, 4,, 3, Sequence, 3, 4,, 3, 4 Flatten,, 3, 4,, 3, 4 Plot Evaluate Sin x, Tp Sin x, x, 3, x, Pi, Pi Plot Evaluate Cos x, Sequence Table Tp Cos x, x, k, k, 0,,, x, Pi, Pi 4 4 4 4 Tp Sin x, x, 3 x x3
szm0903x.nb Table Tp Sin x, x, n, n, x, x, x x3 x3 x3, x, x x 0 Plot Evaluate Prepend Table Tp Log x, x, n, n, 0, 0, Cos x, x,, 3 3.0 0. 0..0 Interaktív vizualizáció (Manipulate, Animate) Manipulate Plot Evaluate Cos x, Tp Cos x, x, n, x, Pi, Pi, PlotRange Pi, Pi,,, n, 0, 0, n..0 0. 4 4 0..0.
szm0903x.nb 3 Manipulate Plot Evaluate Log x, Tp Log x, x, n, x,,, PlotRange,,,, n, 0, 0, n 4.0 0. 0..0. 0 4