Skocz do zawartości

  •  
  • Mini kompendium
  • MimeTeX
  • Regulamin

- zdjęcie

Mariusz M

Rejestracja: 11 Sep 2010
Offline Ostatnio: Dec 17 2016 00:11
*****

Moje tematy

Usuwanie rekurencji

07.12.2016 - 13:30

Na podstawie pseudokodu Cormena (Algorithms unklocked , Introduction to algorithms) napisałem kody sortowania

 

W sortowaniu przez scalanie Cormen używa wartowników oraz dwóch tablic pomocniczych

Udało mi się usunąć wartowników i jedną z tablic pomocniczych

jednak została mi rekurencja

 

program sort;
uses crt;
const maxT=2500;
type tablica=array[1..maxT]of real;

procedure merge(var A:tablica;p,q,r:integer);
var n1,n2,i,j,k:integer;
      B:tablica;
begin
    n1:=q-p+1;
    n2:=r-q;
    for i:=p to r do
        B[i-p+1]:=A[i];
    i:=1;
    j:=n1+1;
    k:=p;
    while((i<=n1)and(j<=n1+n2)) do
    begin
        if(B[i]<=B[j]) then
        begin
        A[k]:=B[i];
        i:=i+1;
        end
        else
        begin
        A[k]:=B[j];
        j:=j+1;
        end;
        k:=k+1;
    end;
    while(i<=n1) do
    begin
        A[k]:=B[i];
        i:=i+1;
        k:=k+1;
    end;
    while(j<=n1+n2) do
    begin
        A[k]:=B[j];
        j:=j+1;
        k:=k+1;
    end;
end;

procedure mergesort(var A:tablica;p,r:integer);
var q:integer;
begin
    if(p<r) then
    begin
        q:=(p+r) div  2;
        mergesort(A,p,q);
        mergesort(A,q+1,r);
        merge(A,p,q,r);
    end;
end;

var k,n,p,q:integer;
A:tablica;
esc:char;

begin
    clrscr;
    repeat
        writeln('Podaj rozmiar tablicy');
        readln(n);
        randomize;
        for k:=1 to n do
        begin
            p:=(1-2*random(2))*random(10);
            q:=1+random(10);
            A[k]:=(p/q);
        end;
        for k:=1 to n do
            write(A[k]:1:10,' ');
        writeln;
        writeln;
        mergesort(A,1,n);
        for k:=1 to n do
            write(A[k]:1:10,' ');
        writeln;
        writeln;
        esc:=readkey;
    until esc=#27;
end.

 

 

program sort;
uses crt;
const maxT=2500;
type tablica=array[1..maxT]of real;

procedure heapify(var A:tablica;i,heapsize:integer);
var l,r,largest:integer;
      temp:real;
begin
    l:=2*i;
    r:=2*i+1;
    if((l<=heapsize)and(A[l]>A[i])) then
            largest:=l
    else
            largest:=i;
    if((r<=heapsize)and(A[r]>A[largest])) then
            largest:=r;
    if(largest<>i) then
        begin
            temp:=A[i];
            A[i]:=A[largest];
            A[largest]:=temp;
            heapify(A,largest,heapsize);
        end;
end;

procedure buildheap(var A:tablica;len:integer);
var i:integer;
begin
    for i:=len div 2 downto 1 do
        heapify(A,i,len);
end;


procedure heapsort(var A:tablica;len:integer);
var i,heapsize:integer;
      temp:real;
begin
    buildheap(A,len);
    heapsize:=len;
    for i:=len downto 2 do
    begin
        temp:=A[1];
        A[1]:=A[i];
        A[i]:=temp;
        heapsize:=heapsize-1;
        heapify(A,1,heapsize);
    end;
end;

var k,n,p,q:integer;
A:tablica;
esc:char;

begin
    clrscr;
    repeat
        writeln('Podaj rozmiar tablicy');
        readln(n);
        randomize;
        for k:=1 to n do
        begin
            p:=(1-2*random(2))*random(10);
            q:=1+random(10);
            A[k]:=(p/q);
        end;
        for k:=1 to n do
            write(A[k]:1:10,' ');
        writeln;
        writeln;
        heapsort(A,n);
        for k:=1 to n do
            write(A[k]:1:10,' ');
        writeln;
        writeln;
        esc:=readkey;
    until esc=#27;
end.

 

 


Strukturka do czytania pliku

27.09.2016 - 11:52

Załóżmy że chcielibyśmy wczytać do pamięci jakiś stosunkowo mały plik

Myślę że przydałaby się strukturka

struct node{
int nol;                                // numer linii w pliku
int nochil;                           // liczba znaków w linii
char* line;                          // zawartość linii
struct node* next;              // wskaźnik do węzła przechowującego zawartość następnej linii w pliku
struct node* prev;              // wskaźnik do węzła przechowującego zawartość poprzedniej linii w pliku
};

tylko jak napisać funkcje obsługujące tę strukturkę


