Kurs Komputerowy S System Symboliczny Mathematica

Podobne dokumenty
Kurs komputerowy S - Mathematica - cz. 3 Suma i iloczyn elementow ciagu NSum[wyr, {zm, w_pocz, w_konc}], NProduct[wyr, {zm, w_pocz, w_konc}]

Sin[Pi / 4] Log[2, 1024] Prime[10]

Kurs komputerowy S - Mathematica - cz. 2

Zadanie1. (* parametryzacja okręgu r'= x',y',0 *) xp = R * Cos fp ; yp = R * Sin fp ; vecrp = xp, yp, 0 ; vecr = r * Cos f, r * Sin f, z ;

Matematyka 3. Suma szeregu. Promień zbieżności szeregu. Przykład 1: Przykład 2: GenerateConditions

= 1, = = + 1D, + 2D<,

n 2 1. lim n 3 sin 2. lim k 2 + n 2 3. lim 8 k n + 2 k + 5 n 2 Oblicz granice n lim n 2 3 π + log(8) x π + log(64) lim sin sin lim

2017 R. Robert Gajewski: Mathcad Prime 4. Solution of examples Rozwiązania przykładów

Mathematica - organizacja. czyli sztuka obliczeń symbolicznych. Możliwości. Mathematica do czego można ją użyć. Możliwości, cd. Mathematica publikacje

dr inż. Damian Słota Gliwice r. Instytut Matematyki Politechnika Śląska

Mathematica od zera. Paulina Suchanek, IFT Wroclaw. Factor x 2 2 x 1. Series Log 1 x, x, 0, Wprowadzenie. Start. Struktura notatnika

TTIC 31210: Advanced Natural Language Processing. Kevin Gimpel Spring Lecture 8: Structured PredicCon 2

Dokowanie molekularne. Andrzej Bąk

TTIC 31210: Advanced Natural Language Processing. Kevin Gimpel Spring Lecture 9: Inference in Structured Prediction

Wykład 6. Prawo Hooke a. Robert Hooke

Chapter 1: Review Exercises

Wprowadzanie wyrazen w Mathematice

OpenPoland.net API Documentation

Obliczenia Symboliczne

Wielki rozkład kanoniczny

Algebra Symboliczna. Wykład I. Andrzej Odrzywolek. Instytut Fizyki, Zakład Teorii Względności i Astrofizyki

, h(x) = sin(2x) w przedziale [ 2π, 2π].

Helena Boguta, klasa 8W, rok szkolny 2018/2019

General Certificate of Education Ordinary Level ADDITIONAL MATHEMATICS 4037/12

Równania liniowe i nieliniowe

Kurs Komputerowy S System Symboliczny Mathematica

n p 2 i = R 2 (8.1) i=1

Elementy metod numerycznych - zajęcia 11

Wykład 7 - Inne moduły wspierające obliczenia numeryczne

16 Jednowymiarowy model Isinga

Python wstęp do programowania dla użytkowników WCSS


Laboratorium 1b Operacje na macierzach oraz obliczenia symboliczne

wiczenia (z przyk adami i cz ciowymi rozwi zaniami)

PAKIETY STATYSTYCZNE

SzeregFouriera-Legendre a

Maxima i Visual Basic w Excelu

Installation of EuroCert software for qualified electronic signature

Elementy projektowania inzynierskiego Przypomnienie systemu Mathcad

Rozwiązywanie równań różniczkowych z niezerowymi warunkami początkowymi

(8) Oblicz wyznacznik dowolnie wybranej macierzy stopnia czwartego. (9) Rozwi aż podany układ równań stosuj ac wzory Cramera:

Podstawowe I/O Liczby

Metody Numeryczne. Laboratorium 1. Wstęp do programu Matlab

METHOD 2 -DIAGNOSTIC OUTSIDE

Analiza matematyczna 3

Podstawowe wyrażenia matematyczne







for - instrukcja pętli "dla" umożliwia wielokrotne obliczenie sekwencji wyrażeń s s + k s while z j

Camspot 4.4 Camspot 4.5

Zamiana sumowania po stanach jednocząstkowych na całkowanie

ZASTOSOWANIE SPLOTU FUNKCJI DO OPISU WŁASNOŚCI NIEZAWODNOŚCIOWYCH UKŁADÓW Z REZERWOWANIEM

Witam! Czym jest Mathematica?

1 Przypadek jednej niewiadomej rzeczywistej, bez parametrów

MATEMATYKA II. znaleźć f(g(x)) i g(f(x)).

Kalibrator napięcia i prądu LB02

Równania różniczkowe liniowe rzędu pierwszego

Wykorzystanie programów komputerowych do obliczeń matematycznych

Liczby zespolone to (uporządkowane) pary liczb rzeczywistych, dla których dodawanie i mnożenie jest określone wzorami:

1 Obliczenia na danych

Proposal of thesis topic for mgr in. (MSE) programme in Telecommunications and Computer Science

Matematyka. rok akademicki 2008/2009, semestr zimowy. Konwersatorium 1. Własności funkcji


Algorytmy i struktury danych

Ćwiczenie 1 z metod obliczeniowych w nauce i technice

PRÓBNY EGZAMIN MATURALNY

Witam Państwa na wykładzie dotyczącym narzędzi obliczeniowych fizyki!

Języki programowania wysokiego poziomu. PHP cz.2.

Komputerowe przetwarzanie obrazu Laboratorium 5

Przykładowy program ćwiczeń

Harmonogramowanie, kosztorysowanie, planowanie budowy.

Mathematica (1) Organizacja Mathematica Notebooks. Style dokumentów

Wykorzystanie programów komputerowych do obliczeń matematycznych, cz. 2/2

PRÓBNY EGZAMIN MATURALNY

Instalacja

Gradient Coding using the Stochastic Block Model

Wykorzystanie programów komputerowych do obliczeń matematycznych, cz. 2/2

SymPy matematyka symboliczna w Pythonie

L.Kowalski zadania z rachunku prawdopodobieństwa-zestaw 4 ZADANIA - ZESTAW 4

ZASTOSOWANIE SPLOTU FUNKCJI DO OPISU WŁASNOŚCI NIEZAWODNOŚCIOWYCH UKŁADÓW Z REZERWOWANIEM

y = The Chain Rule Show all work. No calculator unless otherwise stated. If asked to Explain your answer, write in complete sentences.

Zastosowanie pakietów algebry komputerowej do obliczeń numerycznych i symbolicznych

Dr. inŝ. Ewa Szlachcic Katedra Automatyki, Mechatroniki i Systemów Sterowania. Przykładowe zadania optymalizacji nieliniowej bez ograniczeń

INSTRUKCJE JAK AKTYWOWAĆ SWOJE KONTO PAYLUTION

PRÓBNY EGZAMIN MATURALNY

Wykład Ćwiczenia Laboratorium Projekt Seminarium 15 30

Lista 1. (e) z działaniem dodawania ciągów i mnożeniem ciągu przez liczbę. (f) z działaniem dodawania ciągów i mnożeniem ciągu przez liczbę

ZADANIA ZAMKNIETE W zadaniach 1-25 wybierz i zaznacz na karcie odpowiedzi poprawna

JAVAScript w dokumentach HTML - przypomnienie

Fizyka na komputerze

do MATLABa programowanie WYKŁAD Piotr Ciskowski

Wysokowytrzymałe zestawy śrubowe HV High strength HV-sets

Równania różniczkowe zwyczajne. 1 Rozwiązywanie równań różniczkowych pierwszego rzędu

DOPASOWYWANIE KRZYWYCH

Aby przygotować się do kolokwiów oraz do egzaminów należy ponownie przeanalizować zadania

Wstęp do programowania. Różne różności

Transkrypt:

Kurs Komputerowy S System Symboliczny Mathematica Obliczenia numeryczne Dokladnosc i precyzja Precision[wartosc] SetPrecision[wartosc, precyzja] Accuracy[wartosc] SetAccuracy[wartosc, dokladnosc] MachinePrecision In[1]:= a Sqrt Out[1]= In[]:= Precision a Out[]= In[]:= Precision 1. Out[]= MachinePrecision

0-obliczenia numeryczne.nb In[]:= b 1. 0 Out[]= 1.000000000000000000000000000000000000000000000000 In[]:= Precision b Out[]= 0. In[6]:= b Sqrt. Out[6]= 1.11 In[7]:= Precision b Out[7]= MachinePrecision In[8]:= $MachinePrecision Out[8]= 1.96 In[9]:= c SetPrecision b, 0 Out[9]= 1.1167091 In[10]:= Precision c Out[10]= 0. In[11]:= Accuracy c Out[11]= 19.89 In[1]:= Accuracy 1. Out[1]= 1.806

0-obliczenia numeryczne.nb In[1]:= d 1. 0 Out[1]= 1.000000000000000000000000000000000000000000000000 In[1]:= Accuracy d Out[1]= 0. Wynik dokladny a przyblizony wyrazenie // N N[wyrazenie] N[wyrazenie, precyzja] Chop[wyrazenie] In[1]:= a Sqrt Out[1]= In[16]:= b Sqrt. Out[16]= 1.11 In[17]:= a N Out[17]= 1.11 In[18]:= Precision Out[18]= MachinePrecision In[19]:= N a, 0 Out[19]= 1.116709088016887096980786967187769

0-obliczenia numeryczne.nb In[0]:= Precision Out[0]= 0. In[1]:= Chop 1. Out[1]= 1. In[]:= Chop 0.90 10^ 10 Out[]= 0 In[]:= Chop 1.0 10^ 0 Out[]= 0 In[]:= 1.0 10^ 0 Out[]= 1. 10 0 In[]:= Fourier 1, 0,, 0, 7, 0, 6,, 1 Out[]= 7. 0.,.19876 1.76, 1.0196 0.1006, 0.166667.007, 1.17.9968, 1.17.9968, 0.166667.007, 1.0196 0.1006,.19876 1.76 In[6]:= InverseFourier Out[6]= 1.,.9119 10 16,., 0., 7., 7.019 10 16, 6.,., 1. In[7]:= Chop Out[7]= 1., 0,., 0, 7., 0, 6.,., 1. Suma i iloczyn elementow ciagu NSum[wyrazenie, {zmienna, w_pocz, w_konc}] NProduct[wyrazenie, {zmienna, w_pocz, w_konc}]

0-obliczenia numeryczne.nb Options[polecenie] In[8]:= NSum 1 x, x, 1, 100 Out[8]= 1.698 In[9]:= NSum 1 x, x, 1, Infinity Out[9]= 1.69 In[0]:= Sum 1 x, x, 1, Infinity Out[0]= Π 6 In[1]:= N Out[1]= 1.69 In[]:= Options NSum Out[]= AccuracyGoal, Compiled Automatic, EvaluationMonitor None, Method Automatic, NSumTerms 1, PrecisionGoal Automatic, VerifyConvergence True, WorkingPrecision MachinePrecision In[]:= NSum 1 x, x, 1, Infinity, WorkingPrecision 0 Out[]= 1.6906688667116611760016611 In[]:= NSum 1 x, x, 1, Infinity, PrecisionGoal 0, WorkingPrecision 0 NIntegrate::ncvb : NIntegrate failed to converge to prescribed accuracy after 9 recursive bisections in x near x 0.1780798917980. NIntegrate obtained 0.06 0. and 9.07911618 0.*^- for the integral and error estimates. Out[]= 1.690668866 In[]:= Precision Out[]= 0.

6 0-obliczenia numeryczne.nb In[6]:= NSum 1 x, x, 1, 10, EvaluationMonitor : Print "x ", x, " ", N 1 x, 10 x 1. 1. x. 0. x. 0.111111 x. 0.06 x. 0.0 x 6. 0.077778 x 7. 0.0008 x 8. 0.016 x 9. 0.017 x 10. 0.01 Out[6]= 1.977

0-obliczenia numeryczne.nb 7 In[7]:= NSum 1 x, x, 1, 10, WorkingPrecision 0, EvaluationMonitor : Print "x ", x, " ", N 1 x, 10 x 1.0000000000000000000000000000000000000000000000000 1.000000000 x.0000000000000000000000000000000000000000000000000 0.00000000 x.0000000000000000000000000000000000000000000000000 0.1111111111 x.0000000000000000000000000000000000000000000000000 0.060000000 x.0000000000000000000000000000000000000000000000000 0.0000000000 x 6.0000000000000000000000000000000000000000000000000 0.0777777778 x 7.0000000000000000000000000000000000000000000000000 0.0008167 x 8.0000000000000000000000000000000000000000000000000 0.01600000 x 9.0000000000000000000000000000000000000000000000000 0.0167901 x 10.000000000000000000000000000000000000000000000000 0.01000000000 Out[7]= 1.976771166069001197796961778788809 In[8]:= NProduct x x 1, x, 1, 100 Out[8]= 0.00990099 In[9]:= Product x x 1, x, 1, 100 Out[9]= 1 101 In[0]:= N Out[0]= 0.00990099

8 0-obliczenia numeryczne.nb In[1]:= Options NProduct Out[1]= AccuracyGoal, Compiled Automatic, EvaluationMonitor None, Method Automatic, NProductFactors 1, PrecisionGoal Automatic, VerifyConvergence True, WorkingPrecision MachinePrecision Rozwiazywanie rownan NSolve[rown, zmienna] (* NSolve[...] N[Solve[...]] *) In[]:= eq x x 0 NSolve eq, x Out[]= x x 0 Out[]= x.67, x 0.671 In[]:= Solve eq, x Out[]= x 7, x 7 In[]:= N Out[]= x.67, x 0.671 In[6]:= Clear a, b, c In[7]:= NSolve a x b x c 0, x Out[7]= x 0. 1. b 1. b. a c a, x 0. 1. b b. a c a

0-obliczenia numeryczne.nb 9 FindRoot[wielomian, zmienna] In[8]:= f x x x x 1 FindRoot f, x, 1 Out[8]= 1 x x x x Out[9]= x 1.10 In[0]:= FindRoot f, x, 0 Out[0]= x 0.191 In[1]:= FindRoot f, x, 1 Out[1]= x 1.116 In[]:= Plot f, x,, Out[]= 1 1 10 Interpolacja, ekstrapolacja i aproksymacja Interpolation[dane] dane: {f1, f, f,...} {{x1, f1}, {x, f}, {x, f},...} {{{x1, y,...}, f1}, {{x, y,...}, f},...} Interpolation[dane,wartosc]

10 0-obliczenia numeryczne.nb In[]:= d 1,,, 6,, 7,, 8 fi Interpolation d Out[]= 1,,, 6,, 7,, 8 Out[]= InterpolatingFunction 1, 8, In[]:= fi fi. Out[]= Out[6]=. In[7]:= fi 10 InterpolatingFunction::dmval : Input value 10 lies outside the range of data in the interpolating function. Extrapolation will be used. Out[7]= 9 In[8]:= Plot fi x, x, 1, 8 8 7 6 Out[8]=

0-obliczenia numeryczne.nb 11 In[9]:= Show, ListPlot d 8 7 6 Out[9]= In[60]:= d 1, 1,,,,,, 6, 6,, 8, 7, 9,, 11, 8 fi Interpolation d Out[60]= 1, 1,,,,,, 6, 6,, 8, 7, 9,, 11, 8 Out[61]= InterpolatingFunction 1, 11, In[6]:= Show Plot fi x, x, 1, 11, ListPlot d 7 6 Out[6]= In[6]:= Options Interpolation Out[6]= InterpolationOrder, Method Automatic, PeriodicInterpolation False

1 0-obliczenia numeryczne.nb In[6]:= d 1,,, 6,, 7,, 8 f0 Interpolation d, InterpolationOrder 0 ; f1 Interpolation d, InterpolationOrder 1 ; f Interpolation d, InterpolationOrder ; f Interpolation d, InterpolationOrder ; f Interpolation d, InterpolationOrder ; f Interpolation d, InterpolationOrder ; Out[6]= 1,,, 6,, 7,, 8 In[71]:= GraphicsGrid Plot f0 x, x, 1, 8, Plot f1 x, x, 1, 8, Plot f x, x, 1, 8, Plot f x, x, 1, 8, Plot f x, x, 1, 8, Plot f x, x, 1, 8 8 7 6 8 7 6 8 7 6 Out[71]= 6 7 8 6 7 8 6 7 8 8 7 6 8 7 6 8 7 6 Fit[dane, funkcja, zmienna] In[7]:= d 1,,, 6,, 7,, 8 ; f1 Fit d, 1, x, x f Fit d, 1, x, x, x f Fit d, 1, x, x, x, x, x f7 Fit d, 1, x, x, x, x, x, x 6, x 7, x Out[7]= 1. 0.666667 x Out[7]= 1. 0.666667 x.716 10 17 x Out[7]=..0808 x 0.9 x 0.0707071 x.61 10 16 x Out[76]=. 1081.7 x 999.6 x 68.8 x 1. x 18.0 x 1. x 6 0.0 x 7

0-obliczenia numeryczne.nb 1 In[77]:= GraphicsGrid Show Plot f1, x, 0, 9, PlotRange 0, 9,, 1, ListPlot d, Show Plot f, x, 0, 9, PlotRange 0, 9,, 1, ListPlot d, Show Plot f, x, 0, 9, PlotRange 0, 9,, 1, ListPlot d, Show Plot f7, x, 0, 9, PlotRange 0, 9,, 1, ListPlot d 1 1 10 10 0 6 8 0 6 8 Out[77]= 1 1 10 10 0 6 8 0 6 8 In[78]:= Fit 1, 1, x, x, x Out[78]= 0. 0. x 0. x FindFit[dane, funkcja, parametry, zmienna] FindFit[dane,{funkcja,warunki},parametry,zmienna] In[80]:= Clear f In[81]:= f De_, Α_, xe_ : De 1 Exp Α x xe In[8]:= funkcja f, 0., Out[8]= 1 0. x

1 0-obliczenia numeryczne.nb In[8]:= Plot funkcja, x, 0, 10 Out[8]= 1 In[8]:= dane Table x, funkcja, x, 1, 10 Out[8]= 1,.9098,, 0.81679,, 0.,, 0.0966,, 0.7991, 6, 1.070, 7, 1.99, 8, 1.681, 9, 1.8081, 10, 1.8810 In[8]:= ff Fit dane, 1, x, x, x, x, x Out[8]= 1.691 11.9016 x.70 x 0.879 x 0.018087 x In[86]:= Show Plot ff, x, 1, 10, ListPlot dane Out[86]= 1 6 8 10

0-obliczenia numeryczne.nb 1 In[87]:= ffit FindFit dane, a 1 Exp b x c ^, a, b, c, x Out[87]= a 1.998, b.118, c 1.807 In[88]:= Show Plot f a, b, c. ffit, x, 1, 10, ListPlot dane.0..0 Out[88]= 1. 1.0 0. In[89]:= ffit FindFit dane, a 1 Exp b x c ^, b 0., a, b, c, x Out[89]= a.000, b 0.9998, c.00016 In[90]:= Show Plot f a, b, c. ffit, x, 1, 10, ListPlot dane Out[90]= 1 Minimum i maksimum funkcji FindMinimum[funkcja, {zmienna, wartosc}]

16 0-obliczenia numeryczne.nb NMinimize[funkcja,zmienna] FindMaximum[funkcja,{zmienna,wartosc}] NMaximize[funkcja,zmienna] Opcje: StepMonitor i EvaluationMonitor In[91]:= f x x x x 1 Plot f, x,, Out[91]= 1 x x x x 0 Out[9]= 0 1 1 0 In[9]:= f x x x x 1 FindMinimum f, x, 0 Out[9]= 1 x x x x FindMinimum::lstol : The line search decreased the step size to within the tolerance specified by AccuracyGoal and PrecisionGoal but was unable to find a sufficient decrease in the function. You may need more than MachinePrecision digits of working precision to meet these tolerances. Out[9]= 1.8777, x 0.787 In[9]:= FindMinimum f, x, Out[9]= 9.696, x.1906 In[96]:= FindMinimum f, x, Out[96]= 9.696, x.1906

0-obliczenia numeryczne.nb 17 In[97]:= NMinimize f, x Out[97]= 9.696, x.1906 In[98]:= Options NMinimize Out[98]= AccuracyGoal Automatic, EvaluationMonitor None, MaxIterations 100, Method Automatic, PrecisionGoal Automatic, StepMonitor None, WorkingPrecision MachinePrecision In[99]:= NMinimize f, x, Method "DifferentialEvolution" Out[99]= 9.696, x.1906 In[100]:= FindMaximum f, x, 0 Out[100]=.701, x 0.7818 In[101]:= FindMaximum f, x, 1 FindMaximum::cvmit : Failed to converge to the requested accuracy or precision within 100 iterations. Out[101]=.770098 10 17, x.761 10 10 In[10]:= NMaximize f, x NMaximize::cvdiv : Failed to converge to a solution. The function may be unbounded. Out[10]=.7696886677 10, x 1.768 10 106

18 0-obliczenia numeryczne.nb In[10]:= i 1; FindMinimum f, x, 0, StepMonitor : Print "i ", i, " x ", x ; i i 1 x 0. i x 0.6891 i x 0.7196 i x 0.77817 i x 0.789 i 6 x 0.787 i 7 x 0.787 FindMinimum::lstol : The line search decreased the step size to within the tolerance specified by AccuracyGoal and PrecisionGoal but was unable to find a sufficient decrease in the function. You may need more than MachinePrecision digits of working precision to meet these tolerances. Out[10]= 1.8777, x 0.787

0-obliczenia numeryczne.nb 19 In[10]:= i 1; FindMinimum f, x, 0, EvaluationMonitor : Print "i ", i, " x ", x ; i i 1 x 0. i x 0. i x 1.66667 i x 0.6891 i x 0.7196 i 6 x 0.77817 i 7 x 0.789 i 8 x 0.787 i 9 x 0.787 i 10 x 0.787 i 11 x 0.787 i 1 x 0.787 i 1 x 0.787 i 1 x 0.787 i 1 x 0.787 FindMinimum::lstol : The line search decreased the step size to within the tolerance specified by AccuracyGoal and PrecisionGoal but was unable to find a sufficient decrease in the function. You may need more than MachinePrecision digits of working precision to meet these tolerances. Out[10]= 1.8777, x 0.787 Calkowanie NIntegrate[funkcja, {zmienna, w_pocz, w_konc}]

0 0-obliczenia numeryczne.nb In[10]:= NIntegrate Sin x, x, 0, 1 Out[10]= 0.9698 In[106]:= Options NIntegrate Out[106]= AccuracyGoal, Compiled Automatic, EvaluationMonitor None, Exclusions None, MaxPoints Automatic, MaxRecursion Automatic, Method Automatic, MinRecursion 0, PrecisionGoal Automatic, WorkingPrecision MachinePrecision In[107]:= NIntegrate Sin x ^ Cos y^, x, 0, Pi, y, 0, Pi Out[107]= 0.66691 Rozwiazywanie rownan rozniczkowych NDSolve[{rownanie,warunki}, funkcja,{zmienna, w_pocz, w_konc}] In[109]:= DSolve y x Cos x, y x, x Out[109]= y x C 1 Sin x In[110]:= r DSolve y x Cos x, y 0 1, y x, x Out[110]= y x 1 Sin x In[111]:= f y x. r 1 Out[111]= 1 Sin x In[11]:= Table f, x, 0, 10 N Out[11]= 1., 1.817, 1.909, 1.111, 0.198, 0.01077, 0.708, 1.6699, 1.9896, 1.11, 0.979

0-obliczenia numeryczne.nb 1 In[11]:= nr NDSolve y x Cos x, y 0 1, y, x, 0, 10 Out[11]= y InterpolatingFunction 0., 10., In[11]:= Table y x. nr 1, x, 0, 10 Out[11]= 1., 1.817, 1.9099, 1.111, 0.198, 0.01077, 0.708, 1.6698, 1.989, 1.11, 0.979 In[11]:= Plot f, y x. nr 1, x, 0, 10.0 1. Out[11]= 1.0 0. In[116]:= Options NDSolve Out[116]= AccuracyGoal Automatic, Compiled Automatic, DependentVariables Automatic, EvaluationMonitor None, InterpolationOrder Automatic, MaxStepFraction 1 10, MaxSteps 10 000, MaxStepSize Automatic, Method Automatic, NormFunction Automatic, PrecisionGoal Automatic, SolveDelayed Automatic, StartingStepSize Automatic, StepMonitor None, WorkingPrecision MachinePrecision