Oblicz wysokość

12.08.2016 - 15:11

pre_1471010102__szyhwcyjab8i.jpg

 

Z twierdzenia Pitagorasa mamy

 

\begin{cases}x^{2}+\left(y+h\right)^2=d^2\\x^2+y^2=c^2\end{cases}

 

Z trygonometrii mamy

 

\frac{y}{1340}=sin{34.4^{\circ}}

 

 

 

 

\begin{cases}x^{2}+y^{2}+2yh+h^{2}=d^2\\x^2+y^2=c^2\end{cases}\\</p>\\<p>y=1340\sin{34.4^{\circ}}</p>\\<p>

 

\begin{cases}2yh+h^{2}=d^2-c^2\\y=1340\sin{34.4^{\circ}}\end{cases}

 

Gdyby jakoś się udało obliczyć długości przeciwprostokątnych c oraz d

to wysokość otrzymalibyśmy z rozwiązania równania kwadratowego

Jedno rozwiązanie równania kwadratowego będzie ujemne więc je trzeba odrzucić


Znajdź funkcję odwrotną

21.06.2016 - 23:41

Mając dane wartości pewnej funkcji w punktach zauważyłem pewien wzór rekurencyjny

 

</p>\\<p>a_{n}=a_{n-3}+1\\<br>\\A\left(x\right)=\sum_{n=0}^{\infty}{a_{n}x^{n}}\\<br>\\\sum_{n=3}^{\infty}{a_{n}x^{n}}=\sum_{n=3}^{\infty}{a_{n-3}x^{n}}+\sum_{n=3}^{\infty}{x^{n}}\\<br>\\\sum_{n=3}^{\infty}{a_{n}x^{n}}=x^3\left(\sum_{n=3}^{\infty}{a_{n-3}x^{n-3}}\right)+\frac{x^3}{1-x}\\<br>\\\sum_{n=0}^{\infty}{a_{n}x^{n}}-a_{0}-a_{1}x-a_{2}x^2=x^3\left(\sum_{n=0}^{\infty}{a_{n}x^{n}}\right)+\frac{x^3}{1-x}\\<br>\\A\left(x\right)-a_{0}-a_{1}x-a_{2}x^2=x^3A\left(x\right)+\frac{x^3}{1-x}\\<br>\\A\left(x\right)\left(1-x^3\right)=a_{0}+a_{1}x+a_{2}x^2+\frac{x^3}{1-x}\\<br>\\A\left(x\right)\left(1-x^3\right)=\frac{\left(a_{0}+a_{1}x+a_{2}x^2\right)\left(1-x\right)+x^3}{1-x}\\<br>\\A\left(x\right)\left(1-x^3\right)=\frac{\left(1-a_{2}\right)x^3+\left(a_{2}-a_{1}\right)x^2+\left(a_{1}-a_{0}\right)x+a_{0}}{1-x}\\<br>\\A\left(x\right)=\frac{\left(1-a_{2}\right)x^3+\left(a_{2}-a_{1}\right)x^2+\left(a_{1}-a_{0}\right)x+a_{0}}{\left(1-x^3\right)\left(1-x\right)}\\<br>\\A\left(x\right)=\frac{\left(1-a_{2}\right)x^3+\left(a_{2}-a_{1}\right)x^2+\left(a_{1}-a_{0}\right)x+a_{0}}{\left(1-x\right)^2\left(1+x+x^2\right)}\\<br>\\A\left(x\right)=\frac{\left(1-a_{2}\right)x^3+\left(a_{2}-a_{1}\right)x^2+\left(a_{1}-a_{0}\right)x+a_{0}}{\left(1-x\right)^2\left(1-\lambda_{1}x\right)\left(1-\lambda_{2}x\right)}\\<br>\\\left(1-\lambda_{1}x\right)\left(1-\lambda_{2}x\right)=1+x+x^2\\<br>\\\frac{\left(1-a_{2}\right)x^3+\left(a_{2}-a_{1}\right)x^2+\left(a_{1}-a_{0}\right)x+a_{0}}{\left(1-x\right)^2\left(1-\lambda_{1}x\right)\left(1-\lambda_{2}x\right)}=\frac{B_{1}}{1-x}+\frac{B_{2}}{\left(1-x\right)^2}+\frac{B_{3}}{1-\lambda_{1}x}+\frac{B_{4}}{1-\lambda_{2}x}\\<br>\\\left(1-a_{2}\right)x^3+\left(a_{2}-a_{1}\right)x^2+\left(a_{1}-a_{0}\right)x+a_{0}=B_{1}\left(1-x^3\right)+B_{2}\left(1+x+x^2\right)+B_{3}\left(1-\lambda_{2}x\right)\left(1-2x+x^2\right)+B_{4}\left(1-\lambda_{1}x\right)\left(1-2x+x^2\right)\\<br>\\\left(1-a_{2}\right)x^3+\left(a_{2}-a_{1}\right)x^2+\left(a_{1}-a_{0}\right)x+a_{0}=B_{1}\left(1-x^3\right)+B_{2}\left(1+x+x^2\right)+B_{3}\left(1-2x+x^2-\lambda_{2}x+2\lambda_{2}x^2-\lambda_{2}x^3\right)+B_{4}\left(1-2x+x^2-\lambda_{1}x+2\lambda_{1}x^2-\lambda_{1}x^3\right)\\<br>\\\left(1-a_{2}\right)x^3+\left(a_{2}-a_{1}\right)x^2+\left(a_{1}-a_{0}\right)x+a_{0}=B_{1}\left(1-x^3\right)+B_{2}\left(1+x+x^2\right)+B_{3}\left(1-\left(2+\lambda_{2}\right)x+\left(1+2\lambda_{2}\right)x^2-\lambda_{2}x^3\right)+B_{4}\left(1-\left(2+\lambda_{1}\right)x+\left(1+2\lambda_{1}\right)x^2-\lambda_{1}x^3\right)\\<br>\\\begin{cases}-B_{1}-\lambda_{2}B_{3}-\lambda_{1}B_{4}=1-a_{2}\\B_{2}+\left(1+2\lambda_{2}\right)B_{3}+\left(1+2\lambda_{1}\right)B_{4}=a_{2}-a_{1}\\B_{2}-\left(2+\lambda_{2}\right)B_{3}-\left(2+\lambda_{1}\right)B_{4}=a_{1}-a_{0}\\B_{1}+B_{2}+B_{3}+B_{4}=a_{0}\end{cases}\\</p>\\<p>

 

</p>\\<p>\begin{bmatrix}-1&0&-\lambda_{2}&-\lambda_{1}\\0&1&1+2\lambda_{2}&1+2\lambda_{1}\\0&1&-2-\lambda_{2}&-2-\lambda_{1}\\1&1&1&1\end{bmatrix}\cdot\begin{bmatrix}B_{1}\\B_{2}\\B_{3}\\B_{4}\end{bmatrix}=\begin{bmatrix}1-a_{2}\\a_{2}-a_{1}\\a_{1}-a_{0}\\a_{0}\end{bmatrix}\\<br>\\\begin{bmatrix}-1&0&-\lambda_{2}&-\lambda_{1}&\qquad &1&0&0&0\\0&1&1+2\lambda_{2}&1+2\lambda_{1}&\qquad&0&1&0&0\\0&1&-2-\lambda_{2}&-2-\lambda_{1}&\qquad &0&0&1&0\\1&1&1&1&\qquad&0&0&0&1\end{bmatrix}\\<br>\\\begin{bmatrix}1&0&\lambda_{2}&\lambda_{1}&\qquad &-1&0&0&0\\0&1&1+2\lambda_{2}&1+2\lambda_{1}&\qquad&0&1&0&0\\0&1&-2-\lambda_{2}&-2-\lambda_{1}&\qquad &0&0&1&0\\0&1&1-\lambda_{2}&1-\lambda_{1}&\qquad&1&0&0&1\end{bmatrix}\\<br>\\\begin{bmatrix}1&0&\lambda_{2}&\lambda_{1}&\qquad &-1&0&0&0\\0&1&1+2\lambda_{2}&1+2\lambda_{1}&\qquad&0&1&0&0\\0&0&-3-3\lambda_{2}&-3-3\lambda_{1}&\qquad &0&-1&1&0\\0&0&-3\lambda_{2}&-3\lambda_{1}&\qquad&1&-1&0&1\end{bmatrix}\\<br>\\\begin{bmatrix}1&0&\lambda_{2}&\lambda_{1}&\qquad &-1&0&0&0\\0&3&3+6\lambda_{2}&3+6\lambda_{1}&\qquad&0&3&0&0\\0&0&3&3&\qquad &1&0&-1&1\\0&0&-3\lambda_{2}&-3\lambda_{1}&\qquad&1&-1&0&1\end{bmatrix}\\<br>\\\begin{bmatrix}1&0&\lambda_{2}&\lambda_{1}&\qquad &-1&0&0&0\\0&3&3&3&\qquad&2&1&0&2\\0&0&3&3&\qquad &1&0&-1&1\\0&0&-3\lambda_{2}&-3\lambda_{1}&\qquad&1&-1&0&1\end{bmatrix}\\<br>\\\begin{bmatrix}1&0&\lambda_{2}&\lambda_{1}&\qquad &-1&0&0&0\\0&3&0&0&\qquad&1&1&1&1\\0&0&3&3&\qquad &1&0&-1&1\\0&0&0&-3\lambda_{1}+3\lambda_{2}&\qquad&1+\lambda_{2}&-1&-\lambda_{2}&1+\lambda_{2}\end{bmatrix}\\<br>\\\begin{bmatrix}3\left(\lambda_{1}-\lambda_{2}\right)&0&3\lambda_{2}\left(\lambda_{1}-\lambda_{2}\right)&3\lambda_{1}\left(\lambda_{1}-\lambda_{2}\right)&\qquad &-3\left(\lambda_{1}-\lambda_{2}\right)&0&0&0\\0&3&0&0&\qquad&1&1&1&1\\0&0&3\left(\lambda_{1}-\lambda_{2}\right)&3\left(\lambda_{1}-\lambda_{2}\right)&\qquad &\left(\lambda_{1}-\lambda_{2}\right)&0&-\left(\lambda_{1}-\lambda_{2}\right)&\left(\lambda_{1}-\lambda_{2}\right)\\0&0&0&-3\lambda_{1}+3\lambda_{2}&\qquad&1+\lambda_{2}&-1&-\lambda_{2}&1+\lambda_{2}\end{bmatrix}\\<br>\\\begin{bmatrix}3\left(\lambda_{1}-\lambda_{2}\right)&0&3\lambda_{2}\left(\lambda_{1}-\lambda_{2}\right)&0&\qquad &-2\lambda_{1}+3\lambda_{2}+\lambda_{2}\lambda_{1}&-\lambda_{1}&-\lambda_{2}\lambda_{1}&\lambda_{1}+\lambda_{2}\lambda_{1}\\0&3&0&0&\qquad&1&1&1&1\\0&0&3\left(\lambda_{1}-\lambda_{2}\right)&0&\qquad &1+\lambda_{1}&-1&-\lambda_{1}&1+\lambda_{1}\\0&0&0&-3\lambda_{1}+3\lambda_{2}&\qquad&1+\lambda_{2}&-1&-\lambda_{2}&1+\lambda_{2}\end{bmatrix}\\<br>\\\begin{bmatrix}3\left(\lambda_{1}-\lambda_{2}\right)&0&0&0&\qquad &-2\lambda_{1}+2\lambda_{2}&-\lambda_{1}+\lambda_{2}&0&\lambda_{1}-\lambda_{2}\\0&3\left(\lambda_{1}-\lambda_{2}\right)&0&0&\qquad&\lambda_{1}-\lambda_{2}&\lambda_{1}-\lambda_{2}&\lambda_{1}-\lambda_{2}&\lambda_{1}-\lambda_{2}\\0&0&3\left(\lambda_{1}-\lambda_{2}\right)&0&\qquad &1+\lambda_{1}&-1&-\lambda_{1}&1+\lambda_{1}\\0&0&0&3\left(\lambda_{1}-\lambda_{2}\right)&\qquad&-1-\lambda_{2}&1&\lambda_{2}&-1-\lambda_{2}\end{bmatrix}\\<br>\\

 

</p>\\<p>B^{-1}=\frac{1}{3\left(\lambda_{1}-\lambda_{2}\right)}\begin{bmatrix}-2\lambda_{1}+2\lambda_{2}&-\lambda_{1}+\lambda_{2}&0&\lambda_{1}-\lambda_{2}\\\lambda_{1}-\lambda_{2}&\lambda_{1}-\lambda_{2}&\lambda_{1}-\lambda_{2}&\lambda_{1}-\lambda_{2}\\1+\lambda_{1}&-1&-\lambda_{1}&1+\lambda_{1}\\-1-\lambda_{2}&1&\lambda_{2}&-1-\lambda_{2}\end{bmatrix}\\<br>\\X=\frac{1}{3\left(\lambda_{1}-\lambda_{2}\right)}\begin{bmatrix}-2\lambda_{1}+2\lambda_{2}&-\lambda_{1}+\lambda_{2}&0&\lambda_{1}-\lambda_{2}\\\lambda_{1}-\lambda_{2}&\lambda_{1}-\lambda_{2}&\lambda_{1}-\lambda_{2}&\lambda_{1}-\lambda_{2}\\1+\lambda_{1}&-1&-\lambda_{1}&1+\lambda_{1}\\-1-\lambda_{2}&1&\lambda_{2}&-1-\lambda_{2}\end{bmatrix}\cdot\begin{bmatrix}1-a_{2}\\a_{2}-a_{1}\\a_{1}-a_{0}\\a_{0}\end{bmatrix}\\<br>\\X=\begin{bmatrix}-\frac{2}{3}+\frac{1}{3}a_{2}+\frac{1}{3}a_{1}+\frac{1}{3}a_{0}\\\frac{1}{3}\\\frac{-\left(2+\lambda_{1}\right)a_{2}+\left(1-\lambda_{1}\right)a_{1}+\left(1+2\lambda_{1}\right)a_{0}+\left(1+\lambda_{1}\right)}{3\left(\lambda_{1}-\lambda_{2}\right)}\\\frac{\left(2+\lambda_{2}\right)a_{2}+\left(-1+\lambda_{2}\right)a_{1}+\left(-1-2\lambda_{2}\right)a_{0}-1-\lambda_{2}}{3\left(\lambda_{1}-\lambda_{2}\right)}\end{bmatrix}\\<br>\\\left(1-\lambda_{1}x\right)\left(1-\lambda_{2}x\right)=1+x+x^2\\<br>\\1-\left(\lambda_{1}+\lambda_{2}\right)x+\lambda_{1}\lambda_{2}x^2=1+x+x^2\\<br>\\\begin{cases}\lambda_{1}+\lambda_{2}=-1\\\lambda_{1}\lambda_{2}=1\end{cases}\\<br>\\t^2+t+1=0\\<br>\\\lambda_{1}=\frac{-1-sqrt{3}i}{2}=\cos{\left(\frac{4\pi}{3}\right)}+i\sin{\left(\frac{4\pi}{3}\right)}\\<br>\\\lambda_{2}=\frac{-1+sqrt{3}i}{2}=\cos{\left(\frac{4\pi}{3}\right)}-i\sin{\left(\frac{4\pi}{3}\right)}\\<br>\\\sum_{n=0}^{\infty}{x^{n}}=\frac{1}{1-x}\\<br>\\\frac{\mbox{d}}{\mbox{d}x}\left(\sum_{n=0}^{\infty}{x^{n}}\right)=\frac{\mbox{d}}{\mbox{d}x}\left(\frac{1}{1-x}\right)\\<br>\\\sum_{n=0}^{\infty}{nx^{n-1}}=-\frac{1}{\left(1-x\right)^2}\left(-1\right)\\<br>\\\sum_{n=1}^{\infty}{nx^{n-1}}=\frac{1}{\left(1-x\right)^2}\\<br>\\\sum_{n=0}^{\infty}{\left(n+1\right)x^{n}}=\frac{1}{\left(1-x\right)^2}\\<br>\\a\cos{\left(x\right)}+b\sin{\left(x\right)}=\sqrt{a^2+b^2}\left(\frac{a}{\sqrt{a^2+b^2}}\cos{\left(x\right)}+\frac{b}{\sqrt{a^2+b^2}}\sin{\left(x\right)}\right)\\<br>\\a\cos{\left(x\right)}+b\sin{\left(x\right)}=\sqrt{a^2+b^2}\cos{\left(x-\varphi\right)}\\<br>\\\begin{cases}\cos{\left(\varphi\right)}=\frac{a}{\sqrt{a^2+b^2}}\\\sin{\left(\varphi\right)}=\frac{b}{\sqrt{a^2+b^2}}\end{cases}\\<br>\\X=\begin{bmatrix}-\frac{2}{3}+\frac{1}{3}a_{2}+\frac{1}{3}a_{1}+\frac{1}{3}a_{0}\\\frac{1}{3}\\\left(-\frac{1}{6}-\frac{\sqrt{3}i}{6}\right)a_{2}+\left(-\frac{1}{6}+\frac{\sqrt{3}i}{6}\right)a_{1}+\frac{1}{3}a_{0}+\frac{1}{6}+\frac{\sqrt{3}i}{18}\\\left(-\frac{1}{6}+\frac{\sqrt{3}i}{6}\right)a_{2}+\left(-\frac{1}{6}-\frac{\sqrt{3}i}{6}\right)a_{1}+\frac{1}{3}a_{0}+\frac{1}{6}-\frac{\sqrt{3}i}{18}\end{bmatrix}\\</p>\\<p>

 

</p>\\<p>A\left(x\right)=\left(-\frac{2}{3}+\frac{1}{3}a_{2}+\frac{1}{3}a_{1}+\frac{1}{3}a_{0}\right)\cdot\frac{1}{1-x}+\frac{1}{3}\cdot\frac{1}{\left(1-x\right)^2}+\left(\left(-\frac{1}{6}-\frac{\sqrt{3}i}{6}\right)a_{2}+\left(-\frac{1}{6}+\frac{\sqrt{3}i}{6}\right)a_{1}+\frac{1}{3}a_{0}+\frac{1}{6}+\frac{\sqrt{3}i}{18}\right)\cdot\frac{1}{1-\lambda_{1}x}+\left(\left(-\frac{1}{6}+\frac{\sqrt{3}i}{6}\right)a_{2}+\left(-\frac{1}{6}-\frac{\sqrt{3}i}{6}\right)a_{1}+\frac{1}{3}a_{0}+\frac{1}{6}-\frac{\sqrt{3}i}{18}\right)\cdot\frac{1}{1-\lambda_{2}x}\\<br>\\A\left(x\right)=\left(-\frac{2}{3}+\frac{1}{3}a_{2}+\frac{1}{3}a_{1}+\frac{1}{3}a_{0}\right)\cdot\left(\sum_{n=0}^{\infty}x^n\right)+\frac{1}{3}\left(\sum_{n=0}^{\infty}{\left(n+1\right)x^n}\right)+\left(\left(-\frac{1}{6}-\frac{\sqrt{3}i}{6}\right)a_{2}+\left(-\frac{1}{6}+\frac{\sqrt{3}i}{6}\right)a_{1}+\frac{1}{3}a_{0}+\frac{1}{6}+\frac{\sqrt{3}i}{18}\right)\cdot\left(\sum_{n=0}^{\infty}\lambda_{1}^nx^n\right)+\left(\left(-\frac{1}{6}+\frac{\sqrt{3}i}{6}\right)a_{2}+\left(-\frac{1}{6}-\frac{\sqrt{3}i}{6}\right)a_{1}+\frac{1}{3}a_{0}+\frac{1}{6}-\frac{\sqrt{3}i}{18}\right)\cdot\left(\sum_{n=0}^{\infty}\lambda_{2}^nx^n\right)\\<br>\\a_{n}=\left(-\frac{2}{3}+\frac{1}{3}a_{2}+\frac{1}{3}a_{1}+\frac{1}{3}a_{0}\right)+\frac{1}{3}\left(n+1\right)+\left(\left(-\frac{1}{6}-\frac{\sqrt{3}i}{6}\right)a_{2}+\left(-\frac{1}{6}+\frac{\sqrt{3}i}{6}\right)a_{1}+\frac{1}{3}a_{0}+\frac{1}{6}+\frac{\sqrt{3}i}{18}\right)\cdot \lambda_{1}^{n}+\left(\left(-\frac{1}{6}+\frac{\sqrt{3}i}{6}\right)a_{2}+\left(-\frac{1}{6}-\frac{\sqrt{3}i}{6}\right)a_{1}+\frac{1}{3}a_{0}+\frac{1}{6}-\frac{\sqrt{3}i}{18}\right)\cdot \lambda_{2}^{n}\\<br>\\a_{n}=\left(-\frac{2}{3}+\frac{1}{3}a_{2}+\frac{1}{3}a_{1}+\frac{1}{3}a_{0}\right)+\frac{1}{3}\left(n+1\right)+\left(\left(-\frac{1}{6}-\frac{\sqrt{3}i}{6}\right)a_{2}+\left(-\frac{1}{6}+\frac{\sqrt{3}i}{6}\right)a_{1}+\frac{1}{3}a_{0}+\frac{1}{6}+\frac{\sqrt{3}i}{18}\right)\cdot \left(\cos{\left(\frac{4}{3}n\pi\right)}+i\sin{\left(\frac{4}{3}n\pi\right)}\right)+\left(\left(-\frac{1}{6}+\frac{\sqrt{3}i}{6}\right)a_{2}+\left(-\frac{1}{6}-\frac{\sqrt{3}i}{6}\right)a_{1}+\frac{1}{3}a_{0}+\frac{1}{6}-\frac{\sqrt{3}i}{18}\right)\cdot \left(\cos{\left(\frac{4}{3}n\pi\right)}-i\sin{\left(\frac{4}{3}n\pi\right)}\right)\\<br>\\a_{n}=\frac{1}{3}\left(n-1+a_{2}+a_{1}+a_{0}\right)-\frac{1}{3}\left(a_{2}+a_{1}-2a_{0}-1\right)\cos{\left(\frac{4}{3}n\pi\right)}+\frac{\sqrt{3}}{9}\left(3a_{2}-3a_{1}-1\right)\sin{\left(\frac{4}{3}n\pi\right)}\\</p>\\<p>

 

Dla zadanych warunków początkowych np

a_{0}=-1\\a_{1}=-\frac{3}{5}\\a_{2}=-\frac{3}{10}

znajdź funkcję odwrotną

 


Oblicz granicę funkcji

21.06.2016 - 21:19

\lim_{x\to 0}{\left(\frac{1}{x}-\cot{x}\right)}\\</p>\\<p>=\lim_{x\to 0}{\left(\frac{1}{x}-\frac{1}{\tan{x}}\right)}\\</p>\\<p>=\lim_{x\to 0}\frac{\tan{x}-x}{x\tan{x}}\\</p>\\<p>

 

\lim_{\Delta x\to 0}\frac{\left(\tan{\left(x+\Delta x\right)}-\tan{x}\right)-\left(\left(x+\Delta x\right)-x\right)}{\Delta x}\\</p>\\<p>\lim_{\Delta x\to 0}\frac{\frac{\tan{x}+\tan{\Delta x}}{1-\tan{x}\tan{\Delta x}}-\tan{x}-\Delta x}{\Delta x}\\</p>\\<p>\lim_{\Delta x\to 0}\frac{\frac{\tan{x}+\tan{\Delta x}-\tan{x}\left(1-\tan{x}\tan{\Delta x}\right)}{1-\tan{x}\tan{\Delta x}}-\Delta x}{\Delta x}\\</p>\\<p>\lim_{\Delta x\to 0}\frac{\frac{\tan{x}+\tan{\Delta x}-\tan{x}+\tan^2{x}\tan{\Delta x}}{1-\tan{x}\tan{\Delta x}}}{\Delta x}-\lim_{\Delta x\to 0}\frac{\Delta x}{\Delta x}\\</p>\\<p>\lim_{\Delta x\to 0}\frac{\frac{\tan{\Delta x}+\tan^2{x}\tan{\Delta x}}{1-\tan{x}\tan{\Delta x}}}{\Delta x}-1\\</p>\\<p>\lim_{\Delta x\to 0}\frac{\tan{\Delta x}}{\Delta x}\cdot\lim_{\Delta x\to 0}\frac{1+\tan^{2}{x}}{1-\tan{x}\tan{\Delta x}}-1\\</p>\\<p>1+\tan^{2}{x}-1\\</p>\\<p>=\tan^{2}{x}\\</p>\\<p>\lim_{\Delta x\to 0}\frac{\left(x+\Delta x\right)\tan{\left(x+\Delta x\right)}-x\tan{x}}{\Delta x}\\</p>\\<p>\lim_{\Delta x\to 0}\frac{\left(x+\Delta x\right)\tan{\left(x+\Delta x\right)}-x\tan{\left(x+\Delta x\right)}+x\tan{\left(x+\Delta x\right)}-x\tan{x}}{\Delta x}\\</p>\\<p>\lim_{\Delta x\to 0}\frac{\left(x+\Delta x\right)-x}{\Delta x}\lim_{\Delta x\to 0}\tan{\left(x+\Delta x\right)}+x\lim_{\Delta x\to 0}\frac{\tan{\left(x+\Delta x\right)}-\tan{x}}{\Delta x}\\</p>\\<p>\tan{x}+x\left(\lim_{\Delta x\to 0}\frac{\frac{\tan{x}+\tan{\Delta x}}{1-\tan{x}\tan{\Delta x}}-\tan{x}}{\Delta x}\right)\\</p>\\<p>\tan{x}+x\left(\lim_{\Delta x\to 0}\frac{\frac{\tan{x}+\tan{\Delta x}-\tan{x}+\tan^{2}{x}\tan{\Delta x}}{1-\tan{x}\tan{\Delta x}}}{\Delta x}\right)\\</p>\\<p>\tan{x}+x\left(\lim_{\Delta x\to 0}\frac{\frac{\tan{\Delta x}+\tan^{2}{x}\tan{\Delta x}}{1-\tan{x}\tan{\Delta x}}}{\Delta x}\right)\\</p>\\<p>\tan{x}+x\left(\lim_{\Delta x\to 0}\frac{\tan{\Delta x}}{\Delta x}\cdot\lim_{\Delta x\to 0}\frac{1+\tan^{2}{x}}{1-\tan{x}\tan{\Delta x}}\right)\\</p>\\<p>\tan{x}+x\left(1+\tan^{2}{x}\right)\\<br>\\

 

 

 

 

\lim_{x\to 0}{\left(\frac{1}{x}-\cot{x}\right)}=\lim_{x\to 0}\frac{\tan^{2}{x}}{\tan{x}+x\left(1+\tan^{2}{x}\right)}\\</p>\\<p>\left(\tan^{2}{x}\right)'</p>\\<p>\lim_{\Delta x\to 0}\frac{\tan^{2}{\left(x+\Delta x\right)-\tan^{2}{x}}}{\Delta x}\\</p>\\<p>\lim_{\Delta x\to 0}\frac{\tan{\left(x+\Delta x\right)}-\tan{x}}{\Delta x}\cdot\lim_{\Delta x\to 0}\left(\tan{\left(x+\Delta x\right)}+\tan{x}\right)\\</p>\\<p>=2\tan{x}\lim_{\Delta x\to 0}\frac{\tan{\left(x+\Delta x\right)}-\tan{x}}{\Delta x}\\</p>\\<p>=2\tan{x}\lim_{\Delta x\to 0}\frac{\frac{\tan{x}+\tan{\Delta x}}{1-\tan{x}\tan{\Delta x}}-\tan{x}}{\Delta x}\\</p>\\<p>=2\tan{x}\lim_{\Delta x\to 0}\frac{\frac{\tan{x}+\tan{\Delta x}-\tan{x}+\tan^{2}{x}\tan{\Delta x}}{1-\tan{x}\tan{\Delta x}}}{\Delta x}\\</p>\\<p>=2\tan{x}\lim_{\Delta x\to 0}\frac{\frac{\tan{\Delta x}+\tan^{2}{x}\tan{\Delta x}}{1-\tan{x}\tan{\Delta x}}}{\Delta x}\\</p>\\<p>=2\tan{x}\lim_{\Delta x\to 0}\frac{\tan{\Delta x}}{\Delta x}\lim_{\Delta x\to 0}\frac{1+\tan^{2}{x}}{1-\tan{x}\tan{\Delta x}}\\</p>\\<p>=2\tan{x}\left(1+\tan^{2}{x}\right)\\</p>\\<p>\left(\tan{x}+x+x\tan^2{x}\right)'\\</p>\\<p>\lim_{\Delta x\to 0}\frac{\tan{\left(x+\Delta x\right)}-\tan{x}+\left(x+\Delta x\right)-x+\left(x+\Delta x\right)\tan^{2}{\left(x+\Delta x\right)-x\tan^{2}{x}}}{\Delta x}\\</p>\\<p>=\lim_{\Delta x\to 0}\frac{\tan{\left(x+\Delta x\right)}-\tan{x}}{\Delta x}+\lim_{\Delta x\to 0}\frac{\left(x+\Delta x\right)-x}{\Delta x}+\lim_{\Delta x\to 0}\frac{\left(x+\Delta x\right)\tan^{2}{\left(x+\Delta x\right)}-x\tan^{2}{x}}{\Delta x}\\</p>\\<p>=\lim_{\Delta x\to 0}\frac{\frac{\tan{x}+\tan{\Delta x}}{1-\tan{x}\tan{\Delta x}}-\tan{x}}{\Delta x}+1+\lim_{\Delta x\to 0}\frac{\left(x+\Delta x\right)\tan^{2}{\left(x+\Delta x\right)}-x\tan^{2}{\left(x+\Delta x\right)}+x\tan^{2}{\left(x+\Delta x\right)}-x\tan^{2}{x}}{\Delta x} \\</p>\\<p>=\lim_{\Delta x\to 0}\frac{\frac{\tan{x}+\tan{\Delta x}-\tan{x}+\tan^{2}{x}\tan{\Delta x}}{1-\tan{x}\tan{\Delta x}}}{\Delta x}+1+\lim_{\Delta x\to 0}\frac{\left(x+\Delta x\right)-x}{\Delta x}\cdot\lim_{\Delta x\to 0}\tan^{2}{\left(x+\Delta x\right)}+x\lim_{\Delta x\to 0}\frac{\tan^{2}{\left(x+\Delta x\right)}-\tan^{2}{x}}{\Delta x}\\</p>\\<p>=\lim_{\Delta x\to 0}\frac{\frac{\tan{\Delta x}+\tan^{2}{x}\tan{\Delta x}}{1-\tan{x}\tan{\Delta x}}}{\Delta x}+1+\tan^{2}{x}+x\left(\lim_{\Delta x\to 0}\frac{\tan{\left(x+\Delta x\right)}-\tan{x}}{\Delta x}\cdot\lim_{\Delta x\to 0}\left(\tan{\left(x+\Delta x\right)}+\tan{x}\right)\right)\\</p>\\<p>=\lim_{\Delta x\to 0}\frac{\tan{\Delta x}}{\Delta x}\cdot\lim_{\Delta x\to 0}\frac{1+\tan^2{x}}{1-\tan{x}\tan{\Delta x}}+1+\tan^{2}{x}+x\left(2\tan{x}\lim_{\Delta x\to 0}\frac{\frac{\tan{x}+\tan{\Delta x}}{1-\tan{x}\tan{\Delta x}}-\tan{x}}{\Delta x}\right)\\</p>\\<p>=1+\tan^{2}{x}+1+\tan^{2}{x}+2x\tan{x}\left(\lim_{\Delta x\to 0}\frac{\frac{\tan{x}+\tan{\Delta x}-\tan{x}+\tan^{2}{x}\tan{\Delta x}}{1-\tan{x}\tan{\Delta x}}}{\Delta x}\right)\\</p>\\<p>=2+2\tan^{2}{x}+2x\tan{x}\left(\lim_{\Delta x\to 0}\frac{\frac{\tan{\Delta x}+\tan^{2}{x}\tan{\Delta x}}{1-\tan{x}\tan{\Delta x}}}{\Delta x}\right)\\</p>\\<p>=2+2\tan^{2}{x}+2x\tan{x}\left(\lim_{\Delta x\to 0}\frac{\tan{\Delta x}}{\Delta x}\lim_{\Delta x\to 0}\frac{1+\tan^{2}{x}}{1-\tan{x}\tan{\Delta x}}\right)\\</p>\\<p>=2+2\tan^{2}{x}+2x\tan{x}\left(1+\tan^{2}{x}\right)\\</p>\\<p>

 

 

\lim_{x\to 0}{\left(\frac{1}{x}-\cot{x}\right)}=\lim_{x\to 0}\frac{2\tan{x}\left(1+\tan^{2}{x}\right)}{2+2\tan^{2}{x}+2x\tan{x}\left(1+\tan^{2}{x}\right)}\\</p>\\<p>=\lim_{x\to 0}\frac{2\left(1+\tan^{2}{x}\right)\tan{x}}{2\left(1+\tan^2{x}\right)\left(1+x\tan{x}\right)}\\</p>\\<p>=\lim_{x\to 0}\frac{\tan{x}}{1+x\tan{x}}=0\\</p>\\<p>

 

 

Ciekaw jestem jak to policzyć bez reguły de l'Hospitala