Updated files for presentation

This commit is contained in:
Abreu 2022-03-10 19:28:05 -03:00
parent 2bd62cea86
commit ac6ee080a3
No known key found for this signature in database
GPG Key ID: 64835466FF55F7E1
133 changed files with 519 additions and 6637 deletions

14
.gitignore vendored
View File

@ -1,2 +1,12 @@
*.out
*.pdf
/*
!.gitignore
!.README.md
!LICENSE
!/Algoritmos*/*/*.c
!/Cálculo*/Semana*/*.pdf
!/Introdução*/Lista*/*.pdf
!/Introdução*/EP*/*.pdf
!/Matemática*/Lista*/*.pdf
!/Matrizes*/Listas/*
!/Matrizes*/Resumos/*

View File

@ -1,118 +0,0 @@
/*********************************************************************/
/** ACH2023 - Algoritmos e Estruturas de Dados I **/
/** EACH-USP - Segundo Semestre de 2021 **/
/** 04 - Prof. Luciano Antonio Digiampietri **/
/** **/
/** EP 2 - Fila Preferencial **/
/** **/
/** Guilherme de Abreu Barreto nUSP: 12543033 **/
/** **/
/*********************************************************************/
#include "filapreferencial.h"
PFILA criarFila(){
PFILA res = (PFILA) malloc(sizeof(FILAPREFERENCIAL));
res->cabeca = (PONT) malloc(sizeof(ELEMENTO));
res->inicioNaoPref = res->cabeca;
res->cabeca->id = -1;
res->cabeca->ehPreferencial = false;
res->cabeca->ant = res->cabeca;
res->cabeca->prox = res->cabeca;
return res;
}
int tamanho(PFILA f){
PONT atual = f->cabeca->prox;
int tam = 0;
while (atual != f->cabeca) {
atual = atual->prox;
tam++;
}
return tam;
}
PONT buscarID(PFILA f, int id){
PONT atual = f->cabeca->prox;
while (atual != f->cabeca) {
if (atual->id == id) return atual;
atual = atual->prox;
}
return NULL;
}
void exibirLog(PFILA f){
int numElementos = tamanho(f);
printf("\nLog fila [elementos: %i]\t- Inicio:", numElementos);
PONT atual = f->cabeca->prox;
while (atual != f->cabeca) {
printf(" [%i;%i]", atual->id, atual->ehPreferencial);
atual = atual->prox;
}
printf("\n \t- Fim:");
atual = f->cabeca->ant;
while (atual != f->cabeca) {
printf(" [%i;%i]", atual->id, atual->ehPreferencial);
atual = atual->ant;
}
printf("\n\n");
}
bool consultarPreferencial(PFILA f, int id){
PONT atual = f->cabeca->prox;
while (atual != f->cabeca) {
if (atual->id == id) return atual->ehPreferencial;
atual = atual->prox;
}
return -1;
}
/* Função auxiliar */
void removerDaFila(PFILA f, PONT pessoa) {
if(f->inicioNaoPref == pessoa)
f->inicioNaoPref = pessoa->prox;
pessoa->ant->prox = pessoa->prox;
pessoa->prox->ant = pessoa->ant;
free(pessoa);
}
bool inserirPessoaNaFila(PFILA f, int id, bool ehPreferencial){
PONT pessoa;
if (!f || id < 0 || buscarID(f,id))
return false;
pessoa = malloc(sizeof(ELEMENTO));
pessoa->id = id;
pessoa->ehPreferencial = ehPreferencial;
if (ehPreferencial)
pessoa->prox = f->inicioNaoPref;
else {
pessoa->prox = f->cabeca;
if (f->inicioNaoPref == f->cabeca)
f->inicioNaoPref = pessoa;
}
pessoa->ant = pessoa->prox->ant;
pessoa->prox->ant = pessoa->ant->prox = pessoa;
return true;
}
bool atenderPrimeiraDaFila(PFILA f, int* id){
if (!f || f->cabeca->prox == f->cabeca)
return false;
*id = f->cabeca->prox->id;
removerDaFila(f, f->cabeca->prox);
return true;
}
bool desistirDaFila(PFILA f, int id){
PONT pessoa;
if (!f || id < 0)
return false;
pessoa = buscarID(f, id);
if (!pessoa)
return false;
removerDaFila(f, pessoa);
return true;
}

View File

@ -85,16 +85,14 @@ bool inserirPessoaNaFila(PFILA f, int id, bool ehPreferencial){
pessoa = malloc(sizeof(ELEMENTO));
pessoa->id = id;
pessoa->ehPreferencial = ehPreferencial;
if (ehPreferencial) {
if (ehPreferencial)
pessoa->prox = f->inicioNaoPref;
pessoa->ant = f->inicioNaoPref->ant;
}
else {
pessoa->prox = f->cabeca;
pessoa->ant = f->cabeca->ant;
if (f->inicioNaoPref == f->cabeca)
f->inicioNaoPref = pessoa;
}
pessoa->ant = pessoa->prox->ant;
pessoa->prox->ant = pessoa->ant->prox = pessoa;
return true;
}

View File

@ -1,101 +0,0 @@
# Semana 03: respostas ao [exercício proposto](http://www.each.usp.br/digiampietri/ACH2023/ACH2023_AtividadeSemanal03.pdf)
> Por Guilherme de Abreu Barreto, nUSP: 12543033.
```c
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct {
int size, * value;
} Array;
Array * initializeArray () {
Array * init = malloc(sizeof(*init));
init->size = 1;
init->value = malloc(sizeof(init->value));
return init;
}
int readSequence(Array * sequence) {
bool end = false;
int num, i = 0;
char c;
do {
switch (scanf("%d%c", &num, &c)) {
case 0:
return EOF;
case EOF:
end = true;
}
if (end == true)
break;
if (i == sequence->size - 1) {
sequence->size *= 2;
sequence->value = realloc(sequence->value, sequence->size * sizeof(sequence->value));
}
sequence->value[i] = num;
i++;
} while(c != '\n');
sequence->size = i;
return i;
}
bool isSorted (Array * sequence) {
int i;
for (i = 0; i < sequence->size - 1; i++)
if (sequence->value[i] > sequence->value[i + 1])
return false;
return true;
}
void selectionSort(Array * sequence) {
int i, j, pos, aux;
if (isSorted(sequence) == true)
return;
for (i = 0; i < sequence->size - 1; i++) {
pos = i;
for (j = i + 1; j < sequence->size; j++)
if (sequence->value[j] < sequence->value[pos])
pos = j;
if (pos == i)
continue;
aux = sequence->value[i];
sequence->value[i] = sequence->value[pos];
sequence->value[pos] = aux;
}
}
int main () {
int i;
Array * sequence = initializeArray();
printf("Este programa lê uma sequência de números inteiros e os ordena em ordem crescente. Digite uma sequência de números qualquer e pressione ENTER:\n");
switch (readSequence(sequence)) {
case EOF:
printf("Detectado valor inválido na sequência\n");
case 0:
return 1;
}
selectionSort(sequence);
printf("\n");
for (i = 0; i < sequence->size; i++)
printf("%d ", sequence->value[i]);
printf("\n");
return 0;
}
->size; i++)
printf("%d ", sequence->value[i]);
printf("\n");
return 0;
}
```

View File

@ -1,90 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct {
int size, * value;
} Array;
Array * initializeArray () {
Array * init = malloc(sizeof(*init));
init->size = 1;
init->value = malloc(sizeof(init->value));
return init;
}
int readSequence(Array * sequence) {
bool end = false;
int num, i = 0;
char c;
do {
switch (scanf("%d%c", &num, &c)) {
case 0:
return EOF;
case EOF:
end = true;
}
if (end == true)
break;
if (i == sequence->size - 1) {
sequence->size *= 2;
sequence->value = realloc(sequence->value, sequence->size * sizeof(sequence->value));
}
sequence->value[i] = num;
i++;
} while(c != '\n');
sequence->size = i;
return i;
}
bool isSorted (Array * sequence) {
int i;
for (i = 0; i < sequence->size - 1; i++)
if (sequence->value[i] > sequence->value[i + 1])
return false;
return true;
}
void selectionSort(Array * sequence) {
int i, j, pos, aux;
if (isSorted(sequence) == true)
return;
for (i = 0; i < sequence->size - 1; i++) {
pos = i;
for (j = i + 1; j < sequence->size; j++)
if (sequence->value[j] < sequence->value[pos])
pos = j;
if (pos == i)
continue;
aux = sequence->value[i];
sequence->value[i] = sequence->value[pos];
sequence->value[pos] = aux;
}
}
int main () {
int i;
Array * sequence = initializeArray();
printf("Este programa lê uma sequência de números inteiros e os ordena em ordem crescente. Digite uma sequência de números qualquer e pressione ENTER:\n");
switch (readSequence(sequence)) {
case EOF:
printf("Detectado valor inválido na sequência\n");
case 0:
return 1;
}
selectionSort(sequence);
printf("\n");
for (i = 0; i < sequence->size; i++)
printf("%d ", sequence->value[i]);
printf("\n");
return 0;
}

View File

@ -1,132 +0,0 @@
#include <stdlib.h>
#define array int*
/* Bubble Sort */
void swap (int *a, int *b) {
int tmp = *a;
*a = *b;
*b = tmp;
}
void bubbleSort (array A, int size) {
int i;
if (size <= 1)
return;
for (i = 0; i < size; i++)
if (A[i] > A[i + 1])
swap(&A[i], &A[i + 1]);
bubbleSort(A, size - 1);
}
/* Selection Sort */
int * minimalValue (array A, int size) {
int i, pos = 0;
for (i = 1; i < size; i++)
if (A[i] < A[pos])
pos = i;
return A + pos;
}
void selectionSort (array A, int size) {
swap(A, minimalValue(A, size));
selectionSort(A + 1, size - 1);
}
/* Insertion Sort */
void insertionSort (array A, int size) {
int i, tmp;
if (size <= 1)
return;
insertionSort(A, --size);
tmp = A[size--];
for (i = size; i >= 0 && A[i] > tmp; i--)
A[i + 1] = A[i];
A[i + 1] = tmp;
}
/* Merge Sort */
void merge (array A, int pivot, int size) {
int i, k, j = pivot;
array tmp = malloc(size * sizeof(int));
for (i = k = 0; k < size; k++)
tmp[k] = ((A[i] <= A[j] && i < pivot) || j == size) ?
A[i++] : A[j++];
for (k = 0; k < size; k++)
A[k] = tmp[k];
free(tmp);
}
void mergeSort (array A, int size) {
int pivot;
if (size <= 1)
return;
pivot = size / 2;
mergeSort(A, pivot);
mergeSort(A + pivot, size - pivot);
merge(A, pivot, size);
}
/* Quick Sort */
int partition (array A, int size) {
int i, j, lastIndex = size - 1;
for (i = j = 0; i < lastIndex; i++)
if (A[i] <= A[lastIndex])
swap(&A[i], &A[j++]);
swap(&A[i], &A[j]);
return j;
}
void quickSort (array A, int size) {
int pivot;
if (size <= 1)
return;
pivot = partition(A, size);
quickSort(A, pivot++);
quickSort(A + pivot, size - pivot);
}
/* Heap Sort */
void heapify (array A, int size, int i) {
int max = i, left = 2 * i + 1, right = left + 1;
if (left < size && A[left] > A[max])
max = left;
if (right < size && A[right] > A[max])
max = right;
if (max == i)
return;
swap(A + i, A + max);
heapify(A, size, max);
}
void heapSort (array A, int size) {
int i;
if (size <= 1)
return;
for (i = (size - 1) / 2; i <= 0; i--)
heapify(A, size, i);
for (i = size - 1; i >= 0; i--) {
swap(A, A + i);
heapify(A, i, 0);
}
}

View File

@ -1,139 +0,0 @@
# Semana 04: resposta ao [exercício proposto](http://www.each.usp.br/digiampietri/ACH2023/ACH2023_AtividadeSemanal04.pdf)
> Por Guilherme de Abreu Barreto[^1]
```c
#include <stdio.h>
#include <stdlib.h>
typedef struct node {
int value;
struct node *prev;
struct node *next;
} Node;
typedef struct {
Node *start;
Node *end;
} List;
void insertIn (List *l, int value) {
Node *prev, *current, *next;
prev = next = NULL;
if (l->start != NULL) {
if (abs(value - l->start->value) < abs(value - l->end->value)) {
for (next = l->start; next != NULL && next->value < value; next = next->next)
prev = next;
if (next != NULL && next->value == value)
return;
}
else {
for (prev = l->end; prev != NULL && prev->value > value; prev = prev->prev)
next = prev;
if (prev != NULL && prev->value == value)
return;
}
}
current = malloc(sizeof(*current));
current->value = value;
if (prev == NULL) {
current->next = l->start;
l->start = current;
current->prev = NULL;
}
else {
current->next = prev->next;
prev->next = current;
}
if (next == NULL) {
current->prev = l->end;
l->end = current;
current->next = NULL;
}
else {
current->prev = next->prev;
next->prev = current;
}
}
void removeFrom (List *l, int value) {
Node *current;
if (l->start == NULL)
return;
if (abs(value - l->start->value) < abs(value - l->end->value)) {
current = l->start;
while (current != NULL && current->value < value)
current = current->next;
}
else {
current = l->end;
while (current != NULL && current->value > value)
current = current->prev;
}
if (current == NULL)
return;
if (current->prev != NULL && current->next != NULL) {
current->prev->next = current->next;
current->next->prev = current->prev;
}
else {
if (current->prev == NULL) {
l->start = current->next;
if (current->next != NULL)
current->next->prev = NULL;
}
if (current->next == NULL) {
l->end = current->prev;
if (current->prev != NULL)
current->prev->next = NULL;
}
}
free(current);
}
void printList (List l) {
int i;
Node *current = l.start;
for (i = 0; current != NULL; i++) {
printf("\nÍndice: %-6d Valor: %-6d (Endereços) Anterior: %p Atual: %p Próximo: %p\n", i, current->value, current->prev, current, current->next);
current = current->next;
}
}
int main () {
int i;
char c;
List l = {0};
printf("Este programa adiciona valores inteiros à uma lista duplamente ligada, e depois permite excluí-los da mesma.\nDigite uma sequência de valores e pressione ENTER: ");
do {
if(!scanf("%d%c", &i, &c)) {
printf("Valor inválido detectado.");
return 1;
}
insertIn(&l, i);
} while (c != '\n');
printList(l);
printf("\nDigite uma sequência de valores a serem apagados e pressione ENTER: ");
do {
if(!scanf("%d%c", &i, &c)) {
printf("Valor inválido detectado.");
return 1;
}
removeFrom(&l, i);
} while (c != '\n');
printList(l);
return 0;
}
```
[^1]: nUSP 12543033

View File

@ -1,98 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
typedef struct node {
int value;
struct node *prev, *next;
} Node;
typedef struct {
Node *start, *end;
} List;
void insertIn (List *l, int value) {
Node *prev = NULL, *current, *next;
for (next = l->start; next && next->value < value; next = next->next)
prev = next;
if (next && next->value == value)
return;
current = malloc(sizeof(*current));
current->value = value;
current->prev = prev;
current->next = next;
if (prev)
l->start = current;
else
prev->next = current;
if (next)
l->end = current;
else
next->prev = current;
}
void removeFrom (List *l, int value) {
Node *current = l->start;
while (current && current->value < value)
current = current->next;
if (current)
return;
if (current->prev && current->next) {
current->prev->next = current->next;
current->next->prev = current->prev;
}
else if (!current->prev) {
l->start = current->next;
if (current->next)
current->next->prev = NULL;
}
else {
l->end = current->prev;
if (current->prev)
current->prev->next = NULL;
}
free(current);
}
void printList (List l) {
int i;
Node *current = l.start;
for (i = 0; current; i++) {
printf("\nÍndice: %-6d Valor: %-6d (Endereços) Anterior: %p Atual: %p Próximo: %p\n", i, current->value, current->prev, current, current->next);
current = current->next;
}
}
int main () {
int i;
char c;
List l = {0};
printf("Este programa adiciona valores inteiros à uma lista duplamente ligada, e depois permite excluí-los da mesma.\nDigite uma sequência de valores e pressione ENTER: ");
do {
if(!scanf("%d%c", &i, &c)) {
printf("Valor inválido detectado.");
return 1;
}
insertIn(&l, i);
} while (c != '\n');
printList(l);
printf("\nDigite uma sequência de valores a serem apagados e pressione ENTER: ");
do {
if(!scanf("%d%c", &i, &c)) {
printf("Valor inválido detectado.");
return 1;
}
removeFrom(&l, i);
} while (c != '\n');
printList(l);
return 0;
}

View File

@ -1,99 +0,0 @@
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
typedef struct item {
int value;
struct item * next;
} Item;
typedef struct {
Item * start;
} List;
int listSize (List * l) {
int size;
Item * index = l->start;
for (size = 0; index != NULL; size++)
index = index->next;
return size;
}
Item * findInOrderedList(int value, List * l) {
Item * index = l->start;
while (index != NULL && index->value < value)
index = index->next;
if (index == NULL || index->value != value)
return NULL;
return index;
}
Item * findInOrderedListAux(int value, List * l, Item * prev) {
prev = NULL;
Item * index = l->start;
while (index != NULL && index->value < value){
prev = index;
index = index->next;
}
if (index == NULL || index->value != value)
return NULL;
return index;
}
bool insertInOrderedList (int value, List * l) {
Item * prev = NULL, * i;
i = findInOrderedListAux(value, l, prev);
if (i != NULL)
return false;
i = malloc(sizeof(*i));
i->value = value;
if (prev == NULL) {
i->next = l->start;
l->start = i;
}
else {
i->next = prev->next;
prev->next = i;
}
return true;
}
bool removeFromOrderedList (int value, List * l) {
Item * prev = NULL, * i;
i = findInOrderedListAux(value, l, prev);
if (i != NULL)
return false;
if (prev == NULL)
l->start = i->next;
else
prev->next = i->next;
free(i);
return true;
}
void reinitializeList (List * l) {
Item * prev, * i = l->start;
while (i != NULL) {
prev = i;
i = i->next;
free(prev);
}
l->start = NULL;
}
int main () {
List l = {0};
Item * index = l.start;
printf("Lista: \"");
while (index != NULL) {
printf("$i ", index->value);
index = index->next;
}
printf("\"\n");
}

View File

@ -1,98 +0,0 @@
#include <stdio.h>
#include <stdbool.h>
#define MAX 50
typedef struct {
int index, next;
} Item;
typedef struct {
Item a[MAX];
int start, open;
} List;
void init (List * l) {
int i;
for (i = 0; i < MAX - 1; i++)
l->a[i].next = i + 1;
l->a[MAX -1].next = EOF;
l->start = EOF;
l->open = 0;
}
int listSize (List * l) {
int i = l->start, size;
for (size = 0; i != EOF; size++)
i = l->a[i].next;
return size;
}
int findInOrderedList (int k, List * l) {
int i = l->start;
while (i != EOF && l->a[i].index < k)
i = l->a[i].next;
if (i == EOF || l->a[i].index != k)
return EOF;
return i;
}
int openIndex (List * l) {
int result = l->open;
if (l->open != EOF)
l->open = l->a[l->open].next;
return result;
}
void returnIndex(int i, List * l) {
l->a[i].next = l->open;
l->open = i;
}
bool insertInSortedList (Item insert, List * l) {
if (l->open == EOF)
return false;
int prev, i = l->start, k = insert.index;
for (prev = EOF; i != EOF && l->a[i].index < k; prev = i)
i = l->a[i].next;
if (i != EOF || l->a[i].index == k)
return false;
i = openIndex(l);
l->a[i].index = k;
if (prev == EOF) {
l->a[i].next = l->start;
l->start = i;
}
else {
l->a[i].next = l->a[prev].next;
l->a[prev].next = i;
}
return true;
}
bool removefromSortedList (List * l, int k) {
int prev, i = l->start;
for (prev = EOF; i != EOF && l->a[i].index < k; prev = i)
i = l->a[i].next;
if (i == EOF || l->a[i].index != k)
return false;
if (prev == EOF)
l->start = l->a[i].next;
else
l->a[prev].next = l->a[i].next;
returnIndex(i, l);
return true;
}

View File

@ -1,38 +0,0 @@
# Semana 05: resposta ao [exercício proposto](http://www.each.usp.br/digiampietri/ACH2023/ACH2023_AtividadeSemanal05.pdf)
> Por Guilherme de Abreu Barreto[^1]
Para uma estrutura de tipo `stack` definida como:
```c
typedef struct {
int * value, size, top;
} Stack;
```
E inicializada na forma:
```c
Stack * initialize (int size) {
Stack *s = malloc(sizeof(*s));
s->value = malloc(size * sizeof(s->value));
s->size = size;
s->top = -1;
return s;
}
```
Tem-se impressos os conteúdos nesta armazenados, na ordem do fundo até o topo, por intermédio da seguinte função:
```c
void reversePrintStack (Stack *s) {
int i;
printf("Pilha (da base para o topo): \" ");
for (i = 0; i <= s->top; i++)
printf("%d\n", s->value[i]);
printf("\"\n");
}
```
[^1]: nUSP: 12543033

View File

@ -1,107 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct node {
int value;
struct node *prev;
struct node *next;
} Node;
Node * initialize () {
Node *n = malloc(sizeof(*n));
n->prev = n->next = n;
return n;
}
void reinitilize (Node * HEAD) {
Node *current = HEAD->next;
while (current != HEAD) {
current = current->next;
free(current->prev);
}
current->next = current->prev = current;
}
int listSize (Node *HEAD) {
Node *current = HEAD->next;
int size;
for (size = 0; current != HEAD; size++)
current = current->next;
return size;
}
void printList (Node *HEAD) {
Node *current = HEAD->next;
printf("Lista: \"");
while (current != HEAD) {
printf("%d ", current->value);
current = current->next;
}
printf("\"\n");
}
Node * findIn(Node *HEAD, int value) {
Node *current = HEAD->next;
HEAD->value = value;
while (current->value != value)
current = current->next;
return (current != HEAD) ? current : NULL;
}
/* Implementação que considera uma lista ordenada */
Node * findInOrdered(Node *HEAD, int value) {
Node *current;
if (abs(value - HEAD->next->value) < abs(value - HEAD->prev->value)) {
current = HEAD->next;
while (current->value < value)
current = current->next;
}
else {
current = HEAD->prev;
while (current-> value > value)
current = current->prev;
}
return (current == HEAD || current->value != value) ? NULL : current;
}
bool insertIn(Node *HEAD, int value) {
Node *prev, *current, *next;
prev = next = HEAD;
if (abs(value - HEAD->next->value) < abs(value - HEAD->prev->value)) {
for (next = HEAD->next; next->next != HEAD && next->value < value; next = next->next)
prev = next;
if (next->value == value)
return false;
}
else {
for (prev = HEAD->prev; prev->prev != HEAD && prev->value > value; prev = prev->prev)
next = prev;
if (prev->value == value)
return false;
}
current = malloc(sizeof(*current));
current->value = value;
current->next = prev->next;
prev->next = current;
current->prev = next->prev;
next->prev = current;
return true;
}
bool removeFrom(Node *HEAD, int value) {
Node * current = findInOrdered(HEAD, value);
if (current == NULL)
return false;
current->next->prev = current->prev;
current->prev->next = current->next;
free(current);
return true;
}

View File

@ -1,110 +0,0 @@
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
typedef struct node {
int value;
struct node *prev, *next;
} Node;
Node * initializeDequeue() {
Node *HEAD = malloc(sizeof(*HEAD));
HEAD->next = HEAD->prev = HEAD;
return HEAD;
}
int dequeueSize (Node *HEAD) {
Node *n;
int i = 0;
for (n = HEAD->next; n != HEAD; n = n->next)
i++;
return i;
}
void printDequeue(Node *HEAD) {
Node *n;
printf("Deque: \" ");
for (n = HEAD->next; n != HEAD; n = n->next)
printf("%d,", n->value);
printf("\"\n");
}
void AppendDequeue (Node *HEAD, int value) {
Node *n = malloc(sizeof(*n));
n->value = value;
n->next = HEAD;
n->prev = HEAD->prev;
HEAD->prev = n;
n->prev->next = n;
}
int popFirst (Node *HEAD) {
Node *n = HEAD->next;
int value = EOF;
if (n != HEAD) {
value = n->value;
HEAD->next = n->next;
n->next->prev = HEAD;
free(n);
}
return value;
}
int popLast (Node *HEAD) {
Node *n = HEAD->prev;
int value = EOF;
if (n != HEAD) {
value = n->value;
HEAD->prev = n->prev;
n->prev->next = HEAD;
free(n);
}
return value;
}
void reinitializeDequeue (Node *HEAD) {
Node *next, *prev;
for (next = HEAD->next; next != HEAD; free(prev)) {
prev = next;
next = next->next;
}
HEAD->next = HEAD->prev = HEAD;
}
void PrependDequeue (Node *HEAD, int value) {
Node *n = malloc(sizeof(*n));
n->value = value;
n->prev = HEAD;
n->next = HEAD->next;
HEAD->next = n;
n->next->prev = n;
}
int greatestValue (Node *HEAD) {
Node *n = HEAD->next;
int value;
if (n == HEAD)
return EOF;
value = n->value;
n = n->next;
while (n != HEAD) {
if (value < n->value)
value = n->value;
n = n->next;
}
return value;
}
int main () {
Node *HEAD = initializeDequeue();
/* code */
return 0;
}

View File

@ -1,48 +0,0 @@
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
typedef struct {
int * value, size, top;
} Stack;
Stack * initialize (int size) {
Stack *s = malloc(sizeof(*s));
s->value = malloc(size * sizeof(s->value));
s->size = size;
s->top = -1;
return s;
}
void printStack (Stack *s) {
int i;
printf("Lista: \"");
for (i = s->top; i >= 0; i--)
printf("%d ", s->value[i]);
printf("\"\n");
}
void reversePrintStack (Stack *s) {
int i;
printf("Pilha (da base para o topo): \" ");
for (i = 0; i <= s->top; i++)
printf("%d\n", s->value[i]);
printf("\"\n");
}
bool push (Stack * s, int value) {
if (s->top >= s->size + 1)
return false;
s->top = s->top + 1;
s->value[s->top] = value;
return true;
}
int pop (Stack * s) {
if (s->top < 0)
return EOF;
s->top -= 1;
return s->value[s->top + 1];
}

View File

@ -1,22 +0,0 @@
# Semana 06: resposta ao [exercício proposto](http://www.each.usp.br/digiampietri/ACH2023/ACH2023_AtividadeSemanal06.pdf)
> Por Guilherme de Abreu Barreto[^1]
```c
bool encontrarMax (DEQUE *d, int *max) {
PONT n = d->cabeca->prox;
if (n == d->cabeca)
return false;
*max = n->reg.chave;
n = n->prox;
while (n != d->cabeca) {
if (*max < n->reg.chave)
*max = n->reg.chave;
n = n->prox;
}
return true;
}
```
[^1]: nUSP: 12543033

View File

@ -1,54 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
typedef struct node {
int value;
struct node *under;
} Node;
int stackSize (Node *top) {
Node *n;
int i = 0;
for (n = top; n != NULL; n = n->under)
i++;
return i;
}
void printStack(Node *top) {
Node *n;
printf("Pilha: \" ");
for (n = top; n != NULL; n = n->under)
printf("%d,", n->value);
printf("\"\n");
}
void push(Node *top, int value) {
Node *n = malloc(sizeof(*n));
n->value = value;
n->under = top;
top = n;
}
int pop (Node *top) {
Node *n = top;
int value;
if (top == NULL)
return EOF;
value = top->value;
top = top->under;
free(n);
return value;
}
void destroyStack (Node *top) {
Node *n;
for (n = top; n != NULL; n = top) {
top = top->under;
free(n);
}
}

View File

@ -1,24 +0,0 @@
#include <stdlib.h>
typedef struct node{
int value;
struct node *prev, *next;
} Node;
Node * initializeDequeue() {
Node *HEAD = malloc(sizeof(*HEAD));
HEAD->next = HEAD->prev = HEAD;
return HEAD;
}
Node * insertionSort (Node *HEAD) {
Node *list, *sortedList;
if (!HEAD || HEAD->next == HEAD)
return HEAD;
sortedList = initializeDequeue();
for (list = HEAD->next; list != HEAD; list = list->next) {
/* code */
}
}

View File

@ -1,90 +0,0 @@
# Semana 07: resposta ao [exercício proposto](http://www.each.usp.br/digiampietri/ACH2023/ACH2023_AtividadeSemanal07.pdf)
> Por Guilherme de Abreu Barreto[^1]
Olá professor,
Optei por escrever o programa usando minhas próprias definições. Então, para fins de correção, submeto ele a você abaixo em sua inteiridade com a função `main` que utilizei para testar as funcionalidades de inserção (`push`) e exclusão (`pop`).
Abraços!
```c
#include <stdio.h>
#include <stdlib.h>
typedef struct node {
int value;
struct node *next;
} Node;
typedef struct {
Node *HEAD, *TAIL;
} Queue;
void push (Queue *q, int value) {
Node *n = malloc(sizeof(*n));
n->value = value;
n->next = NULL;
if (!q->HEAD->next)
q->HEAD->next = n;
else
q->TAIL->next = n;
q->TAIL = n;
}
int pop (Queue *q) {
int value;
Node *n = q->HEAD->next;
if (!n)
return EOF;
value = n->value;
q->HEAD->next = (n->next) ? n->next : NULL;
if (!q->HEAD->next)
q->TAIL = NULL;
free(n);
return value;
}
void printQueue (Queue *q) {
int i;
Node *current = q->HEAD->next;
for (i = 0; current; i++) {
printf("\nÍndice: %-6d Valor: %-6d (Endereços) Atual: %p Próximo: %p\n", i, current->value, current, current->next);
current = current->next;
}
}
int main () {
int i, value;
char c;
Queue q = {NULL};
q.HEAD = malloc(sizeof(q.HEAD));
printf("Este programa adiciona valores inteiros à uma fila, e depois permite excluí-los da mesma.\nDigite uma sequência de valores e pressione ENTER: ");
do {
if(!scanf("%d%c", &i, &c)) {
printf("Valor inválido detectado.");
return 1;
}
push(&q, i);
} while (c != '\n');
printQueue(&q);
printf("\nDigite uma quantia de valores a serem apagados e pressione ENTER: ");
i = 0;
for (scanf("%d", &i); i > 0; i--) {
value = pop(&q);
if (value == EOF)
break;
printf("\nValor apagado: %d", value);
}
printf("\n");
printQueue(&q);
return 0;
}
```
[^1]: nUSP: 12543033

View File

@ -1,66 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct node {
int value;
struct node *next;
} Node;
typedef struct {
Node *start, *end;
} Queue;
int queueLength (Queue *q) {
int i;
Node *n = q->start;
for (i = 0; n; i++)
n = n->next;
return i;
}
void printQueue (Queue *q) {
Node *n;
printf("Fila: \" ");
for (n = q->start; n; n = n->next)
printf("%d ", n->value);
printf("\"\n");
}
void push (Queue *q, int value) {
Node *n = malloc(sizeof(*n));
n->value = value;
n->next = NULL;
if (!q->start)
q->start = n;
else
q->end->next = n;
q->end = n;
}
int pop (Queue *q) {
int value;
Node *n = q->start;
if (!n)
return EOF;
value = q->start->value;
q->start = (n->next) ? n->next : NULL;
if (!q->start)
q->end = NULL;
free(n);
return value;
}
void reinitializeQueue (Queue *q) {
Node *n, *erase;
for (n = q->start; n; free(erase)) {
erase = n;
n = n->next;
}
q->start = q->end = NULL;
}

View File

@ -1,76 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
typedef struct node {
int value;
struct node *next;
} Node;
typedef struct {
Node *HEAD, *TAIL;
} Queue;
void push (Queue *q, int value) {
Node *n = malloc(sizeof(*n));
n->value = value;
n->next = NULL;
if (!q->HEAD->next)
q->HEAD->next = n;
else
q->TAIL->next = n;
q->TAIL = n;
}
int pop (Queue *q) {
int value;
Node *n = q->HEAD->next;
if (!n)
return EOF;
value = n->value;
q->HEAD->next = (n->next) ? n->next : NULL;
if (!q->HEAD->next)
q->TAIL = NULL;
free(n);
return value;
}
void printQueue (Queue *q) {
int i;
Node *current = q->HEAD->next;
for (i = 0; current; i++) {
printf("\nÍndice: %-6d Valor: %-6d (Endereços) Atual: %p Próximo: %p\n", i, current->value, current, current->next);
current = current->next;
}
}
int main () {
int i, value;
char c;
Queue q = {NULL};
q.HEAD = malloc(sizeof(q.HEAD));
printf("Este programa adiciona valores inteiros à uma fila, e depois permite excluí-los da mesma.\nDigite uma sequência de valores e pressione ENTER: ");
do {
if(!scanf("%d%c", &i, &c)) {
printf("Valor inválido detectado.");
return 1;
}
push(&q, i);
} while (c != '\n');
printQueue(&q);
printf("\nDigite uma quantia de valores a serem apagados e pressione ENTER: ");
i = 0;
for (scanf("%d", &i); i > 0; i--) {
value = pop(&q);
if (value == EOF)
break;
printf("\nValor apagado: %d", value);
}
printf("\n");
printQueue(&q);
return 0;
}

View File

View File

@ -9,16 +9,17 @@ typedef struct node{
} Node;
Node * findValue (Node *parent, int value) {
Node * tmp;
Node * n;
if (!parent || parent->value == value)
return parent;
tmp = findValue(parent->left, value);
return (tmp) ? tmp : findValue(parent->right, value);
n = findValue(parent->left, value);
return (n) ? n : findValue(parent->right, value);
}
Node * newNode (int value) {
Node *new = malloc(sizeof(Node));
new->value = value;
new->left = new->right = NULL;
return new;
@ -28,10 +29,12 @@ void createRoot (Node **root, int value) {
*root = newNode(value);
}
bool setChild (Node * root, int childValue, int parentValue, side s) {
bool setChild (Node *root, int childValue, int parentValue, side s) {
Node *child, *parent = findValue(root, parentValue);
if (!parent)
return false;
child = newNode(childValue);
if (s == left) {
child->left = parent->left;

View File

@ -1,26 +0,0 @@
# Semana 11: resposta ao [exercício proposto](http://www.each.usp.br/digiampietri/ACH2023/ACH2023_AtividadeSemanal11.pdf)
> Por Guilherme de Abreu Barreto[^1]
```mermaid
classDiagram
12543200 --> 11833130
11833130 --> 10438650
11833130 --> 12542960
12543200 --> 12681290
12681290 --> 12563770
12681290 --> 12695670
12563770 --> 12543033
class 12543200
class 11833130
class 10438650
class 12542960
class 12681290
class 12563770 {
(PONT) esq
}
class 12695670
class 12543033
```
[^1]: nUSP: 12543033

View File

@ -1,102 +0,0 @@
#include <stdlib.h>
#include <stdbool.h>
typedef struct node{
int value;
/* Pointers to nodes which store values that are less or equal (le) and greater than (gt) the current node's. */
struct node *parent, *le, *gt;
} Node;
Node * newNode(int value){
Node *new = malloc(sizeof(Node));
new->parent = new->le = new->gt = NULL;
new->value = value;
return new;
}
void insertNode(Node **root, Node *new) {
if (!*root) {
*root = new;
return;
}
new->parent = *root;
if (new->value > (*root)->value)
insertNode(&(*root)->gt, new);
else
insertNode(&(*root)->le, new);
}
Node * findNode(Node *root, int value) {
if (!root)
return NULL;
if (root->value == value)
return root;
if (root->value > value)
return findNode(root->le, value);
return findNode(root->gt, value);
}
Node * findMaxValue (Node *root) {
if (!root->gt)
return root;
return findMaxValue(root->gt);
}
void rearrangeTree (Node *root, Node *branch) {
if (branch->parent != root) {
branch->parent->gt = branch->le;
branch->le = root->le;
}
branch->gt = root->gt;
}
Node * selectBranch (Node *root) {
Node *branch;
if (root->le) {
if (!root->gt)
return root->le;
branch = findMaxValue(root->le);
rearrangeTree(root, branch);
return branch;
}
return root->gt;
}
void substituteNode (Node *root, Node *branch) {
if (branch) {
if (root->parent) {
if (root->value < root->parent->value)
root->parent->le = branch;
else
root->parent->gt = branch;
branch->parent = root->parent;
}
else
branch->parent = NULL;
}
free(root);
root = branch;
}
bool excludeNode(Node **root, int value) {
if (!*root)
return false;
if ((*root)->value != value)
return excludeNode((value > (*root)->value) ? &(*root)->gt : &(*root)->le, value);
substituteNode(*root, selectBranch(*root));
return true;
}
int treeSize (Node *root) {
if (!root)
return 0;
return treeSize(root->le) + treeSize(root->gt) + 1;
}
int main () {
Node *new = newNode(23), *r = NULL;
insertNode(&r,new);
return 0;
}

View File

@ -1,18 +0,0 @@
# Semana 13
> Resposta ao [exercício proposto](http://www.each.usp.br/digiampietri/ACH2023/ACH2023_AtividadeSemanal13.pdf), por Guilherme de Abreu Barreto[^1]
```c
void encontrarMinMaxRec(PONT raiz, char* min, char* max){
if (!raiz)
return;
if (raiz->chave < *min)
*min = raiz->chave;
else if (raiz->chave > *max)
*max = raiz->chave;
encontrarMinMaxRec(raiz->ultimoFilho, min, max);
encontrarMinMaxRec(raiz->proximoIrmao, min, max);
}
```
[^1]: nUSP: 12543033

View File

@ -1,178 +0,0 @@
/******************************************************************************
arvoreEnaria2.c
Este programa gerencia arvores n-arias (cada noh pode ter um numero ilimitado
de filhos). Cada noh possui dois ponteiros um para seu ultimo filho e um para
o seu irmao a direita (essa lista de irmaos funciona como uma lista ligada).
******************************************************************************/
#include <malloc.h>
#include <stdio.h>
#define true 1
#define false 0
typedef int bool;
typedef char TIPOCHAVE;
typedef struct auxNo {
TIPOCHAVE chave;
struct auxNo * ultimoFilho;
struct auxNo * proximoIrmao;
} NO, *PONT;
/* retorna o endereco do NO que contem chave=ch ou NULL caso a chave nao seja
encontrada. */
PONT buscarChave(PONT raiz, TIPOCHAVE ch){
if (raiz == NULL) return NULL;
if (raiz->chave == ch) return raiz;
PONT aux = buscarChave(raiz->ultimoFilho, ch);
if (aux) return aux;
return buscarChave(raiz->proximoIrmao, ch);
}
/* retorna o tamanho (numero de nos da arvore) */
int numeroDeNos(PONT raiz){
if (!raiz) return 0;
int res = 1;
PONT filhos = raiz->ultimoFilho;
while (filhos != NULL) {
res += numeroDeNos(filhos);
filhos = filhos->proximoIrmao;
}
return res;
}
/* retorna o tamanho (numero de nos da arvore) */
int numeroDeNos2(PONT raiz){
if (!raiz) return 0;
return 1 + numeroDeNos2(raiz->ultimoFilho) + numeroDeNos2(raiz->proximoIrmao);
}
/* retorna a altura da arvore */
int altura(PONT raiz){
if (!raiz) return -1;
int max = -1;
int temp;
PONT filhos = raiz->ultimoFilho;
while (filhos != NULL) {
temp = altura(filhos);
if (temp > max) max = temp;
filhos = filhos->proximoIrmao;
}
return max + 1;
}
PONT criarNovoNo(TIPOCHAVE ch){
PONT novoNo = (PONT)malloc(sizeof(NO));
novoNo->ultimoFilho = NULL;
novoNo->proximoIrmao = NULL;
novoNo->chave = ch;
return novoNo;
}
bool inserirFilho(PONT raiz, TIPOCHAVE novaChave, TIPOCHAVE chavePai){
PONT pai = buscarChave(raiz, chavePai);
if (!pai) return false;
PONT novo = criarNovoNo(novaChave);
novo->ultimoFilho = NULL;
novo->proximoIrmao = pai->ultimoFilho;
pai->ultimoFilho = novo;
return true;
}
void exibirArvore(PONT raiz){
if (raiz == NULL) return;
printf("%c",raiz->chave);
PONT filhos = raiz->ultimoFilho;
if (filhos == NULL) return;
printf("(");
while (filhos != NULL) {
exibirArvore(filhos);
filhos = filhos->proximoIrmao;
}
printf(")");
}
PONT criarRaiz(TIPOCHAVE novaChave){
return criarNovoNo(novaChave);
}
void encontrarMinMaxRec(PONT raiz, char* min, char* max){
if (!raiz)
return;
if (raiz->chave < *min)
*min = raiz->chave;
else if (raiz->chave > *max)
*max = raiz->chave;
encontrarMinMaxRec(raiz->ultimoFilho, min, max);
encontrarMinMaxRec(raiz->proximoIrmao, min, max);
}
bool encontrarMinMax(PONT raiz, char* min, char* max){
if (!raiz) return false;
*min = raiz->chave;
*max = raiz->chave;
encontrarMinMaxRec(raiz, min, max);
return true;
}
int main(){
PONT raiz = criarRaiz('a');
printf("Numero de nos: %i\n", numeroDeNos(raiz));
printf("Altura: %i\n", altura(raiz));
exibirArvore(raiz);
printf("\n");
inserirFilho(raiz,'b','a');
printf("Numero de nos: %i\n", numeroDeNos(raiz));
printf("Altura: %i\n", altura(raiz));
exibirArvore(raiz);
printf("\n");
inserirFilho(raiz,'c','a');
printf("Numero de nos: %i\n", numeroDeNos(raiz));
printf("Altura: %i\n", altura(raiz));
exibirArvore(raiz);
printf("\n");
inserirFilho(raiz,'d','a');
printf("Numero de nos: %i\n", numeroDeNos(raiz));
printf("Altura: %i\n", altura(raiz));
exibirArvore(raiz);
printf("\n");
inserirFilho(raiz,'e','b');
printf("Numero de nos: %i\n", numeroDeNos(raiz));
printf("Altura: %i\n", altura(raiz));
exibirArvore(raiz);
printf("\n");
inserirFilho(raiz,'f','b');
printf("Numero de nos: %i\n", numeroDeNos(raiz));
printf("Altura: %i\n", altura(raiz));
exibirArvore(raiz);
printf("\n");
inserirFilho(raiz,'g','b');
printf("Numero de nos: %i\n", numeroDeNos(raiz));
printf("Altura: %i\n", altura(raiz));
exibirArvore(raiz);
printf("\n");
inserirFilho(raiz,'h','d');
printf("Numero de nos: %i\n", numeroDeNos(raiz));
printf("Altura: %i\n", altura(raiz));
exibirArvore(raiz);
printf("\n");
inserirFilho(raiz,'i','h');
printf("Numero de nos: %i\n", numeroDeNos(raiz));
printf("Altura: %i\n", altura(raiz));
exibirArvore(raiz);
printf("\n");
inserirFilho(raiz,'j','h');
printf("Numero de nos: %i\n", numeroDeNos(raiz));
printf("Altura: %i\n", altura(raiz));
exibirArvore(raiz);
printf("\n");
char min1, max1;
if (encontrarMinMax(raiz, &min1, &max1)) {
printf("Menor chave na arvore: %c, maior chave na arvore: %c\n", min1, max1);
}
char fim;
printf("\nPressione <ENTER> para terminar.\n");
scanf("%c",&fim);
return 0;
}

View File

@ -1,88 +0,0 @@
#include <stdlib.h>
#include <stdbool.h>
typedef struct node{
int value;
struct node *parent, *le, *gt;
} Node;
Node * newNode(int value){
Node *new = malloc(sizeof(Node));
new->parent = new->le = new->gt = NULL;
new->value = value;
return new;
}
void insertNode(Node **root, Node *new) {
if (!*root) {
*root = new;
return;
}
new->parent = *root;
if (new->value > (*root)->value)
insertNode(&(*root)->gt, new);
else
insertNode(&(*root)->le, new);
}
Node * findNode(Node *root, int value) {
if (!root)
return NULL;
if (root->value == value)
return root;
if (root->value > value)
return findNode(root->le, value);
return findNode(root->gt, value);
}
Node * findMaxValue (Node *root) {
if (!root->gt)
return root;
return findMaxValue(root->gt);
}
void rearrangeTree (Node *root, Node *branch) {
if (branch->parent != root) {
branch->parent->gt = branch->le;
branch->le = root->le;
}
branch->gt = root->gt;
}
Node * selectBranch (Node *root) {
Node *branch;
if (root->le) {
if (!root->gt)
return root->le;
branch = findMaxValue(root->le);
rearrangeTree(root, branch);
return branch;
}
return root->gt;
}
void substituteNode (Node *root, Node *branch) {
if (branch) {
if (root->parent) {
if (root->value < root->parent->value)
root->parent->le = branch;
else
root->parent->gt = branch;
branch->parent = root->parent;
}
else
branch->parent = NULL;
}
free(root);
root = branch;
}
bool excludeNode(Node **root, int value) {
if (!*root)
return false;
if ((*root)->value != value)
return excludeNode((value > (*root)->value) ? &(*root)->gt : &(*root)->le, value);
substituteNode(*root, selectBranch(*root));
return true;
}

View File

@ -1,54 +0,0 @@
#include <stdlib.h>
#include <stdbool.h>
typedef struct node{
int value;
struct node *child, *parent, *sibling;
} Node;
Node * findNode (Node *root, int value);
Node * searchChild (Node *child, int value);
Node * newNode (int value) {
Node *new = malloc(sizeof(Node));
new->value = value;
new->child->parent->sibling = NULL;
return new;
}
void addSibling (Node * child, Node *n) {
if (!child->sibling)
child->sibling = n;
else
addSibling(child->sibling, n);
}
bool insertNode (Node *root, Node *n, int target) {
root = findNode(root, target);
if (!root)
return false;
if (!root->child)
root->child = n;
else
addSibling(root->child, n);
return true;
}
Node * searchChild(Node *child, int value) {
Node *target;
if(!child)
return NULL;
target = findNode(child, value);
if (target)
return target;
return searchChild(child->sibling, value);
}
Node * findNode(Node *root, int value) {
if (!root)
return NULL;
if (root->value == value)
return root;
return searchChild(root->child, value);
}

View File

@ -1,128 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <sys/param.h>
typedef struct branch{
int value, height;
struct branch *lt, *gt;
} Branch;
typedef enum {left, right} rotation;
Branch * newBranch(int value){
Branch *new = malloc(sizeof(Branch));
new->value = value;
new->height = 0;
new->lt = new->gt = NULL;
return new;
}
int height (Branch *root) {
if (!root)
return -1;
return root->height;
}
void updateHeight (Branch *root) {
root->height = MAX(height(root->lt), height(root->gt)) + 1;
}
void rotate (Branch **root, rotation direction) {
Branch *newRoot, *child;
if (direction == left) {
newRoot = (*root)->gt;
child = newRoot->lt;
/* Rotation */
newRoot->lt = *root;
(*root)->gt = child;
}
else {
newRoot = (*root)->lt;
child = newRoot->gt;
/* Rotation */
newRoot->gt = *root;
(*root)->lt = child;
}
updateHeight(*root);
updateHeight(newRoot);
*root = newRoot;
}
void balanceTree (Branch **root, int value) {
int balance = height((*root)->lt) - height((*root)->gt);
updateHeight(*root);
/* Left heavy */
if (balance > 1) {
if (value > (*root)->lt->value)
rotate(&(*root)->lt, left);
rotate(root, right);
}
/* Right heavy */
else if (balance < -1) {
if (value < (*root)->gt->value)
rotate(&(*root)->gt, right);
rotate(root, left);
}
}
void insertBranch(Branch **root, Branch *new) {
if (!*root) {
*root = new;
return;
}
if (new->value > (*root)->value)
insertBranch(&(*root)->gt, new);
else if (new->value < (*root)->value)
insertBranch(&(*root)->lt, new);
else
free(new);
if (new)
balanceTree(root, new->value);
}
void preOrder(Branch *root) {
if (!root)
return;
printf("%d ", root->value);
preOrder(root->lt);
preOrder(root->gt);
}
/* Driver program to test above function*/
int main()
{
Branch *root = NULL;
/* Constructing tree given in the above figure */
insertBranch(&root, newBranch(10));
insertBranch(&root, newBranch(20));
insertBranch(&root, newBranch(30));
insertBranch(&root, newBranch(40));
insertBranch(&root, newBranch(50));
insertBranch(&root, newBranch(25));
/* The constructed AVL Tree would be
30
/ \
20 40
/ \ \
10 25 50
*/
printf("Preorder traversal of the constructed AVL"
" tree is \n");
preOrder(root);
printf("\n");
return 0;
}

View File

@ -1,23 +0,0 @@
# Semana 14
> Resposta ao [exercício proposto](http://www.each.usp.br/digiampietri/ACH2023/ACH2023_AtividadeSemanal14.pdf), por Guilherme de Abreu Barreto[^1]
```mermaid
classDiagram
class 15 {
(PONT) esq
}
10 --> 4
10 --> 12
4 --> 2
4 --> 7
2 --> 1
2 --> 3
7 --> 5
7 --> 8
12 --> 11
12 --> 15
15 --> 13
```
[^1]: nUSP: 12543033

View File

@ -1,69 +0,0 @@
# Atividade 1
## Capítulo 4.9
### Exercício 29
Encontre $f$, onde $f'''(t) = \cos t$.
#### Resolução
Conforme a tabela dos integrais,
$f'''(t) = \cos t \\
f'' (t) = \sin t + C_1 \\
f' (t) = - \cos t + C_1x + C_2 \\
f(t) = - \sin t + \dfrac{C_1x^2}2 + C_2x + C_3
$
### Exercício 67
Um objeto é lançado para cima com velocidade inicial $v_0$ metros por segundo a partir de um ponto $s_0$ metros acima do solo. Mostre que
$$
[v(t)]^2 = v_0^2 - 19,6[s(t) - s_0]
$$
#### Resolução
$a(t) = v'(t) \approx -9,8 \\
v(t) = a(t)t + C_1 = a(t)t + v_0 = s'(t)\implies t = \dfrac{v(t) - v_0}{a(t)} \\
s(t) = \dfrac{a(t)t^2}2 + v_0t + C_2 = \dfrac{a(t)t^2}2 + v_0t + s_0 \\
s(t) - s_0 = t \left[ \dfrac{a(t)t}2 + v_0 \right] \\\ \\
s(t) - s_0 = \left[ \dfrac{v(t) - v_0}{a(t)} \right] \left[ \dfrac{\cancel{a(t)}}2 \cdot \dfrac{v(t) - v_0}{\cancel{a(t)}} + v_0 \right] \\\ \\
s(t) - s_0 = \dfrac{[v(t) - v_0][v(t) - \cancel{v_0} + \cancel 2v_0]}{2a(t)} \\\ \\
2a(t)[s(t) - s_0] = [v(t)]^2 - v_0^2 \\\ \\
\bm{[v(t)]^2 = v_0^2 -19,6 [s(t) - s_0]}
$
## Capítulo 5.2
### Exercício 37
Calcule a integral de $\int_{-3}^0 (1 + \sqrt{9 - x^2})\ dx$, interpretando-a em termos das áreas.
#### Resolução
$\int_{-3}^0 (1 + \sqrt{9 - x^2})\ dx =\\ \int_{-3}^0 1 \ dx + \int_{-3}^0 \sqrt{9 - x^2}\ dx =\\ 1 \cdot (0 - (-3)) + \int_{-3}^0 \sqrt{9 - x^2}\ dx = 3 + \int_{-3}^0 \sqrt{9 - x^2}\ dx$
Considerando $y = \sqrt{9 - x^2}$ temos que o segundo termo da equação anterior refere-se à uma área posicionada no segundo quadrante ($[-3,0]$) e estritamente positiva ($0 \le y \le 3$). Também percebemos que esta possui forma circular pois a equação se assemelha à aquela do círculo ($y^2 + x^2 = r^2$):
$y = \sqrt{9 - x^2} \implies y^2 + x^2 = 9$
Onde $r^2 = 9$. Assim, substituindo $\int_{-3}^0 \sqrt{9 - x^2}\ dx$ pela área de um quadrante de um círculo de raio $3$, temos:
$\int_{-3}^0 (1 + \sqrt{9 - x^2})\ dx = 3 + \dfrac{9\pi}4$
### Exercício 53
Cada uma das regiõves $A$, $B$ e $C$ delimitadas pelo gráfico de $f$ e o eixo $x$ tem área $3$. Encontre o valor de
$$
\int_{-4}^2 [f(x) + 2x +5]\ dx
$$
<img src="file:///home/user/Public/USP/Sistemas%20de%20Informação/2º%20semestre/Cálculo%20II/Imagens/2021-08-31-19-16-21-image.png" title="" alt="" data-align="center">
#### Resolução
$\int_{-4}^2 [f(x) + 2x +5]\ dx = \int_{-4}^2 f(x)\ dx + \underbrace{\int_{-4}^2 2x \ dx}_{\text{função linear}} + \underbrace{\int_{-4}^2 5\ dx}_{\text{função constante}} =\\\ \\ (-3 + 3 - 3) + \left(\dfrac{2 \cdot 4}2 - \dfrac{4 \cdot 8}2 \right) + 5 (2 - (-4)) = \bm{15}$

View File

@ -1,57 +0,0 @@
# Importantes tabelas de Cálculo
## Tabela das derivadas
| Primitiva | Derivada |
| --------------------------- | ---------------------------------------------------------- |
| $f(x) = c$ | $f'(x) = 0$ |
| $f(x) = x^n$ | $f'(x) = nx^{n - 1}$ |
| $f(x) = c x^n$ | $f'(x) = cnx^{n - 1}$ |
| $f(x) = g(x) h(x)$ | $f'(x) = g(x) h'(x) + g'(x) h(x)$ |
| $f(x) = \dfrac{g(x)}{h(x)}$ | $f'(x) = \dfrac{h(x)g'(x) - g(x) h'(x)}{\big(h(x)\big)^2}$ |
| $f(x) = a^x$ | $f'(x) = a^x\ln a $ |
| $f(x) = log_ax$ | $f'(x) = \dfrac1{x\ln a}$ |
### Derivadas trigonométricas
| Primitiva | Derivada |
| ------------------------- | ------------------------------------ |
| $f(x) = \sin x$ | $f'(x) = \cos x$ |
| $f(x) = \cos x$ | $f'(x) = - \sin x$ |
| $f(x) = \tan x$ | $f'(x) = \sec^2x$ |
| $f(x) = \cot x$ | $f'(x) = -\csc^2x$ |
| $f(x) = \sec x$ | $f'(x) = \sec x \tan x$ |
| $f(x) = \csc x$ | $f'(x) = - \csc x \cot x$ |
| $f(x) = \arcsin x$ | $f'(x) = \dfrac 1{\sqrt{1 - x^2}}$ |
| $f(x) = \arccos x$ | $f'(x) = - \dfrac 1{\sqrt{1 - x^2}}$ |
| $f(x) = \arctan x$ | $f'(x) = \dfrac 1{1 + x^2}$ |
| $f(x) = \text{arccot } x$ | $f'(x) = - \dfrac 1{1 + x^2}$ |
### Regra da cadeia
Se $y$ é uma função derivável de $u$ e $u$ é uma função derivável de $x$, então $y$ é uma função derivável de $x$ e
$$
\dfrac{dy}{dx} = \dfrac{dy}{du} \cdot \dfrac{du}{dx}
$$
## Tabela das integrais
| Derivada | Primitiva |
| -------------------------- | ------------------------------ |
| $cf'(x)$ | $cf(x) + C$ |
| $f'(x) + g'(x)$ | $f(x) + g(x) + C$ |
| $x^n, n \not = -1$ | $\dfrac{x^{n + 1}}{n + 1} + C$ |
| $\dfrac 1x$ | $\ln \|x\| + C$ |
| $e^x$ | $e^x + C$ |
| $a^x$ | $\dfrac{a^x}{\ln \|x\|}$ |
| $\cos x$ | $\sin x + C$ |
| $\sin x$ | $- \cos x + C$ |
| $\sec^2x$ | $\tan x + C$ |
| $\csc^2 x$ | $- \cot x + C$ |
| $\sinh x$ | $\cosh x + C$ |
| $\cosh x$ | $\sinh x + C$ |
| $\csc x \cot x$ | $- \csc x + C$ |
| $\sec x \tan x$ | $\sec x + C$ |
| $\dfrac 1{\sqrt{1 - x^2}}$ | $\sin^{-1} + C = \arcsin + C$ |
| $\dfrac 1{1 + x^2}$ | $\tan^{-1} + C = \arctan + C$ |

View File

@ -1,66 +0,0 @@
# Propriedades dos integrais e somatórios
## Definição geral dos integrais
$$
\int_a^b f(x)\ dx = \lim_{n \to \infty}
\underbrace{\sum^n_{i = 1} f(x_i) \Delta x}
_{\text{Soma de Reimann}} = \lim_{n \to \infty} \dfrac{b - a}n \sum^n_{i = 1}
f\left(i \cdot \dfrac{b - a}n \right)
$$
## Propriedades dos integrais
1. $\displaystyle \int_a^b f(x)\ dx = - \int_b^a f(x)\ dx$
2. $\displaystyle \int_a^a f(x)\ dx = 0$
3. $\displaystyle \int_a^b c\ dx = c\ (b - a)$
4. $\displaystyle \int_a^b c f(x)\ dx = c \int_a^b f(x)\ dx$
5. $\displaystyle \int_a^b [f(x) \pm g(x)]\ dx = \int_a^b f(x)\ dx \pm \int_a^b g(x)\ dx$
6. $\displaystyle \int_a^b f(x)\ dx + \int_b^c f(x)\ dx = \int_a^c f(x)\ dx$
7. $\displaystyle \int dx = x$
## Propriedades da somatória
1. $\displaystyle \sum^n_{i = 1} i = \dfrac{n (n + 1)}2$[^1]
2. $\displaystyle \sum^n_{i = 1} i^2 = \dfrac{n (n + 1)(2n + 1)}6$
3. $\displaystyle \sum^n_{i = 1} i^3 = \left[\dfrac{n (n + 1)}2\right]^2$
4. $\displaystyle \sum^n_{i = 1} c = nc$
5. $\displaystyle \sum^n_{i = 1} c\ a_i = \displaystyle c \sum^n_{i = 1} a_i$
6. $\displaystyle \sum^n_{i = 1} (a_i \pm b_i) = \sum^n_{i = 1} a_i \pm \sum^n_{i = 1} b_i$
7. $\displaystyle \sum^n_{i = 1} a^i = \dfrac{a(a^n - 1)}{a - 1}$[^2]
## Regra do ponto médio
Quando a Somatória de Reimann é expressa enquanto
$$
\displaystyle \sum^n_{i = 1} f(\overline x_i) \Delta x
$$
Onde $\overline x_i = \frac 12 (x_{i - 1} + x_i)$.
## Propriedades comparativas da Integral
Considerando $a \le x \le b$:
- Se $f(x) \ge 0$, então $\int^b_a f(x)\ dx \ge 0$.
- Se $f(x) \ge g(x)$, então $\int^b_a f(x)\ dx \ge \int^b_a g(x)\ dx$.
- Se $m \le f(x) \le M$, então $m (b - a) \le \int^b_a f(x)\ dx \le M (b - a)$
[^1]: Fórmula da somatória de uma progressão aritmética
[^2]: Fórmula da somatória de uma progressão geométrica

View File

@ -1,141 +0,0 @@
# Atividade 10
> Resolução dos exercícios obrigatórios, feita por Guilherme de Abreu Barreto[^1].
## Capítulo 14.6
### Exercício 35
Seja $f$ uma função de duas variáveis que tenha derivadas parciais contínuas e considere os pontos
- $A(1, 3)$,
- $B(3, 3)$,
- $C(1, 7)$ e
- $D(6, 15)$.
E as derivadas direcionais de $f$ em $A$ em direção aos vetores
- $D_{\overrightarrow{AB}}f = 3$ ,
- $D_{\overrightarrow{AC}} f = 26$.
Determine a derivada direcional de $f$ em $A$ na direção do vetor $\vec{AD}$.
#### Resolução
Sejam $x$ e $y$ as duas variáveis para qual $f$ está definida.
1. Nota-se que em $\vec{AB}$ ocorre variação apenas em $x$ enquanto em $\vec{AC}$ ocorre variação apenas em $y$. Então,
- $D_{\overrightarrow{AB}}f(1,3) = f_x(1,3)a + \cancel{f_y(1,3)b}\ = 3 \implies f_x(1,3)a = 3$;
- $D_{\overrightarrow{AC}}f(1,3) = \cancel{f_x(1,3)a} + f_y(1,3)b = 26 \implies f_y(1,3)b = 26$;
2. Com isso conseguimos inferir o vetor gradiente $\nabla f(1,3)$:
$$
\nabla f(1,3) = f_x(1,3)a + f_y(1,3)b = \lang f_x(1,3), f_y(1,3) \rang = \lang 3, 26 \rang
$$
3. Podemos agora aferir a derivada direcional $D_{\overrightarrow{AD}}f(1,3)$ a partir da equação $D_\textbf u f(1,3) = \nabla f(1,3) \cdot \textbf u$, onde $\textbf u$ é o vetor unitário com direção $\vec{AD}$ tal que
$\displaystyle \textbf u = \left \lang \frac{x - x_0}{\sqrt{(x - x_0)^2 + (y - y_0)^2}},
\frac{y - y_0}{\sqrt{(x - x_0)^2 + (y - y_0)^2}} \right \rang\\\ \\ = \left \lang \frac{5}{\sqrt{5^2 + 12^2}},
\frac{12}{\sqrt{5^2 + 12^2}} \right\rang = \left\lang \frac{5}{13}, \frac{12}{13} \right\rang$
4. Por fim, temos que
$\displaystyle D_\textbf u f(1,3) = \lang 3,26 \rang \cdot \left\lang \frac{5}{13}, \frac{12}{13} \right\rang = 3 \cdot \frac 5{13} + 26 \cdot \frac{12}{13} = \dfrac{327}{13}\ \blacksquare$
### Exercício 57
Mostre que todo plano que é tangente ao cone $x^2 + y^2 = z^2$ passa pela origem.
#### Resolução
Por hipótese, podemos descrever o cone enquanto uma função $f(x,y,z) = x^2 + y^2 - z^2$. O cone toca a origem quando $z = \sqrt{x^2 + y^2} = 0$, ou seja, $z = 0 \iff x = y = 0$ . Seja $P(x_0, y_0, z_0)$ um ponto qualquer na superfície $S$ do cone. Utilizando a equação geral do plano, podemos escrever a equação do plano tangente à $S$ em $P$ como
$f_x(x_0,y_0,z_0)(x - x_0) + f_y(x_0,y_0,z_0)(y - y_0) + f_z(x_0,y_0,z_0)(z - z_0) = 0 \\\ \\\implies \cancel 2x(x - x_0) + \cancel 2y (y - y_0) - \cancel 2z(z - z_0) = 0 \\\ \\ \implies x^2 + y^2 - z^2 = xx_0 + yy_0 -zz_0$
Já estabelecemos que a expressão $x^2 + y^2 - z^2$ perpassa a origem quando $x = y = z = 0$, então o outro lado da igualdade, $xx_0 + yy_0 -zz_0$, também é uma equação que perpassa a origem e, portanto, a equação do plano no total é representativa de um plano que cruza a origem. $\blacksquare$
## Capítulo 14.7
### Exercício 23
Utilize um gráfico ou curvas de nível para estimar os valores máximos e mínimos locais e pontos de sela da função $f(x,y) =\sin x + \sin y + \sin(x + y)$, quando $0 \le x \le 2\pi$ e $0 \le y \le 2\pi$. Em seguida, use o cálculo para determinar esses valores de modo preciso.
<div style="page-break-before: always;"></div>
#### Resolução
<img src="file:///home/user/Public/USP/Sistemas%20de%20Informação/2º%20semestre/Cálculo%20II/Atividade%2010/Imagens/2021-11-25-13-35-23-image.png" title="" alt="" data-align="center">
> Gráfico da função $f$
Observa-se pelo gráfico que a função, no domínio descrito, possui um ponto máximo, um ponto de sela e um ponto mínimo. Vamos determiná-los em seus valores e coordenadas $(x,y)$. Iniciemos por encontrar suas derivadas parciais:
$f(x,y) =\sin x + \sin y + \sin(x + y) \begin{cases} f_x = \cos x + \cos (x + y) \\ f_y = \cos y + \cos (y + y) \end{cases}$
Num ponto crítico, tem-se que $f_x = f_y = 0$, logo,
$\begin{cases} f_x = 0 \implies \cos x + \cos (x + y) = 0 \implies \cos(x + y) = \cos x \\ f_y = 0 \implies \cos(x + y) = \cos y \end{cases}\\ \therefore x = y$
Vemos então que todos os pontos críticos encontram-se em coordenadas $(x,x)$, o que é útil para encontrá-las, embora insuficiente para diferenciá-las. Mudemos nossa abordagem para encontrá-las fazendo uso de uma função de uma única variável $g(x) = 2 \sin x + \sin 2x$. Podemos encontrar os pontos críticos desta derivando-a e em seguida igualando-a a zero:
$g'(x) = 2 \cos x + 2\cos 2x = 0 \implies \cos x + \cos 2x = 0 \\\implies \cos x + \cos^2 x - \sin^2 x = 0 \implies \cos x + \cos^2x - (1 - \cos^2 x) = 0 \\\implies 2\cos^2x + \cos x - 1 = 0$
Ao admitirmos $z = \cos x$ temos pela aplicação da fórmula de Bhaskara:
$$
2z^2 + z - 1 = 0 \implies 2\left(z - \dfrac 12 \right)(z + 1) = 0
$$
Tirando as raízes desta equação, obtemos:
$$
z = \cos x \begin{cases}
\cos x = -1 \implies x = \pi \\
\cos x = \dfrac 12 \begin{cases}
x = \dfrac \pi3 \\\ \\
x = \dfrac{5\pi}3\end{cases} \end{cases}
$$
Tais são os pontos críticos desta função no eixo $(x,x)$. Aplicando estes valores na equação original, obtemos:
$f(\pi,\pi) = \sin \pi + \sin \pi + \sin 2\pi = 0 + 0 + 0 = 0 \text{ (ponto de cela)} \\\ \\
f \left(\dfrac \pi 3, \dfrac \pi 3\right) = 2 \sin \dfrac \pi 3 + \sin \left(2 \cdot \dfrac \pi 3\right) = \cancel 2 \dfrac{\sqrt 3}{\cancel 2} + \dfrac{\sqrt 3}2 = \dfrac {3\sqrt3}2 \text{ (máximo absoluto)}\\\ \\
f\left(\dfrac{5\pi}3, \dfrac{5\pi}3\right) = - \cancel 2 \dfrac{\sqrt 3}{\cancel 2} - \dfrac{\sqrt 3}2 = - \dfrac {3\sqrt3}2 \text{ (mínimo absoluto)}\ \blacksquare
$
### Exercício 31
Determine os valores máximo e mínimo **absolutos** para $f(x,y) = x^2 + y^2 + x^2y + 4$ no conjunto $D = \{(x,y) : |x| \le 1, |y| \le 1\}$.
#### Resolução
Podemos encontrar pontos críticos de uma função de dois termos à partir de suas derivadas parciais quando estas encontram-se igualadas à 0:
$f_y = 2y + x^2 = 0 \implies 2y = - x^2 \\ f_x = 2x + 2xy = 0 \implies 2x - x^3 = 0 \implies x(2 - x^2) = 0 \\ \implies x = \begin{cases} 0 \\ \cancel{\pm \sqrt 2}\ (-1 \le x \le 1) \end{cases} \\ \therefore 2y = -0^2 \implies y = 0$
A função portanto possui ponto crítico em $(0,0)$. Pela aplicação do Teste da Segunda Derivada podemos inferir se este se trata de um ponto máximo ou mínimo local:
$\text{Det}(0,0) = f_{xx}(0,0)f_{yy}(0,0) - [f_{xy}(0,0)]^2 = (2 + 2\cdot 0)\cdot 2 - (2 \cdot 0)^2 = 4$
Temos que $\text{Det}(0,0) > 0$ e $f_{xx}(0,0) > 0$, então $f(0,0)$ trata-se de um mínimo local de valor $f(0,0) = 4$. Passemos a avaliar a presença de máximos e mínimos nas extremidades da função. Dado o domínio, esta descreve uma superfície de área quadrada cujo centro encontra-se em $f(0,0)$, avaliemos cada lado deste quadrado:
- **L~1~:** caso em que $x = 1$ e $ -1 \le y \le 1$, $L_1(y) = y^2 + y + 5$.
- Intuitivamente conseguimos saber que obteremos o valor máximo para esta extremidade quando $y = 1$. Ou seja, $L_1(1) = 1 + 1 + 5 = 7$;
- o valor mínimo requer que realizemos mais alguns passos, a começar por encontrar sua derivada ($L'_1(y) = 2y + 1$) e localizar seu ponto crítico $\left(2y + 1 = 0 \implies y = -\frac 12 \right)$, para então aferí-lo: $L_1\left(- \frac 12\right) = 1 + \frac 14 - \frac 12 + 5 = \frac{23}4 = 5,75$.
- **L~2~:** caso em que $-1 \le x \le 1$ e $y = -1$, $L_2(x) = x^2 + 1 - x^2 + 4 = 5$ (constante).
- **L~3~:** caso em que $x = -1$ e $-1 \le y \le 1$, $L_3(y) =y^2 + y + 5$ (análogo à **L~1~**).
- **L~4~:** caso em que $-1 \le x \le 1$ e $y = 1$, $L_4(x) = 2x^2 + 5$.
- Maximo: $L_4(1) = 1 + 1 + 1 + 4 = 7$;
- Mínimo: $L_4'(x) = 4x = 0 \implies x = 0 \therefore L_4(0) = 5$.
Finalmente, concluímos que os valores máximo e mínimo para a função dada no domínio dado são, respectivamente, **7** e **4**. $\blacksquare$
[^1]: nUSP 12543033; Turma 04

View File

@ -1,89 +0,0 @@
# Derivadas direcionais e o vetor gradiente
## Derivadas direcionais
A **derivada direcionada** de $f$ em $(x_0,y_0)$ na direção do vetor unitário $\textbf u = \lang a,b \rang$ é
$$
D_\textbf uf(x_0,y_0) = \lim_{h \to 0} \dfrac{f(x_0 + ha, y_0 + hb) - f(x_0,y_0)}h
$$
Onde $x = x_0 + ha$ e $y = y_0 + hb$.
A seguinte imagem ilustra a representação espacial da equação:
<img src="file:///home/user/Public/USP/Sistemas%20de%20Informação/2º%20semestre/Cálculo%20II/Atividade%2010/Imagens/2021-11-23-12-42-31-image.png" title="" alt="" data-align="center">
Podemos reescrever este limite em termos das derivadas parciais de $x$ e $y$ e, pela Regra da Cadeia, das derivadas de $x$ e $y$ com relação à $h$:
$$
D_\textbf u f = \frac{\partial f}{\partial x} \frac{dx}{dh} +
\frac{\partial f}{\partial y} \frac{dy}{dh} = f_x(x,y)a + f_y(x,y)b
$$
Ainda, se o vetor unitário $\textbf u$[^1] faz um ângulo $\theta$ com o eixo $x$ positivo (como na figura anterior), então podemos escrever $\textbf u = \lang \cos \theta, \sin \theta \rang$ e a fórmula do Teorema anterior fica
$$
D_\textbf u f (x,y) = f_x(x,y)\cos \theta + f_y(x,y)\sin \theta
$$
## Vetor gradiente
Outra maneira de se escrever a função anterior é como o produto escalar de dois vetores:
$$
D_\textbf{u} f(x,y) = f_x(x,y)a + f_y(x,y)b =
\lang f_x(x,y), f_y(x,y) \rang \cdot \lang a,b \rang =\\\ \\
\lang f_x(x,y), f_y(x,y) \rang \cdot \textbf u
$$
Onde $\textbf u$ é o vetor unitário, ou **versor**. O primeiro vetor deste produto escalar ocorre em diversas situações e por isso recebe o nome especial de **vetor gradiente** de $f$. Este pode ser denotado por:
$$
\nabla f(x,y) = \lang f_x(x,y), f_y(x,y) \rang =
\frac{\partial f}{\partial x}\textbf i +
\frac{\partial f}{\partial y}\textbf j
$$
Ou seja,
$$
D_\textbf u f(x,y) = \nabla f(x,y) \cdot \textbf u
$$
## Maximizando a Derivada Direcional
Suponha $f$ uma função diferenciável de duas ou três variáveis. O valor máximo da derivada direcional $D_ \textbf u f(\textbf v)$ é $|\nabla f(\textbf v)|$. O que ocorre quando o vetor unitário $\textbf u$ tem a mesma direção do vetor gradiente $\nabla f(\textbf v)$.
A variação de direção entre dois vetores pode ser dada pelo cosseno de um dado ângulo $\theta$. Assim, o valor máximo de $\cos \theta$ é $1$ quando $\theta = 0$.
$$
D_\textbf u = \nabla f \cdot \textbf u =
|\nabla f||\textbf u| \cos \theta = |\nabla f| \cos \theta
$$
## Planos Tangente às Superfícies de Nível
Tal qual visto anteriormente, o plano tangente a uma superfície $S$ descrita por $f(x,y)$ em um ponto $P$ é descrito pela formula da sua **diferenciação total**:
$$
f'(x,y) = f_x(x,y)\ dx + f_y(x,y)\ dy
= \frac{\partial z}{\partial x}\ dx + \frac{\partial z}{\partial y}\ dy
$$
Podemos reescrever essa equação em termos de produto notável:
$$
f'(x,y) = f_x(x,y)\ dx + f_y(x,y)\ dy =
\lang f_x,f_y \rang \cdot \lang dx, dy \rang = \nabla f \cdot \textbf r'
$$
Onde $\textbf r'$ é a reta tangente à superfície e portanto paralela ao plano tangente. Tal qual ilustra a seguinte representação:
<img src="file:///home/user/Public/USP/Sistemas%20de%20Informação/2º%20semestre/Cálculo%20II/Atividade%2010/Imagens/2021-11-24-13-17-40-image.png" title="" alt="" data-align="center">
O que esta equação nos diz, portanto, é que o vetor gradiente é perpendicular ao vetor tangente para qualquer curva $C$ em $S$ que passe em $P(x_0,y_0)$.
> Não entendi o resto
[^1]: Para encontrar o vetor unitário $\textbf u$, ou versor, de um dado vetor $\textbf v$, aplique a fórmula: $\textbf u = \frac{\textbf v}{| \textbf v |}$

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 231 KiB

View File

@ -1,56 +0,0 @@
# Valores Máximo e Mínimo
Uma função de duas variáveis tem um **máximo local** em $(a, b)$ se $f (x, y) \le f (a, b)$ quando $(x, y)$ está próximo de $(a, b)$. Neste caso o número
$f (a, b)$ é denominado o **valor máximo local**. Enquanto, se $f (x, y) \ge f(a, b)$ quando $(x, y)$ está próximo $(a, b)$, $f$ tem um mínimo local em $(a, b)$ e $f (a, b)$ é denominado o **valor mínimo local**. Se estas inequações valem para todos os pontos $(x,y)$ no domínio de $f$, segue que este possui um máximo e mínimo **absolutos**.
<img src="file:///home/user/Public/USP/Sistemas%20de%20Informação/2º%20semestre/Cálculo%20II/Atividade%2010/Imagens/2021-11-24-18-50-14-image.png" title="" alt="" data-align="center">
Um ponto $(a, b)$ é chamado **ponto crítico** (ou ponto estacionário) de $f$ se $f_x(a, b) = 0$ e $f_y(a, b) = 0$, ou se uma das derivadas parciais não existir. O Teorema dispõe que se $f$ tem um máximo ou mínimo local em $(a, b)$, então $(a, b)$ é um ponto crítico de $f$. No entanto, como no cálculo variável único, nem todos os pontos críticos originam máximos ou mínimos. Em um ponto crítico, a função pode ter um máximo local ou um mínimo local, ou ainda nenhum dos dois.
**Exemplo:** Seja $f(x,y) = x^2 + y^2 - 2x - 6y + 14$. Então
$$
\begin{matrix} f_x(x,y) = 2x - 2 & & f_y(x,y) = 2y - 6 \end{matrix}
$$
Essas derivadas parciais são nulas quando $x = 1$ e $y = 3$, portanto, o único ponto crítico é $(1,3)$. Já que $(x - 1)^2 \ge 0$ e $(y - 3)^2 \ge 0$, temos $f(x, y) = 4$ para todos os valores de $x$ e $y$. Logo, $f(1, 3) = 4$ é um mínimo local e, de fato, é o mínimo absoluto de $f$.
<img src="file:///home/user/Public/USP/Sistemas%20de%20Informação/2º%20semestre/Cálculo%20II/Atividade%2010/Imagens/2021-11-24-21-33-12-image.png" title="" alt="" data-align="center">
## Teste da segunda derivada
Suponha que as segundas derivadas parciais de $f$ sejam contínuas em uma bola aberta com centro em $(a, b)$, e suponha que $f_x(a, b) = 0$ e $f_y(a, b) = 0$ — ou seja, $(a, b)$ é um ponto crítico de $f$. Seja
$$
D(a, b) = f_{xx}(a, b) f_{yy}(a, b) - [f_{xy}(a, b)]^2
$$
- Se $D > 0$ **e** $f_{xx}(a, b) > 0$, então $f(a,b)$ é um **mínimo local**.
- Se $D > 0$ **mas** $f_{xx}(a,b) < 0$, então $f (a, b)$ é um **máximo local**.
- Se $D < 0$, então $f(a,b)$ **não é mínimo local nem máximo local** (ponto de sela).
- Entretanto, Se $D = 0$, não há nenhuma informação: $f$ pode ter um máximo local ou mínimo local em $(a,b)$, ou $(a, b)$ pode ser um ponto de sela.
## Valores máximo e mínimo absolutos
### Teorema do Valor Extremo para as Funções de Duas Variáveis
Se $f$ é contínua em um conjunto fechado[^1] e limitado[^2] $D$ em $\R^2$, então $f$ assume um valor máximo absoluto $f(x_1,y_1)$ e um valor mínimo absoluto $f(x_2,y_2)$ em alguns pontos $(x_1, y_1)$ e $(x_2,y_2)$ de $D$.
Para determinar os valores máximo e mínimo absolutos de uma função contínua
f em um conjunto fechado e limitado $D$:
1. Determine os valores de f nos pontos críticos de $f$ em $D$.
2. Determine os valores extremos de $f$ na fronteira de $D$.
3. O maior dos valores dos passos 1 e 2 é o **valor máximo absoluto**; o menor desses valores é o valor mínimo absoluto.
[^1]:
Um conjunto fechado é aquele que contém *todos* os seus pontos da fronteira.
<img src="file:///home/user/Public/USP/Sistemas%20de%20Informação/2º%20semestre/Cálculo%20II/Atividade%2010/Imagens/2021-11-25-11-17-12-image.png" title="" alt="" data-align="center">
[^2]: Um **conjunto limitado** é aquele finito em extensão.

View File

@ -1,124 +0,0 @@
# Atividade 2
Resolução dos exercícios obrigatórios, feita por Guilherme de Abreu Barreto[^1].
## Capítulo 5.3
### Exercício 45
O que está errado com a seguinte equação?
$$
\displaystyle \int^1_{-2} x^{-4}\ dx = \dfrac{x^{-3}}{-3} \Bigg ]^1_{-2} = - \dfrac 38
$$
#### Resolução
A equação em questão faz uso do Teorema Fundamental do Cálculo (TFC) para calcular o valor da integral da função $f(x) = x^{-4}$ no intervalo $[1, -2]$. Entretanto, o TFC, conforme sua definição, aplica-se somente às integrais de **funções contínuas**. Este não é o caso aqui, pois nota-se que $f(x) = x^{-4}$ apresenta descontinuidade no ponto $x = 0$.
### Exercício 65
A função de Fresnel $S$ foi definida no Exemplo 3, e seus gráficos estão nas Figuras 7 e 8.
<img src="file:///home/user/Documents/Drives/USP/Introdução%20a%20Ciência%20da%20Computação/Imagens/2021-09-06-16-23-50-image.png" title="" alt="" data-align="center">
**(a)** Em que valores de x essa função tem valores máximos locais?
**(b)** Em que intervalos a função é côncava para cima?
**(c)** Use um gráfico para resolver a seguinte equação, com precisão de duas casas decimais:
$$
\displaystyle \int^x_0 \sin \left(\dfrac{\pi t^2}2\right)\ dt = \dfrac 15
$$
#### Resolução
**(a)** Conforme se observa pela figura 7, a função de Fresnel apresenta valores máximos e mínimos para os valores de $x$ aqueles em que sua função derivada $S'(x) = \sin (\pi x^2/2)$ tem valor 0. O que ocorre sempre que o valor de $x$ é diferente de 0 e múltiplo de √2:
$$
S'(x) = \sin \left(\dfrac{\pi (n \sqrt 2)^2}2\right) = 0 \implies
\begin{cases}
\text{Máximo local, se \textit k for} \begin{cases}
\text{ímpar e positivo} \\
\text{par e negativo}
\end{cases} \\\ \\
\text{Mínimo local, se k for} \begin{cases}
\text{par e positivo} \\
\text{ímpar e negativo}
\end{cases} \\
\end{cases}
$$
Onde $n$ é um número inteiro e positivo. Ou seja, para $x > 0$ tem-se um máximo local quando:
$$
\dfrac{\pi x^2}2 = (2n + 1)\pi \implies x = \sqrt{2(2n + 1)}
$$
Enquanto, para $x < 0$, isso ocorre quando:
$$
\dfrac{\pi x^2}2 = 2n\pi \implies x = -2\sqrt x
$$
**(b)** Conforme as propriedades das funções derivadas, enquanto a função derivada descreve a localização dos pontos máximos e mínimos da função da qual foi derivada, por vez, a função derivada desta primeira descreve a concavidade desta última: para cima quando $S''(x) > 0$ e para baixo quando $S''(x) < 0$. Onde $S'''(x)$ é:
$$
S'(x) = \sin \left(\dfrac{\pi x^2}2\right) \implies S''(x) = \cos \left(\dfrac{\pi x^2}2\right) \cdot \pi x
$$
Logo, para $x > 0$:
$$
\cos \left(\dfrac{\pi x^2}2\right) \cdot \pi x > 0 \implies \cos \left(\dfrac{\pi x^2}2\right) > 0 \implies 0 < \dfrac{\pi x^2}2 < \dfrac \pi 2
$$
Generalizando:
$$
\left(2n - \dfrac 32 \right)\pi < \dfrac{\pi x^2}2 < \left(2n - \dfrac 12 \right)\pi \\\ \\
\sqrt{4n - 3} < x < \sqrt{4n - 1}
$$
Para qualquer número inteiro e positivo $n$.
De maneira análoga, para $x < 0$:
$$
\cos \left(\dfrac{\pi x^2}2\right) \cdot \pi x > 0 \implies \cos \left(\dfrac{\pi x^2}2\right) < 0 \implies \dfrac \pi 2 < \dfrac{\pi x^2}2 < \dfrac{3\pi} 2
$$
Generalizando:
$$
\left(2n - \dfrac 12 \right)\pi < \dfrac{\pi x^2}2 < \left(2n - \dfrac 32 \right)\pi\\\ \\
\sqrt{4n - 1} < |x| < \sqrt{4n - 3}
$$
**(c)** O gráfico à seguir foi gerado aplicando a fórmula da integral em uma calculadora gráfica e experimentando-se valores para x menores que √2 até ser encontrado o valor aquele que corresponde à área descrita pelo enunciado em **x = 0.74**.
<img src="file:///home/user/Public/USP/Sistemas%20de%20Informação/2º%20semestre/Cálculo%20II/Atividade%202/Imagens/2021-09-06-22-15-00-image.png" title="" alt="" data-align="center">
## Capítulo 5.4
### Exercício 45
Calcule a integral de $\int^2_{-1} (x - 2 |x|)\ dx$
### Resolução
$\text{(I) } \int^2_{-1} (x - 2 |x|)\ dx = \int_{-1}^0 (x + 2x)\ dx + \int_0^2 (x - 2x)\ dx =\\\ \\ 3 \int_{-1}^0 x\ dx - \int_0^2 x\ dx = 3[F(0) - F(-1)] - [F(2) - F(0)] \\\ \\
\text{(II) } f(x) = x \implies F(x) = \dfrac{x^2}2 \\\ \\
\text{(I) e (II) } 3 \cdot - \dfrac 12 - \dfrac 42 = - \dfrac 72
$
### Exercício 67
O custo marginal de fabricação de x metros de um certo tecido é C'(x) = 3 - 0,01x + 0,000006x^2^ US$/m (em dólares por metro). Ache o aumento do custo (A) se o nível de produção for elevado de 2 000 para 4 000 metros.
#### Resolução
$ C'(x) = 3 - 10^{-2}x + 6 \cdot 10^{-6}x \implies C(x) = 3x - \dfrac{10^{-2}}2x^2 + 2 \cdot 10^{-6}x^3\\\ \\A = \displaystyle \int_{2 \cdot 10^3}^{4 \cdot 10^3} C'(x) dx = C(4 \cdot 10^3) - C(2 \cdot 10^3) = \\\ \\4 \cdot 10^3 \left[3 - \dfrac{10^{-2} \cdot 4 \cdot 10^3}2 + 2 \cdot 10^{-6} \cdot 16 \cdot 10^6\right] - 2 \cdot 10^3 (3 - 10 + 8)\\\ \\ = \bm{58 \cdot 10^3 \textbf{ dollares/m}}$
[^1]: nUSP 12543033

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

View File

@ -1,39 +0,0 @@
# Integrais Indefinidas e o Teorema da Variação Total
A notação $\int f(x)\ dx$ é tradicionalmente usada para denotar a primitiva de $f$ e é chamada **integral indefinida**.
$$
\int f(x)\ dx = F(x) \implies F'(x) = f(x)
$$
Por exemplo,
$$
\int x^2\ dx = \dfrac{x^3}3 + C \implies \frac d{dx} \left( \frac{x^3}3 + C\right) = x^2
$$
**Obs.:** A integral **indefinida**, de forma $\int f(x)\ dx$, representa toda uma *família* de funções (uma primitiva para cada valor constante $C$), enquanto uma integral **definida**, de forma $\int_a^b f(x)\ dx$ representa um *número*. A relação entre estas é dada por:
$$
\int f(x)\ dx \Big |^b_a = \int_a^b f(x)\ dx
$$
## Variação total
Sabemos que $F'(x)$ representa a taxa de variação de $y = F(x)$. Portanto, a integral
$$
\int_a^b F'(x)\ dx = F(b) - F(a)
$$
Representa a taxa de variação total. Esse princípio pode ser aplicado para todas as taxas de variação nas ciências naturais e sociais.
### Exemplo
Se $V(t)$ for o volume de água em um reservatório no instante $t$, então sua derivada $V'(t)$ é a taxa segundo a qual a água flui para dentro do reservatório no instante $t$. Logo,
$$
\int_a^b V'(x)\ dx = V(b) - V(a)
$$
é a variação na quantidade de água no reservatório entre os instantes de tempo $t_1$ e $t_2$ .

View File

@ -1,53 +0,0 @@
# O Teorema Fundamental do Cálculo
## Parte 1
Se a função $f$ for contínua em $[a, b]$, então a função
$$
g(x) = \int^x_af(t)\ dt \text{ (na qual }a \le x \le b)
$$
é contínua em $[a,b]$, derivável em em $(a, b)$ e $g'(x) = f(x)$. Grosseiramente falando: *se primeiro integramos $f$ e então derivamos o resultado, retornamos à função original $f$.*
### Exemplos
**1.** Encontre a derivada da função $g(x) = \int_0^x \sqrt{1 + t^2}\ dt$
---
Uma vez que no período descrito $f(t) = \sqrt{1 + t^2}$ é contínua, a Parte 1 do Teorema Fundamental do Cálculo fornece que
$$
g'(x) = \sqrt{1 + x^2}
$$
---
**2.** Derive:
$$
\frac d{dx} \int_1^{x^4} \sec t\ dt
$$
---
$\displaystyle \frac d{dx} \underbrace{\int_1^{x^4} \sec t\ dt}_{u\ =\ x^4} = \frac d{du} \left[\int^u_1 \sec t\ dt\right] \frac{du}{dx} = \sec x^4 \cdot 4x^3$
> **Obs:** A aplicação deste teorema exige que a incógnita esteja no limite superior. Inverta a integral se necessário for.
## Parte 2
Se a função $f$ for contínua em $[a, b]$, então
$$
\int^b_a f(x)\ dx = F(b) - F(a)
$$
onde $F$ é qualquer primitiva de $f$, isto é, uma função tal que $F' = f$.
Frequentemente utiliza-se a seguinte notação equivalente:
$$
F(b) - F(a) = F(x) |^b_a
$$

View File

@ -1,17 +0,0 @@
# A Regra da Substituição
## Em integrais indefinidas
Se $u = g(x)$ for uma função derivável cuja imagem é um intervalo $I$ e $f$ for contínua em $I$ , então
$$
\int f(g(x))\ g'(x)\ dx = \int f(u)\ du = F(g(x)) + C
$$
## Em integrais definidas
Se $g'$ for contínua em $[a, b]$ e $f$ for contínua na imagem de $u = g(x)$, então
$$
\int^b_a f(g(x))\ g'(x)\ dx = \int^{g(b)}_{g(a)}f(u)\ du = F(u)\Big |^{g(b)}_{g(a)}
$$

View File

@ -1,102 +0,0 @@
# Atividade 3
Resolução dos exercícios obrigatórios, feita por Guilherme de Abreu Barreto[^1].
## Capítulo 5.5
### Exercício 73
Avalie a integral definida:
$$
\int^1_0 \dfrac 1{(1 + \sqrt x)^4}\ dx
$$
#### Resolução
$
\displaystyle \int^1_0 \dfrac 1{(1 + \sqrt x)^4}\ dx \begin{cases}
u = \sqrt x \\
du = \dfrac{x^{-\frac 12}}{2}\ dx = \dfrac{dx}{2\sqrt x} = \dfrac{dx}{2u} \implies 2u\ du = dx
\end{cases}\\\ \\
2 \int^{\sqrt 1 = 1}_{\sqrt 0 = 0} \dfrac{u}{(1 + u)^4}\ du
\begin{cases}
v = 1 + u \implies u = v - 1 \\
dv = du
\end{cases}\\\ \\
2 \int^{1 + 1 = 2}_{0 + 1 = 1} \dfrac{v - 1}{v^4}\ dv =
2 \left[\int^2_1 \dfrac v{v^4}\ dv - \int^2_1 \dfrac 1{v^4}\ dv \right] = 2 \left[ - \dfrac{v^{-2}}2 \Bigg |^2_1 + \dfrac{v^{-3}}3 \Bigg |^2_1 \right] = \\\ \\
2 \left[\dfrac 1{3 \cdot 8} - \dfrac 13 - \dfrac 1{2 \cdot 4} + \dfrac 12\right] = \dfrac 16
$
### Exercício 83
A respiração é cíclica e o ciclo completo respiratório desde o início da inalação até o fim da expiração demora cerca de $5\ s$. A taxa máxima de fluxo de ar nos pulmões é de cerca de $0,5\ L/s$. Isso explica, em partes, porque a função $f(x) = \frac 12 \sin \left(\frac{2\pi t}5\right)$ tem sido frequentemente utilizada para modelar a taxa de fluxo de ar nos pulmões. Use esse modelo para encontrar o volume da ar inalado no instante $t$.
#### Resolução
O volume de ar inalado desde o início do ciclo respiratório (0) até o instante t pode ser aferido pela integral da taxa de fluxo de ar, aferida entre estes dois momentos:
$\displaystyle \int^t_0 \dfrac 12 \sin \left(\dfrac{2\pi x}5\right)\ dx = \dfrac 12 \int^t_0 \sin \left(\dfrac{2\pi x}5\right)\ dx
\begin{cases}
u = \dfrac{2\pi x}5 \\\ \\
du = \dfrac{2 \pi}5\ dx \implies dx = \dfrac 5{2\pi}\ du
\end{cases}\\\ \\
\dfrac 12 \cdot \dfrac 5{2\pi}\int^{\frac{2\pi t}5}_0 \sin u\ du = \dfrac 5{4\pi} \cdot -\cos u \Bigg |^{\frac{2\pi t}5}_0 = \dfrac 5{4\pi} \left[1 - \cos\left(\dfrac{2\pi t}5\right)\right]
$
## Capítulo 7.1
### Exercício 51
Use integração por partes para demonstrar a seguinte redução:
$$
\int (\ln x)^n\ dx = x(\ln x)^n - n\int (\ln x)^{n - 1}\ dx
$$
#### Resolução
Conforme a definição, a fórmula da integração por partes para integrais indefinidas pode ser expressa nos seguintes termos:
$$
\int u \ dv = uv - \int v\ du
$$
Assim o sendo,
$\displaystyle \int (\ln x)^n\ dx
\begin{cases}
u = (\ln x)^n \implies du = n (\ln x)^{n - 1}\ dx\\
dv = dx \implies v = x
\end{cases}\\\ \\
\displaystyle \int (\ln x)^n\ dx = x(\ln x)^n - \int n(\ln x)^{n - 1}\ dx = \bm{x(\ln x)^n - n\int (\ln x)^{n - 1}\ dx }
$
### Exercício 67
Uma partícula que se move ao longo de uma reta tem velocidade igual a $v(t) = t^2e^{-t}$ metros por segundo após t segundos. Qual a distância que essa partícula percorrerá durante os primeiros t segundos?
#### Resolução
A função velocidade trata-se da função derivada da função espaço. Assim o sendo, para obtermos a variação $\Delta S$ entre a posição inicial $S(0)$ e final $S(t)$, temos:
$S(t) = \displaystyle \int \dfrac{t^2}{e^t}\ dt
\begin{cases}
u = t^2 \implies du = 2t\ dt\\
dv = \dfrac{dt}{e^t} \implies v = \int e^{-t}dt
\begin{cases}
w = -t\\ dw = -dt
\end{cases}
\therefore v = - \int e^w\ dw = -e^{-t}
\end{cases}\\\ \\
S(t) = - \dfrac{t^2}{e^t} + 2 \int \dfrac t{e^t}\ dt
\begin{cases}
u = t \implies du = dt \\
dv = \dfrac{dt}{e^t} \implies v = -e^{-t}
\end{cases}\\\ \\
S(t) = - \dfrac{t^2}{e^t} + 2 \left(- \dfrac t{e^t} + \int e^{-t}dt\right) = \dfrac{t^2}{e^t} + 2 \left(-\dfrac{t}{e^t} + \dfrac 1{e^t}\right) + \underbrace C_{=\ S(0)} \\\ \\
\implies \Delta S = \dfrac{-t^2 - 2t + 2}{e^t}
$
[^1]: nUSP 12543033

View File

@ -1,28 +0,0 @@
# Integração por partes
Cada regra de derivação tem outra correspondente de integração. Por exemplo,
- a **Regra de Substituição** para a integração corresponde à **Regra da Cadeia** para a derivação e
- a **Regra do Produto** para a derivação é chamada **Integração por Partes** para a integração.
$\displaystyle \frac d{dx}[f(x)g(x)] = f(x)g'(x) + g(x)f'(x)\\\ \\ \implies f(x)g(x) = \int[f(x)g'(x) + g(x)f'(x)] \\\ \\ \implies f(x)g(x) = \int f(x)g'(x) + \int g(x)f'(x)$
Finalmente podemos rearranjar essa equação como
$$
\int f(x)g'(x) = f(x)g(x) - \int g(x)f'(x)
$$
Formulação esta conhecida como **fórmula da integração por partes**. Sejam $u = f(x)$ e $v = g(x)$. Então as diferenciais são $du = f'(x)\ dx$ e
$dv = g'(x)\ dx$ e, assim, pela Regra da Substituição, a fórmula para a integração por partes torna-se
$$
\int u\ dv = uv - \int v\ du
$$
Para integrais definidas, esta fórmula fica:
$$
\int_a^b u\ dv = uv\Big |^b_a - \int^b_av\ du
$$

View File

@ -1,63 +0,0 @@
# Aplicações da Integração
## Áreas entre curvas
<img src="file:///home/user/Public/USP/Sistemas%20de%20Informação/2º%20semestre/Cálculo%20II/Atividade%204/Imagens/2021-10-06-16-47-15-image.png" title="" alt="" data-align="center">
A área $A$ da região limitada pelas curvas $y = f (x)$, $y = g(x)$ e pelas retas $x = a$, $x = b$, onde $f$ e $g$ são contínuas e $f(x) \ge g(x)$ para todo x em $[a, b]$, é
$$
A = \int^b_a [f(x) - g(x)]\ dx
$$
## Valor médio de uma função
Para uma dada função $f$, contínua no intervalo $[a,b]$, por exemplo
<img src="file:///home/user/Public/USP/Sistemas%20de%20Informação/2º%20semestre/Cálculo%20II/Atividade%204/Imagens/2021-10-06-16-52-39-image.png" title="" alt="" data-align="center">
Esta assume um valor médio $f_{med}$ o qual pode ser descrito por
$$
f_{med} = \frac 1{b - a} \int^b_a f(x)\ dx
$$
## Ponto médio de uma área descrita por uma função
Sendo $\overline x$ e $\overline y$ os valores médios de $x$ e $y$ que apontam, em suas respectivas coordenadas, para para a localização do centroide de uma área, tem-se
$$
\overline x = \frac 1A \int^b_a x f(x)\ dx = \frac{\int^b_a x f(x)\ dx}{\int^b_a f(x)\ dx}
$$
$$
\overline y = \dfrac 1{2A} \int^b_a [f(x)]^2\ dx = \frac{\int^b_a [f(x)]^2\ dx}{2\int^b_a f(x)\ dx}
$$
<img src="file:///home/user/Public/USP/Sistemas%20de%20Informação/2º%20semestre/Cálculo%20II/Atividade%204/Imagens/2021-10-06-20-40-00-image.png" title="" alt="" data-align="center">
> Exemplo de centroide aferido pelo método.
## Densidade de probabilidade
Em um gráfico de densidade de probabilidade, como o abaixo,
<img src="file:///home/user/Public/USP/Sistemas%20de%20Informação/2º%20semestre/Cálculo%20II/Atividade%204/Imagens/2021-10-06-19-21-18-image.png" title="" alt="" data-align="center">
É possível aferir a probabilidade de uma variável qualquer encontrar-se entre determinados valores calculando a área sob a curva no período considerado. Como as probabilidades são medidas em uma escala de 0 até 1, segue que
$$
\int^\infty_{-\infty} f(x)\ dx = 1
$$
Esta é a condição necessária para que a função seja apta a ser uma de densidade de probabilidade.
### Valor médio da densidade de probabilidade
<img src="file:///home/user/Public/USP/Sistemas%20de%20Informação/2º%20semestre/Cálculo%20II/Atividade%204/Imagens/2021-10-06-20-05-51-image.png" title="" alt="" data-align="center">
Considerando $\mu$ o valor médio de uma densidade de probabilidade, tem-se
$$
\mu = \int^\infty_{-\infty} x f(x)\ dx
$$

View File

@ -1,256 +0,0 @@
# Atividade 5
Resolução dos exercícios obrigatórios, feita por Guilherme de Abreu Barreto[^1].
## Capítulo 7.8
### Exercício 53
Use o Teorema da Comparação para determinar se a integral é convergente ou divergente.
$$
\int^1_0 \dfrac{\sec^2 x}{x\sqrt x}\ dx
$$
#### Resolução
A integral acima é imprópria e tende ao infinito para x = 0, logo, equivale à
$$
\lim_{t \to 0^+}\ \int^1_t \dfrac{\sec^2 x}{x\sqrt x}\ dx
$$
Podemos atestar que a seguinte declaração é verdadeira:
$$
\lim_{t \to 0^+}\ \int^1_t \dfrac{\sec^2 x}{x\sqrt x}\ dx \ge \lim_{t \to 0^+}\ \int^1_t \dfrac{1}{x\sqrt x}\ dx
$$
Uma secante sempre tem valores, menores ou iguais a -1 ou maiores ou iguais a +1. Uma secante elevada ao quadrado, entretanto, tem valor sempre maior ou igual a 1. Logo, se a expressão à direita da desigualdade divergir, a expressão à esquerda, de maior valor, também divergirá. Isso segundo o Teorema da Comparação. Logo,
$$
\displaystyle \lim_{t \to 0^+}\ \int^1_t \dfrac{1}{x\sqrt x}\ dx = \lim_{t \to 0^+} \dfrac{2}{\sqrt x} \Big |^1_t \text{(diverge)}
$$
Logo, dado o Teorema da Comparação, $\lim_{t \to 0+}\ \int1_t \frac{\sec^2 x}{x\sqrt x}\ dx$ também diverge. $\blacksquare$
#### Exercício 65
Encontre a velocidade de escape $v_0$ que é necessária para lançar um foguete de massa $m$ para fora do campo gravitacional de um planeta com massa $M$ e raio $R$. Use a Lei da Gravitação de Newton e o fato de que a energia cinética inicial de $\frac 12 mv^2_0$ supre o trabalho necessário.
#### Resolução
Admitindo que o lançamento se dá na superfície do planeta $s(0) = R$, para escapar da atração gravitacional, o foguete necessita produzir uma força $F$ no mínimo equivalente, mas de sentido oposto, a força de atração gravitacional $F_g$:
$$
F = - F_g \implies \cancel ma(t) = - \dfrac{GM\cancel m}{[s(t)]^2}
$$
Para encontrar o valor destas funções com relação a v(t), multiplicaremos ambos membros por v(t) e realizaremos a integração. Lembrando que $s'(t) = v(t)$ e
$s''(t) = v'(t) = a(t)$:
$$
\int a(t)v(t)\ dt = - GM \int \dfrac {v(t)}{[s(t)]^2}\ dt
$$
Realizando operações de substituição onde $v = v(t)$, $dv = a(t)\ dt$, e $w = s(t)$, $dw = v(t)\ dt$, tem-se:
$$
\int v\ dv = - GM \int w^{-2}\ dw \implies \dfrac{[v(t)]^2}{2} + C_1= \dfrac{GM}{s(t)} + C_2
\implies\dfrac{[v(t)]^2}{2} = \dfrac{GM}{s(t)} + C
$$
Onde $C$ é a diferença ($C_2 - C_1$) entre as constantes de integração. Ora, mas o que seriam estas constantes de integração? Estas são os valores que suas respectivas funções assumem inicialmente, para $t = 0$:
$$
C = \dfrac{[v(0)]^2}2 - \dfrac{GM}{s(0)} = \dfrac{v_0^2}2 - \dfrac{GM}{R}
$$
Atente para o sinal, congruente com a orientação das forças. Também note que encontramos a variável cujo valor buscamos aferir.
$$
\dfrac{[v(t)]^2}{2} = \dfrac{GM}{s(t)} + \dfrac{v_0^2}2 - \dfrac{GM}{R}
$$
Analizando a equação acima, temos que para o foguete escapar da atração da força gravitacional, $\frac{[v(t)]^2}{2}$ necessita ser maior ou igual a zero. Por outro lado$\frac{GM}{s(t)}$ é sempre maior que zero, mas tende a zero em função do tempo. Logo, recai sobre $\frac{v_0^2}2 - \frac{GM}{R}$ também ser maior ou igual a zero para que a condição de escape seja satisfeita. Logo:
$$
\frac{v_0^2}2 - \frac{GM}{R} \ge 0 \implies v_0 \ge \sqrt{\dfrac{2GM}R}\ \blacksquare
$$
## Capítulo 6.1
### Exercício 31
Calcule a integral e interprete-a como a área de uma região. Esboce a região.
$$
\int^{\frac \pi 2}_0 |\sin x - \cos 2x|\ dx
$$
#### Resolução
O resultado desta integral, por se tratar de uma função modular, será equivalente a soma dos módulos das áreas descritas pela função quando esta tem valores positivos e negativos. Notamos que esta possui valor negativo em seu início:
$
\sin 0 - \cos 0 = -1
$
Positivo ao seu final:
$\sin \frac \pi 2 + \cos \pi = 2$
E nulo em:
$\sin x - \cos 2x = 0 \implies \sin x = \cos 2x \implies \sin x = \sin \left(\frac \pi2 - 2x\right)\\ \implies x = \frac \pi2 - 2x \implies x = \frac \pi 6$
Logo,
$\displaystyle \int^{\frac \pi 2}_0 |\sin x - \cos 2x|\ dx = - \int^{\frac \pi 6}_0 \sin x - \cos 2x\ dx + \int^{\frac \pi 2}_{\frac \pi6} \sin x - \cos 2x\ dx = \int^{\frac \pi 6}_0 \cos 2x - \sin x\ dx + \int^{\frac \pi 2}_{\frac \pi6} \sin x - \cos 2x\ dx = \int^{\frac \pi 2}_{\frac \pi6} \sin x\ dx - \int^{\frac \pi 6}_0 \sin x\ dx + \int^{\frac \pi 6}_0 \cos 2x\ dx - \int^{\frac \pi 2}_{\frac \pi6} \underbrace{\cos 2x\ dx}_{u = 2x,\ du = 2dx} = \cos x \Big |^\frac \pi2_\frac\pi 6 - \cos x\Big |^\frac \pi6_0 + \dfrac 12\left(\sin x \Big |^\frac \pi3_0 - \sin x\Big |^\pi_\frac \pi 3\right) = \dfrac{3\sqrt 3}2 - 1\ \blacksquare$
Esse resultado pode ser expresso graficamente como:
<img src="file:///home/user/Public/USP/Sistemas%20de%20Informação/2º%20semestre/Cálculo%20II/Atividade%204/Imagens/2021-09-25-16-49-50-image.png" title="" alt="" data-align="center">
### Exercício 45
É mostrada a seção transversal da asa de um avião. As medidas em centímetros da espessura da asa, em intervalos de 20 centímetros, são 5.8, 20.3, 26.7, 29.0, 27.6, 27.3, 23.8, 20.5, 15.1, 8.7, e 2.8. Utilize a Regra do Ponto Médio para estimar a área da secção transversal da asa.
<img src="file:///home/user/Public/USP/Sistemas%20de%20Informação/2º%20semestre/Cálculo%20II/Atividade%204/Imagens/2021-09-25-16-52-18-image.png" title="" alt="" data-align="center">
#### Resolução
$\displaystyle \int^{200}_0 f(x)\ dx \approx \sum^{10}_{i = 1}\dfrac{x_{i - 1} + x_i}2\Delta x = 20(13,05 + 23,5 + 27,85 + 28,3 + 27,45 + 25,55 + 22,15 + 17,8 + 11,9 + 5,75) = \text{4 066 cm²}\ \blacksquare$
## Capítulo 6.5
### Exercício 17
Em uma certa cidade a temperatura (em ºC) $t$ horas depois das 9 h foi aproximada pela função
$$
T(t) = 20 + 6 \sin \left(\dfrac{t\pi}{12}\right)
$$
Calcule a temperatura média durante o período entre 9h e 21 h.
#### Resolução
$\displaystyle\overline T = \dfrac1{12 - 0} \int^{12}_0 20 + 6 \sin \left(\dfrac{t\pi}{12}\right)\ dt \implies
12\ \overline T = 20 \cdot 12 + 6 \int^{12}_0 \underbrace{\sin \left(\dfrac{t\pi}{12}\right)\ dt}_{u = \frac{t\pi}{12},\ du = \frac{\pi}{12}dt} \implies
\cancel{12}\ \overline T = 20 \cdot \cancel{12} + 6 \cdot \dfrac{\cancel{12}}\pi \cdot -\cos u \Big|^\pi_0 = 20 + \dfrac6\pi (- \cos \pi + \cos 0) = 20 + \dfrac{12}\pi \text{ °C } \blacksquare
$
### Exercício 21
No Exemplo 1 na Seção 3.8, modelamos a população mundial na segunda metade do século 20 pela equação $P(t) = 2 560e^{0,017185t}$. Use essa equação para estimar a população mundial média durante esse período de tempo.
#### Resolução
$c = 0,017185 = \dfrac{3437}{2 \cdot 10^5}\\\ \\
\displaystyle \overline P = \dfrac{2560}{50} \int^{50}_0 e^{ct}dt\ \}\ u = bt\implies du = cdu \\\ \\
\overline P = \dfrac{256}{5c}e^u\Big|^{50c}_0 = \dfrac{4 \cdot 10^4 \cdot 256}{3437}(e^{\frac{3437}{4 \cdot 10^3}} - 1) \approx \dfrac{4 \cdot 10^4 \cdot 256}{3437}(e^{\frac78} - 1) \approx 4167,08\ mi \approx 4\ bi\ \blacksquare
$
## Capítulo 8.3
### Exercício 27
Esboce a região delimitada pelas curvas e visualmente estime a localização do centroide. Em seguida, calcule as coordenadas exatas do centroide.
$$
y = e^x,\ y = 0,\ x = 0,\ x = 1
$$
#### Resolução
A localização do centroide de uma área plana é dado pelo ponto $(\overline x, \overline y)$ onde:
$$
\overline x = \dfrac{\int^1_0xf(x)\ dx}{\int^1_0f(x)\ dx} \text{, e }
\overline y = \dfrac{\int^1_0[f(x)]^2\ dx}{2\int^1_0f(x)\ dx}
$$
Logo,
$\overline x = \dfrac{\int^1_0xe^x\ dx}{\int^1_0e^x\ dx} =
\dfrac{xe^x\Big |^1_0 - \int^1_0e^x\ dx}{e - 1} = \dfrac 1{e - 1}\\\ \\
\overline y = \dfrac{\int^1_0e^{2x}\ dx}{2\int^1_0e^x\ dx} = \dfrac{\int^2_0e^u\ du}{4 (e - 1)} = \dfrac{e + 1}4\ \blacksquare
$
<img title="" src="file:///home/user/Public/USP/Sistemas%20de%20Informação/2º%20semestre/Cálculo%20II/Atividade%204/Imagens/2021-09-27-14-29-57-image.png" alt="" data-align="center" width="248">
> Gráfico da função com centroide calculado (ponto A, mais acima) e estimado (ponto B, mais abaixo)
### Exercício 41
Encontre o centroide da região mostrada, não por integração, mas por localização dos centroides dos retângulos e triângulos e usando a aditividade dos momentos.
<img src="file:///home/user/Public/USP/Sistemas%20de%20Informação/2º%20semestre/Cálculo%20II/Atividade%204/Imagens/2021-09-27-15-00-05-image.png" title="" alt="" data-align="center">
#### Resolução
O contorno da região é simétrico com relação ao eixo $y$, logo, $\overline x = 0$. Agora, o centroide do triângulo encontra-se no encontro de suas medianas ($h/3 = 2/3$) e aquele do retângulo encontra-se em seu centro ($h/2 = -1/2$). O centroide da região no encontrará-se no ponto médio entre estes pontos:
$\overline y = \dfrac 23 - \dfrac 12\left[\dfrac 23 - \left( - \dfrac 12 \right)\right] = \dfrac 1{12}\ \blacksquare$
## Capítulo 8.5
### Exercício 9
Mostre que a mediana do tempo de espera para uma chamada para a companhia descrita no Exemplo 4 é de cerca de 3,5 minutos.
#### Resolução
$\displaystyle \int^\infty_m f(t)\ dt = \dfrac 12 \implies \lim_{x \to \infty} \int^x_m\underbrace{\dfrac{e^{-\frac t5}}5\ dt}_{u\ = - \frac t5;\ du = - \frac{dt}5} \implies \lim_{x \to \infty} \dfrac 15 \cdot -5 \cdot e^u \Big |^{- \frac x5}_{- \frac m5} = \dfrac 12 \implies \lim_{x \to \infty} \left(\dfrac 1{e^{\frac m5}} - \cancel{\dfrac 1{e^{\frac x5}}}\right) = \dfrac 12 \implies e^{m/5} = 2 \implies \dfrac m5 \cancel{\ln e} = \ln 2 \implies m = 5\ln 2 \approx 3,5\ \blacksquare$
### Exercício 19
O átomo de hidrogênio é composto por um próton no núcleo e um elétron, que se move ao redor do núcleo. Na teoria quântica de estrutura atômica supõe-se que o elétron não se mova em uma órbita bem definida. Ao contrário, ele ocupa um estado conhecido como *orbital*, que pode ser pensado como uma “nuvem” de carga negativa rodeando o núcleo. No estado de energia mais baixa, chamado *estado fundamental*, ou *orbital 1s*, é suposto que o formato do orbital seja uma esfera com centro no núcleo. Essa esfera é descrita em termos da função densidade de probabilidade
$$
p(r) = \dfrac 4{a^3_0}r^2e^{-\frac{2r}{a_o}},\ r \ge 0
$$
onde $a_0$ é o *raio de Bohr* ($a_0 \approx 559 \cdot 10^{-13}m$). A integral
$$
P(r) = \int^r_0 \dfrac 4{a^3_0}s^2e^{-\frac{2s}{a_o}}\ ds
$$
dá a probabilidade de o elétron ser encontrado dentro da esfera de raio *r* metros centrada no núcleo.
#### Resolução
**a)** Verifique se $p(r)$ é uma função densidade de probabilidade.
A função $p(r)$ é uma função densidade de probabilidade se, e somente se, $\lim_{r \to \infty}\int_0^r p(s)\ ds = 1$.
$\displaystyle \lim_{r \to \infty} \int^r_0 \underbrace{\dfrac{4s^2}{a_0^3}e^{-\frac{2s}{a_o}}ds}_{u\ =\ \frac{2s}{a_o},\ du = \frac{2ds}{a_o}} = \lim_{r \to \infty} - \dfrac {\cancel{a_0}}2 \cdot \dfrac 1{\cancel{a_0}} \int^{\frac{2r}{a_o}}_0 u^2e^u\ du = \lim_{r \to \infty} - \dfrac 12 \left(u^2e^u \Big |^{\frac{-2r}{a_o}}_0 - 2 \int^{\frac{-2r}{a_o}}_0 ue^u\ du\right) = \lim_{r \to \infty} - \dfrac 12 \left[u^2e^u \Big |^{\frac{-2r}{a_o}}_0 - 2 \left( ue^u \Big |^{\frac{-2r}{a_o}}_0 - e^u \Big |^{\frac{-2r}{a_o}}_0 \right)\right] = 1\ \blacksquare$
**b)** Encontre $\lim_{r\to \infty} p(r)$. Para que valor de $r$ a função $p(r)$ tem seu valor máximo?
$\displaystyle \lim_{r \to \infty} \dfrac{4r^2}{a_0^3e^{\frac{2r}a}} = \dfrac 4{a^3_0} \lim_{r \to \infty} \dfrac{r^2}{e^{\frac{2r}a}} = \dfrac 4{a^3_0} \lim_{r \to \infty} \dfrac{2r}{e^{\frac{2r}a} \cdot \dfrac 2a} = \dfrac 4{a^3_0} \lim_{r \to \infty} \dfrac{ar}{e^{\frac{2r}a}} = \dfrac 4{a^3_0} \lim_{r \to \infty} \dfrac{a}{e^{\frac{2r}a} \cdot \dfrac 2a} = \dfrac 4{a^3_0} \cdot 0 = 0\ \blacksquare$
Para encontrar o valor máximo da função, iremos derivá-la para encontrar os pontos de valor máximo e mínimo:
$p(r) = \dfrac 4{a_0^3} \cdot \dfrac{\overbrace{r^2}^{u}}{\underbrace{e^{\frac{2r}a}}_{v}} \implies u' = 2r;\ v' = e^{\frac{2r}{a_o}} \ln e \dfrac 2{a_0} = \dfrac{2e^{\frac{2r}{a_o}}}{a_0}\\\ \\ p'(r) = \dfrac 4{a_0^3} \cdot \dfrac{e^{\frac{2r}{a_o}} \cdot 2r - \left(r^2 \cdot \dfrac{2e^{\frac{2r}{a_o}}}{a}\right)}{(e^{\frac{2r}{a_o}})^2} = \dfrac{8r(a_0 - r)}{a^4e^{\frac{2r}{a_o}}}$
Assim, a função tem valor máximo ou mínimo quando a sua derivada tem valor igual a $0$. Verificamos que isso ocorre quando $r (r - a_0) = 0$, o que implica $r = 0$ ou $r = a_0$. Substituíndo estes valores da função inicial obtemos respectivamente o mínimo ($0$) e o máximo($\frac 4{a_0e^2}$). $\blacksquare$
**c)** Desenhe a função densidade
![](/home/user/Public/USP/Sistemas%20de%20Informação/2º%20semestre/Cálculo%20II/Atividade%204/Imagens/2021-09-29-18-09-21-image.png)
> Desenho fora de escala, feito do ponto 0 em diante.
**d)** Calcule a probabilidade de o elétron estar dentro da esfera de raio $4a_0 $ centrada no núcleo.
$ P(4a)= \displaystyle \int^{4a}_0 \dfrac{4s^2}{a_0^3}e^{-\frac{2s}a} ds = -\dfrac 12 \left[u^2e^u \Big |^{\frac{-2r}{a_o}}_0 - 2 \left( ue^u \Big |^{\frac{-2r}{a_o}}_0 - e^u \Big |^{\frac{-2r}{a_o}}_0 \right)\right] = - \dfrac 12 \left[64e^{-8} - 64 - 2 (-8e^{-8} - e^{-8} + 1)\right] = 33 - \dfrac{41}{e^8} \approx 0,986\ \blacksquare$
**e)** Calcule a distância média do elétron e do núcleo no estado fundamental do átomo de hidrogênio.
$\displaystyle \lim_{r \to \infty} \int^r_0 \underbrace{4\left(\dfrac s{a_0}\right)^3 e^{-\frac{2r}{a_o}}ds}_{u = - \frac 2{a_o},\ -a_odu = ds} = \lim_{r \to \infty} 4a_0 \int^{-\frac r{a_o}}_0 \underbrace{u^3e^{2u}du}_{v = 2u,\ dv = 2du} = \lim_{r \to \infty}\dfrac {a_0}4 \int^{-\frac{2r}{a_o}}_0v^3e^vdv = \lim_{r \to \infty} \dfrac{a_0}4 \left(v^3e^v \Big|^{-\frac {2r}{a_o}}_0 - 3 \left(v^2e^v \Big|^{-\frac {2r}{a_o}}_0 - 2 \left(ve^v \Big|^{-\frac {2r}{a_o}}_0 - e^v \Big|^{-\frac {2r}{a_o}}_0\right)\right)\right) = - \underbrace{\cancel{\lim_{r \to \infty} \dfrac{2r^3}{e^{- \frac{2r}{a_o}}} -\lim_{r \to \infty} \dfrac{3r^2}{e^{- \frac{2r}{a_o}}} + \lim_{r \to \infty} \dfrac{3r}{e^{- \frac{2r}{a_o}}}}}_{\text{Aplicando L'Hopital, igualam-se a 0}} + \dfrac{3a_0}2 = \dfrac{3a_0}2\ \blacksquare$
[^1]: nUSP 12543033

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

View File

@ -1,37 +0,0 @@
# Integrais impróprias
## Do tipo 1
> Possui assíntota horizontal
Se $\int_a^t f(x)\ dx$ existe para cada número $t \ge a$, então
$$
\int^\infty_a f(x)\ dx = \lim_{t \to \infty} \int^t_a f(x)\ dx
$$
desde que o limite exista (como número). O mesmo caso é verdadeiro se $f$ for definida entre $[-\infty, a]$ (*tende ao infinito pela esquerda*).
## Do tipo 2
> Possui assintota vertical
Se $f$ é contínua em $[a, b)$ e descontínua em $b$, então
$$
\int^b_a f(x)\ dx = \lim_{t \to b^-} \int^t_a f(x)\ dx
$$
O mesmo caso é verdadeiro se $f$ for definida entre $(a, b]$ (*descontínuo pela esquerda*).
## Convergência
Integrais impróprias são chamadas **convergentes** se os limites correspondentes existem ou, senão, **divergentes**.
### Teorema de comparação
Suponha $f$ e $g$, duas funções contínuas com $f(x) \ge g(x) \ge 0$ para $x \ge a$.
- Se $\int^\infty_a f(x)\ dx$ é **convergente**, $\int^\infty_a g(x)\ dx$ também o é;
- Se $\int^\infty_a g(x)\ dx$ é **divergente**, $\int^\infty_a f(x)\ dx$ também o é.

View File

@ -1,60 +0,0 @@
# Atividade 5
> Resolução dos exercícios obrigatórios, feita por Guilherme de Abreu Barreto[^1].
## Capítulo 12.1
### Exercício 23
Descreva em palavras a região de $\R^3$ representada pela equação $x = 5$.
### Resolução
Plano paralelo ao plano $yz$, que cruza o eixo $x$ no ponto $5$.
### Exercício 37
A região constituída em todos os pontos entre (mas não sobre) as esferas de raio $r$ e $R$ centradas na origem, onde $r < R$.
#### Resolução
Tido que, se o centro da esfera encontra-se na origem, a equação pode ser descrita como:
$$
x^2 + y^2 + z^2 = r^2
$$
Tem-se que a área pedida pode ser representada pelo conjunto de coordenadas $x$, $y$ e $z$ que satisfazem:
$$
r^2 < x^2 + y^2 + z^2 < R^2
$$
## Capítulo 12.2
### Exercício 25
Determine o vetor unitário com mesma direção e sentido que $8\textbf i - \textbf j + 4 \textbf k$.
#### Resolução
Um vetor unitário $\textbf u$ paralelo à $\textbf v = 8\textbf i - \textbf j + 4 \textbf k$ é
$$
\textbf u = \dfrac{\textbf v}{|\textbf v|} =
\dfrac{8\textbf i - \textbf j + 4 \textbf k}{\sqrt{8^2 + (-1)^2 + 4^2}} =
\dfrac{8\textbf i - \textbf j + 4 \textbf k}{\sqrt{81}} =
\dfrac 89 \textbf i - \dfrac 19 \textbf j + \dfrac 49 \textbf k\ \blacksquare
$$
### Exercício 31
Um quarterback lança uma bola de futebol com ângulo de elevação 40º e velocidade de 60 pés/s. Encontre os componentes horizontal e vertical do vetor velocidade.
#### Resolução
Horizontal: $\textbf h = \cos 40\degree \cdot 60 \approx 45,96 \text{ pés/s}$
Vertical: $\textbf v = \sin 40\degree \cdot 60 \approx 38,57 \text{ pés/s}$
[^1]: nUSP 12543033

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 KiB

View File

@ -1,44 +0,0 @@
# Sistemas de coordenadas tridimencionais
## Fórmula da distância em três dimensões
A fórmula familiar para a distância entre dois pontos em um plano é estendida facilmente para a seguinte fórmula tridimensional. A distância $|P_1P_2|$ entre os pontos $P_1(x_1, y_1, z_1)$ e $P_2(x_2, y_2, z_2)$ é
$$
|P_1P_2| = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2}
$$
## Equação da esfera
Para um esfera de centro em $C(h, k, y)$, um ponto $P(x,y,z)$ encontra-se na superfície da esfera se
$$
(x - h)^2 + (y - k)^2 + (z - l)^2 = r^2
$$
Em particular, se o centro da esfera encontra-se na origem, a equação pode ser descrita mais facilmente como:
$$
x^2 + y^2 + z^2 = r^2
$$
### Exemplo
Mostre que $x^2 + y^2 + z^2 + 4x - 6y + 2z + 6 = 0$ é a equação de uma esfera e encontre seu **centro** e **raio**.
#### Resolução
Podemos reescrever a equação dada na forma da equação de uma esfera se completarmos os quadrados:
$$
(x^2 + 4x + 4) + (y^2 - 6y + 9) + (z^2 + 2z + 1) = -6 + 4 + 9 + 1\\
\therefore (x + 2)^2 + (y - 3)^2 + (z + 1)^2 = (2\sqrt 2)^2
$$
Logo, as coordenadas $C(h, k, l)$ do centro da esfera são $(-2, 3, -1)$ e esta possui raio $2\sqrt 2$.
## Equação do plano equidistante à dois pontos
O conjunto de pontos $P$ equidistantes a dois pontos $A$ e $B$ é tal que $\{P:|AP| = |BP|\}$. Para pontos $P(x,y,z), A(x_A, y_A, z_A), B(x_A, y_A, z_A) \in \R^3$ a equação de tal plano fica
$|AP| = |BP| \implies\\ \sqrt{(x - x_A)^2 + (y - y_A)^2 + (z - z_A)^2} = \sqrt{(x - x_B)^2 + (y - y_B)^2 + (z - z_B)^2} \implies \\ (x - x_A)^2 + (y - y_A)^2 + (z - z_A)^2 = (x - x_B)^2 + (y - y_B)^2 + (z - z_B)^2$

View File

@ -1,57 +0,0 @@
# Vetores
## Adição de vetores
Se $\overrightarrow{AB}$ e $\overrightarrow{BC}$ são vetores posicionados de maneira que o ponto inicial de $\overrightarrow{BC}$ é o ponto terminal de $\overrightarrow{AB}$, então a soma $\overrightarrow{AB} + \overrightarrow{BC}$ é o vetor $\overrightarrow{AC}$ do ponto inicial de $\overrightarrow{AB}$ ao ponto final de $\overrightarrow{BC}$. A definição de adição de vetores é ilustrada abaixo. Você pode ver por que essa definição é algumas vezes chamada **Lei do Triângulo**.
<img src="file:///home/user/Public/USP/Sistemas%20de%20Informação/2º%20semestre/Cálculo%20II/Atividade%205/Imagens/2021-10-11-19-00-58-image.png" title="" alt="" data-align="center">
Utilizando-se de coordenadas cartesianas, tem-se:
<img src="file:///home/user/Public/USP/Sistemas%20de%20Informação/2º%20semestre/Cálculo%20II/Atividade%205/Imagens/2021-10-11-19-37-49-image.png" title="" alt="" data-align="center">
## Multiplicação escalar
Se $c$ é um escalar e $\textbf v$ é um vetor, então a **multiplicação escalar** $c\textbf v$ é o vetor cujo comprimento é $|c|$ vezes o comprimento de $\textbf v$ e cuja direção e sentido são os mesmos de $\textbf v$ se $c > 0$ e sentido oposto a $\textbf v$ se $c < 0$. Se $c = 0$ ou $v = 0$, então $c\textbf v = 0$.
<img src="file:///home/user/Public/USP/Sistemas%20de%20Informação/2º%20semestre/Cálculo%20II/Atividade%205/Imagens/2021-10-11-19-06-47-image.png" title="" alt="" data-align="center">
> Múltiplos escalares de $\textbf v$
## Componentes
As coordenadas que descrevem um vetor. Por exemplo, sendo $a$ um componente do vetor $\textbf a$, podemos descrever vetores bi e tridimencionais como:
$$
\textbf a = \langle a_1,a_2 \rangle;\ \textbf a = \langle a_1, a_2, a_3 \rangle
$$
Usamos a notação $\langle a_1,a_2 \rangle$ para o par ordenado que se refere a um vetor para não confundir com o par ordenado $(a_1, a_2)$ que corresponde a um ponto no plano.
Ao somarmos algebricamente vetores, *somamos suas componentes*. Analogamente, ao multiplicarmos estes por escalares, multiplicamos seus componentes.
### Vetor posição
O vetor cuja origem corresponde à origem do sistema de coordenadas.
<img src="file:///home/user/Public/USP/Sistemas%20de%20Informação/2º%20semestre/Cálculo%20II/Atividade%205/Imagens/2021-10-11-19-24-18-image.png" title="" alt="" data-align="center">
Para qualquer outra representação de início no ponto $A(x_1, y_1, z_1)$ e término no ponto $B(x_2, y_2, z_2)$, temos que o vetor $\textbf a$ com representação $\overrightarrow{AB}$ é
$$
\textbf a = \langle x_2 - x_1, y_2 - y_1, z_2 - z_1 \rangle
$$
## Comprimento
O comprimento de um vetor bidimensional $\textbf a = \langle a_1,a_2 \rangle$ é
$$
|\textbf a | = \sqrt{a_1^2 + a_2^2}
$$
O comprimento de um vetor tridimensional $\textbf a = \langle a_1,a_2, a_3 \rangle$ é
$$
|\textbf a | = \sqrt{a_1^2 + a_2^2 + a_3^2}
$$

View File

@ -1,105 +0,0 @@
# Atividade 6
> Resolução dos exercícios obrigatórios, feita por Guilherme de Abreu Barreto[^1].
## Capítulo 12.3
### Exercício 39
Determine o vetor projeção e a projeção escalar de **b** sobre **a** onde
$$
\textbf a = \lang -5,12 \rang;\, \textbf b = \lang 4,6\rang
$$
### Resolução
$\text{comp}_\textbf a \textbf b = \dfrac{\textbf a \cdot \textbf b}{|\textbf a|} = \dfrac{-5 \cdot 4 + 12 \cdot 6}{\sqrt{(-5)^2 + 12^2}} = 4$
$\text{proj}_\textbf a \textbf b = \dfrac{\textbf a}{|\textbf a|}\text{comp}_\textbf a \textbf b = \dfrac 4{13}\lang-5,12\rang = \left\lang\dfrac{-20}{13}, \dfrac{48}{13} \right\rang\ \blacksquare$
### Exercício 63
A *Lei do Paralelogramo* afirma que
$$
|\textbf a + \textbf b|^2 + |\textbf a - \textbf b|^2 =
2 |\textbf a|^2 + 2|\textbf b|^2
$$
Dê uma interpretação geométrica da Lei do Paralelogramo e a demonstre
#### Resolução
<img src="file:///home/user/Public/USP/Sistemas%20de%20Informação/2º%20semestre/Cálculo%20II/Atividade%206/Imagens/8547e17775bc6c2b5c4708c0fc4e8a0575190eb4.png" title="" alt="" data-align="center">
Considere o paralelogramo acima. É possível aferir o comprimento de suas diagonais à partir do comprimento de seus lados. De fato, podemos aferi-las separadamente usando a *Lei dos Cossenos*:
$|\overline{BD}|^2 =
|\overline{AD}|^2 + |\overline{AB}|^2 - 2 |\overline{AD}||\overline{AB}|\cos \theta
$
e
$|\overline{AC}|^2 =
|\overline{AD}|^2 + |\overline{CD}|^2 - 2 |\overline{AD}||\overline{CD}|\cos(\pi - \theta)
= \\ |\overline{AD}|^2 + |\overline{CD}|^2 - 2 |\overline{AD}||\overline{CD}|[\cos \pi \cdot \cos \theta + \cancel{\sin \pi \cdot \sin \theta}] = \\
|\overline{AD}|^2 + |\overline{CD}|^2 + 2 |\overline{AD}||\overline{CD}|\cos\theta$
Substituindo o comprimento dos lados e diagonais por sua representação vetorial ($|\textbf a| = |\overline{AD}| = |\overline{BC}|$, $|\textbf b| = |\overline{AB}| = |\overline{CD}|$, $|\textbf{a + b}| = |\overline{AC}|$, $|\textbf a - \textbf b| = |\overline{BD}|$) e somando-se as equações anteriores, temos demonstrada a *Lei do Paralelogramo*:
$$
+ \begin{cases}
|\textbf a - \textbf b|^2 =
|\textbf a|^2 + |\textbf b|^2
- 2 |\textbf a||\textbf b|\cos \theta \\
|\textbf{a + b}|^2 =
|\textbf a|^2 + |\textbf b|^2
+ 2 |\textbf a||\textbf b|\cos \theta \\
\end{cases}\\\ \\ \therefore |\textbf a + \textbf b|^2 + |\textbf a - \textbf b|^2 =
2 |\textbf a|^2 + 2|\textbf b|^2\ \blacksquare
$$
## Capítulo 12.4
### Exercício 37
Utilize o produto misto para mostrar que os vetores $\textbf u = \textbf i + 5\textbf j - 2 \textbf k$, $\textbf v = 3 \textbf i - \textbf j$ e $\textbf w = 5 \textbf i + 9 \textbf j - 4 \textbf k$ são coplanares.
#### Resolução
Conforme a definição de produto misto, dados vetores são complanares se o produto misto destes for igual à 0. Avaliemos o presente caso.
$ \textbf u (\textbf v \times \textbf w) =
\left|\begin{matrix}
1 & \phantom{-}5 & -2 \\ 3 & -1 & \phantom{-}0 \\ 5 & \phantom{-}9 & -4
\end{matrix}\right| =
1 \left |\begin{matrix}
-1 & \phantom{-}0 \\ \phantom{-}9 & -4
\end{matrix}\right | - 5 \left |\begin{matrix}
3 & \phantom{-}0 \\ 5 & -4
\end{matrix}\right | +
(-2) \left |\begin{matrix}
3 & -1 \\ 5 & \phantom{-}9
\end{matrix}\right | = \\\ \\
4 - 5(-12) - 2(27 + 5) = 0\ \blacksquare $
### Exercício 49
Demonstre que $(\textbf a - \textbf b) \times (\textbf a + \textbf b) = 2(\textbf a \times \textbf b)$.
#### Resolução
Lembremos as seguintes propriedades:
**P1.** $|\textbf a \times \textbf b| = |\textbf a||\textbf b| \sin \theta$ onde $\theta$ é o ângulo entre **a** e **b**, $0 \le \theta \le \pi$;
**P2.** $\textbf a \times \textbf b = - \textbf b \times \textbf a$;
**P3.** $\textbf a \times (\textbf b + \textbf c) = \textbf a \times \textbf b + \textbf a \times \textbf c$;
Logo,
$(\textbf a - \textbf b) \times (\textbf a + \textbf b) = \underbrace{\textbf a \times (\textbf a + \textbf b) - \textbf b \times (\textbf a + \textbf b)}_{\textbf{P3}} = \\\ \\ \underbrace{\textbf a \times \textbf a}_{\textbf{P1}} + \textbf a \times \textbf b\ \underbrace{- \textbf b \times \textbf a}_{\textbf{P2}} - \underbrace{\textbf b \times \textbf b}_{\textbf{P1}} = \cancel{\textbf a^2\sin 0}\ + 2 (\textbf a \times \textbf b) - \cancel{\textbf b^2\sin 0}\ = 2 (\textbf a \times \textbf b)\ \blacksquare$
[^1]: nUSP 12543033; Turma 04

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

View File

@ -1,134 +0,0 @@
# Produto Escalar
## Definição
Se $\textbf a = \langle a_1,\dots, a_n\rangle$ e $\textbf b = \langle b_1, \dots, b_n \rangle$, então o **produto escalar** de $\textbf a$ e $\textbf b$ é o número $\textbf a \cdot \textbf b$ dado por
$$
\textbf a \cdot \textbf b = a_1b_1 + \cdots + a_nb_n
$$
Assim, para achar o produto escalar de a e b, multiplicamos as componentes correspondentes e somamos. O resultado não é um vetor. É um número real, isto é, um escalar, por isso o nome.
### Exemplos
1. $\langle 2, 4 \rangle \cdot \langle 3, -1 \rangle = 2 \cdot 3 + 4 \cdot -1 = 2$
2. $(\textbf i + 2 \textbf j - 3 \textbf k) \cdot (2 \textbf j - \textbf k) = 1 \cdot 0 + 2 \cdot 2 -3 \cdot -1 = 7$
### Propriedades
Se $\textbf a$, $\textbf b$ e $\textbf c$ são vetores de $V_3$, $\textbf e$ o vetor nulo, e $c$ um escalar, então:
1. $\textbf a \cdot \textbf a = |\textbf a |^2$
2. $\textbf a \cdot \textbf b = \textbf b \cdot \textbf a$
3. $\textbf a \cdot (\textbf b + \textbf c) = \textbf a \cdot \textbf b + \textbf a \cdot \textbf c$
4. $(c \textbf a) \cdot \textbf b = c(\textbf a \cdot \textbf b) = \textbf a \cdot (c \textbf b)$
5. $\textbf e \cdot \textbf a = 0$
## Teorema
O produto escalar $\textbf a \cdot \textbf b$ tem uma interpretação geométrica em termos do **ângulo** $\theta$ **entre** $\textbf a$ e $\textbf b$:
$$
\textbf a \cdot \textbf b = |\textbf a| |\textbf b| \cos \theta
$$
<img src="file:///home/user/Public/USP/Sistemas%20de%20Informação/2º%20semestre/Cálculo%20II/Atividade%206/Imagens/2021-10-17-18-37-42-image.png" title="" alt="" data-align="center">
> Figura 1
### Demonstração
Se aplicarmos a Lei dos Cossenos no triângulo $OAB$ da Figura 1, obteremos
$$
|AB|^2 = |OA|^2 + |OB|^2 - 2 |OA||OB| \cos \theta
$$
Onde $|OA| = |\textbf a|$, $|OB| = |\textbf b|$ e $|AB| = |\textbf a - \textbf b|$. Ou seja,
$|\textbf a - \textbf b|^2 = |\textbf a|^2 + |\textbf b|^2 - 2|\textbf a||\textbf b| \cos \theta = \\
|\textbf a|^2 - 2 \textbf a \cdot \textbf b + |\textbf b|^2 = |\textbf a|^2 + |\textbf b|^2 - 2|\textbf a||\textbf b| \cos \theta= \\ - 2 \textbf a \cdot \textbf b = - 2|\textbf a||\textbf b| \cos \theta = \\ \textbf a \cdot \textbf b = |\textbf a||\textbf b| \cos \theta$
### Exemplo
Determine o ângulo entre dois vetores $\textbf a = \lang 2, 2, -1\rang$ e $\textbf b \lang 5, -3, 2 \rang$.
$\textbf a \cdot \textbf b = |\textbf a| |\textbf b| \cos \theta \implies \cos \theta = \dfrac{\textbf a \cdot \textbf b}{|\textbf a| |\textbf b|} = \dfrac{2(5) + 2(-3) + 2(-1)}{\sqrt{2^2 + 2^2 + (-1)^2} \cdot \sqrt{5^2 + (-3)^2 + 2^2}} = \dfrac 2{3\sqrt{38}}$
### Casos específicos
Dois vetores $\textbf a$ e $\textbf b$ formam um ângulo
- ortogonal se $\textbf a \cdot \textbf b = 0 \implies \theta = \frac 12 \pi$;
- agudo se $\textbf a \cdot \textbf b > 0$;
- obtuso se $\textbf a \cdot \textbf b < 0$.
## Ângulos Diretores
Os ângulos $\alpha$, $\beta$ e $\gamma$ (no intervalo $[0, \pi]$) que $\textbf a$ faz com os eixos coordenados positivos $x$, $y$ e $z$.
<img src="file:///home/user/Public/USP/Sistemas%20de%20Informação/2º%20semestre/Cálculo%20II/Atividade%206/Imagens/2021-10-18-14-46-40-image.png" title="" alt="" data-align="center">
Os cossenos desses ângulos diretores são chamados **cossenos diretores** do vetor $\textbf a$.
$$
\cos \alpha = \dfrac{a_1}{|\textbf a|};\,
\cos \beta = \dfrac{a_2}{|\textbf a|};\,
\cos \gamma = \dfrac{a_3}{|\textbf a|}.
$$
Onde
$$
\cos^2 \alpha + \cos^2 \beta + \cos^2 \gamma = 1
$$
Por isso
$$
\textbf a = \lang a_1, a_2, a_3 \rang =
\lang|\textbf a| \cos \alpha,|\textbf a| \cos \beta, |\textbf a| \cos \gamma\rang =
|\textbf a|\lang \cos \alpha, \cos \beta, \cos \gamma\rang
$$
Disso implica que
$$
\dfrac 1{|\textbf a|} \textbf a = \lang \cos \alpha, \cos \beta, \cos \gamma\rang
$$
## Projeções
<img src="file:///home/user/Public/USP/Sistemas%20de%20Informação/2º%20semestre/Cálculo%20II/Atividade%206/Imagens/2021-10-18-16-19-30-image.png" title="" alt="" data-align="center">
A figura acima mostra as representações $\overrightarrow{PQ}$ e $\overrightarrow{PR}$ de dois vetores $\textbf a$ e $\textbf b$ com a mesma origem $P$. Se $S$ é o pé do perpendicular a partir de $R$ à reta contendo $\overrightarrow{PQ}$ , então o vetor coam representação $\overrightarrow{PS}$ é chamado **vetor projeção** de $\textbf b$ sobre $\textbf a$ e é denotado por $\text{proj}_\textbf a \textbf b$.
$$
\text{proj}_\textbf a \textbf b =
\left(\frac{\textbf a \cdot \textbf b}{|\textbf a|}\right) \frac{\textbf a }{|\textbf a|}
$$
> Onde $\frac{\textbf a }{|\textbf a|}$ é o *versor* (vetor unitário) de $\textbf a$.
A projeção escalar de $\textbf b$ sobre $\textbf a$ (também chamada componente de $\textbf b$ ao longo de $\textbf a$) $\text{comp}_\textbf a \textbf b$ é definida como o módulo com sinal do vetor projeção, cujo valor é dado pelo número $|\textbf b| \cos \theta$, onde $\theta$ é o ângulo entre $\textbf a$ e $\textbf b$.
<img src="file:///home/user/Public/USP/Sistemas%20de%20Informação/2º%20semestre/Cálculo%20II/Atividade%206/Imagens/2021-10-18-16-55-55-image.png" title="" alt="" data-align="center">
$$
\text{comp}_\textbf a \textbf b = |\textbf b| \cos \theta =
\frac{\textbf a \cdot \textbf b}{|\textbf a|}
$$
> Observe que o vetor projeção é a projeção escalar vezes o versor de $\textbf a$:
>
> $$
> \text{proj}_\textbf a \textbf b = \frac{\textbf a }{|\textbf a|}\text{comp}_\textbf a \textbf b
> $$

View File

@ -1,125 +0,0 @@
# O Produto Vetorial
## Definição
Se $\textbf a = \lang a_1, a_2, a_3 \rang$ e $\textbf b = \lang b_1, b_2, b_3 \rang$, então **produto vetorial** ou **cruzado** de **a** e **b** é o vetor **c** perpendicular tanto à **a** e **b** descrito por
$$
\textbf c = \textbf a \times \textbf b =
\lang a_2b_3 - a_3b_2, a_3b_1 - a_1b_3, a_1b_2 - a_2b_1 \rang
$$
> **Obs:** Definição de produto vetorial para vetores *tridimensionais*.
Por ser ortogonal tanto à **a** e **b**, tem-se que:
$$
\textbf c \cdot \textbf a = \textbf c \cdot \textbf b = 0
= (\textbf a \times \textbf b) \cdot \textbf b
= (\textbf a \times \textbf b) \cdot \textbf a
$$
<img src="file:///home/user/Public/USP/Sistemas%20de%20Informação/2º%20semestre/Cálculo%20II/Atividade%206/Imagens/220px-Right_hand_rule_cross_product.svg.png" title="" alt="" data-align="center">
> A regra da mão direita fornece a direção de $\textbf a \times \textbf b$, ortogonal ao plano que contêm **a** e **b**. Nesta, um dos vetores aponta para o pulso enquanto os dedos da mão fecham-se em direção ao outro vetor pelo ângulo agudo entre estes. Nesta configuração, o polegar levantado aponta para $\textbf a \times \textbf b$.
### Propriedades
Se **a**, **b** e **c** são vetores e *c* é um escalar, então
1. $\textbf a \times \textbf a = 0$
2. $\textbf a \times \textbf b = - \textbf b \times \textbf a$
3. $(c \textbf a) \times \textbf b = c(\textbf a \times \textbf b) = \textbf a \times (c\textbf b)$
4. $\textbf a \times (\textbf b + \textbf c) = \textbf a \times \textbf b + \textbf a \times \textbf c$
5. $(\textbf a + \textbf b) \times \textbf c = \textbf a \times \textbf c + \textbf b \times \textbf c$
6. $\textbf a \cdot (\textbf b \times \textbf c) = (\textbf a \times \textbf b) \cdot \textbf c$
7. $\textbf a \times (\textbf b \times \textbf c) =
(\textbf a \cdot \textbf c)\textbf b - (\textbf a \cdot \textbf b)\textbf c$
Pela aplicação da propriedade 2 sobre as bases canônicas $\textbf i$, $\textbf j$ e $\textbf k$, obtemos
$$
\begin{matrix}
\textbf i \times \textbf j = \textbf k &
\textbf j \times \textbf k = \textbf i &
\textbf k \times \textbf i = \textbf j \\
\textbf j \times \textbf i = - \textbf k &
\textbf k \times \textbf j = - \textbf i &
\textbf i \times \textbf k = - \textbf j
\end{matrix}
$$
Resultado este que pode ser verificado pela aplicação da **regra da mão direita**.
### Exemplo
Encontre um vetor perpendicular ao plano que passa pelos pontos
$$
P(1, 4, 6), Q(-2, 5, -1), R(1, -1, 1)
$$
#### Resolução
O vetor $\overrightarrow{PQ} \times \overrightarrow{PR}$ é perpendicular a ambos $\overrightarrow{PQ}$ e $\overrightarrow{PR}$ e, portanto, perpendicular ao plano que passa por $P$, $Q$ e $R$. Tem-se que:
$\overrightarrow{PQ} = (-2 - 1)\textbf i + (5 - 4)\textbf j + (-1 - 6)\textbf k = - 3\textbf i + \textbf j - 7\textbf k \\ \overrightarrow{PR} = (1 - 1)\textbf i + (-1 -4)\textbf j + (1 - 6)\textbf k = -5 \textbf j - 5 \textbf k \\
\overrightarrow{PQ} \times \overrightarrow{PR} = \lang 1(-5) + 7(-5), -7(0) + 3(-5), -3(-5) - 1(0) \rang\\ = \lang-40,-15,15\rang = -5\lang 8,3,-3 \rang$
Assim, temos que $\lang-40,-15,15\rang$ é perpendicular ao plano e, no mais, todo múltiplo não nulo de $\lang 8,3,-3 \rang$ também o é.
## Teorema
Se $\theta$ é o ângulo entre **a** e **b**, $0 \le \theta \le \pi$, então
$$
|\textbf a \times \textbf b| = |\textbf a||\textbf b| \sin \theta = A
$$
Onde $A$ é a área descrita pelo paralelogramo formado entre os vetores. Assim, dois vetores são paralelos entre si se $\theta = k\pi$, $k \in \Z$.
<img src="file:///home/user/Public/USP/Sistemas%20de%20Informação/2º%20semestre/Cálculo%20II/Atividade%206/Imagens/2021-10-19-18-56-45-image.png" title="" alt="" data-align="center">
### Caso específico
A ideia de produto vetorial aparece muito frequentemente em física. Por exemplo, ao apertarmos um parafuso aplicando uma força a uma chave de boca iremos girar o parafuso). O torque $\tau$ (em relação à origem) é definido
como sendo o produto cruzado dos vetores posição e força:
$$
\tau = \textbf r \times \textbf F
$$
<img src="file:///home/user/Public/USP/Sistemas%20de%20Informação/2º%20semestre/Cálculo%20II/Atividade%206/Imagens/2021-10-21-11-25-21-image.png" title="" alt="" data-align="center">
Posto em termos da definição de produto vetorial, isso seria equivalente à
$$
|\tau| = |\textbf r \times \textbf F| = |\textbf r||\textbf F| \sin \theta
$$
## Produtos Triplos
O produto $\textbf a \cdot (\textbf b \times \textbf c)$ que ocorre na Propriedade 5 da definição de produto vetorial é chamado **produto misto ou produto triplo escalar** dos vetores **a**, **b** e **c**. O significado geométrico do produto misto pode ser visto considerando-se o paralelepípedo determinado pelos vetores **a**, **b** e **c**.
<img src="file:///home/user/Public/USP/Sistemas%20de%20Informação/2º%20semestre/Cálculo%20II/Atividade%206/Imagens/2021-10-21-11-14-02-image.png" title="" alt="" data-align="center">
Assim sendo, o volume do paralelepípedo determinado pelos vetores a, b e c é o módulo do produto misto:
$$
V = | \textbf a \cdot (\textbf b \times \textbf c)|
$$
### Caso específico
Se usarmos a fórmula anterior e descobrirmos que o volume do paralelepípedo determinado por **a**, **b** e **c** é 0, então os três vetores precisam pertencer ao mesmo plano; ou seja eles são **coplanares**.
**Exemplo**
$a = <1,5,-2>, b = <3,-1,0>, c = <5,9,-4> \\
\therefore V = | \textbf a \cdot (\textbf b \times \textbf c)| = \left| \begin{matrix} 1 & 5 & -2 \\ 3 & -1 & 0 \\ 5 & 9 & -4 \end{matrix} \right| = 1 \left|\begin{matrix} -1 & 0 \\ 9 & -4 \end{matrix} \right| - 5 \left| \begin{matrix} 3 & 0 \\ 5 & -4 \end{matrix} \right| - 2 \left| \begin{matrix} 3 & -1 \\ 5 & 9 \end{matrix} \right|\\ = 1(4) - 5(-12) - 2(27 + 5) = 0$

View File

@ -1,61 +0,0 @@
# Atividade 7
> Resolução dos exercícios obrigatórios, feita por Guilherme de Abreu Barreto[^1].
## Capítulo 12.5
### Exercício 41
Use as intersecções com os eixos coordenados como uma ajuda para esboçar o plano $2x + 5y + z = 10$.
#### Resolução
![](/home/user/Public/USP/Sistemas%20de%20Informação/2º%20semestre/Cálculo%20II/Atividade%207/Imagens/2021-11-02-19-14-54-image.png)
O plano cruza
- o eixo x em $2x + 5(0) + (0) = 10 \implies x = 5$
- o eixo y em $2(0) + 5y + (0) = 10 \implies y = 2$
- o eixo z em $2(0) + 5(0) + z = 10 \implies z = 10\ \blacksquare$
### Exercício 71
Determine a distância do ponto $(1, -2, 4)$ ao plano $3x + 2y + 6z = 5$.
#### Resolução
$$
D = \frac{|ax + by + cz + d|}{\sqrt{a^2 + b^2 + c^2}}
= \frac{|3(1) + 2(-2) + 6(4) - 5|}{\sqrt{9 + 4 + 36}}
= \frac{18}7\ \blacksquare
$$
## Capítulo 14.1
### Exercício 47
Faça o mapa de contorno da função mostrando várias curvas de nível para
$$
f (x, y) = ye^x
$$
#### Resolução
Mapa de contorno para valores $10 | k$ tais que $-10^6 \le k \le 10^6$:
![](/home/user/Public/USP/Sistemas%20de%20Informação/2º%20semestre/Cálculo%20II/Atividade%207/Imagens/2021-11-02-21-15-01-image.png)
### Exercício 71
Utilize um computador para traçar o gráfico da função $f(x, y) = 3x - x^4 - 4y^2 - 10xy$ usando vários domínios e pontos de vista. Imprima aquela que apresente melhor os “picos e vales”. Você acha que essa função tem um valor máximo? Você poderia identificar os pontos do gráfico correspondentes aos “máximos locais”? E aos “mínimos locais”?
#### Resolução
![](/home/user/Public/USP/Sistemas%20de%20Informação/2º%20semestre/Cálculo%20II/Atividade%207/Imagens/2021-11-02-21-29-18-image.png)
O gráfico acima corresponde a função descrita. Neste, é possível identificar dois máximos locais, para $z = 15$ e $z = 5$ e um mínimo local em $z = 0$.
[^1]: nUSP 12543033; Turma 04

View File

@ -1,206 +0,0 @@
# Equações de Retas e Planos
## Equação vetorial no espaço tridimensional
<img src="file:///home/user/Public/USP/Sistemas%20de%20Informação/2º%20semestre/Cálculo%20II/Atividade%207/Imagens/2021-11-02-11-25-13-image.png" title="" alt="" data-align="center">
$$
\textbf r = \textbf r_0 + t\textbf v
$$
Onde:
- $\textbf r_0 = \lang x_0, y_0, z_0 \rang$ é o vetor que parte da origem do sistemas de coordenadas $O$ e coincide com a origem do vetor $\textbf a$, $P_0$;
- $\textbf r = \lang x, y, z \rang$ é o vetor que parte da origem do sistema de coordenadas $O$ e coincide com a extremidade oposta do vetor $\textbf a$, $P$;
- $\textbf v = \lang a, b, c \rang$ é um vetor paralelo à $\textbf a$ partindo da origem do sistema de coordenadas, denominado **vetor diretor**;
- $t$ é o escalar que multiplica $\textbf v$ de tal forma que este assume a mesma magnitude e sentido que $\textbf a$.
> Assim, para diferentes valores de $t$ correspondem distintos pontos $P$ em $L$:
>
> <img src="file:///home/user/Public/USP/Sistemas%20de%20Informação/2º%20semestre/Cálculo%20II/Atividade%207/Imagens/2021-11-02-11-36-15-image.png" title="" alt="" data-align="center">
Explicitando os componentes na fórmula anterior, tem-se:
$$
\lang x, y, z \rang = \lang x_0, y_0, z_0 \rang + \lang ta, tb, tc \rang
= \lang x_0 + ta, y_0 + tb, z_0 + tc \rang
$$
Desta equação derivamos as seguintes **equações paramétricas**:
$$
\begin{cases}x = x_0 + at \\ y = y_0 + bt \\ z = z_0 + ct\end{cases}
$$
Podemos observar que entre estas $t$ é um fator comum. Logo, para qualquer vetor $\textbf a$ na reta $L$ em que $a,b,c \in \R^*$a seguinte igualdade é verdadeira:
$$
\frac{x - x_0}a = \frac{y - y_0}b = \frac{z - z_0}c
$$
Este conjunto de equações são denominadas **equações simétricas** de $L$.
## Planos
Um plano no espaço fica determinado se conhecermos um ponto $P_0(x_0, y_0, z_0)$ no plano e um vetor $\textbf n$, denominado **vetor normal**, ortogonal ao plano.
<img src="file:///home/user/Public/USP/Sistemas%20de%20Informação/2º%20semestre/Cálculo%20II/Atividade%207/Imagens/2021-11-02-13-38-20-image.png" title="" alt="" data-align="center">
Assim, seja $P(x, y, z)$ um ponto qualquer contido no plano tem-se que o vetor que liga $P_0$ à $P$ é $\textbf r - \textbf r_0$ tal que o produto vetorial $\textbf n \cdot (\textbf r - \textbf r_0) = 0$. Ou seja
$$
\textbf n \cdot \textbf r = \textbf n \cdot \textbf r_0
$$
Escrito de maneira a explicitar os componentes dos vetores $\textbf n = \lang a,b,c \rang$, $\textbf r = \lang x,y,z \rang$ e $\textbf r_0 = \lang x_0,y_0,z_0 \rang$ temos
$$
\lang a,b,c \rang \cdot \lang x - x_0, y - y_0, z - z_0 \rang =
a(x - x_0) + b(y - y_0) + c(z - z_0) = 0
$$
a **equação escalar do plano** que passa por $P_0$ com vetor normal $\textbf n$.
No mais, a equação anterior pode ser simplificada como:
$$
ax + by + cz + d = 0
$$
onde $d = -(ax_0 + by_0 + cz_0)$. Fórmula essa conhecida como **equação linear** em $x$, $y$, $z$. Uma importante aplicação desta equação é o cálculo da distância $D$ de um ponto com relação a um plano. Seja $x, y, z$ as coordenadas deste ponto, tem-se:
$$
D = \frac{|ax + by + cz + d|}{\sqrt{a^2 + b^2 + c^2}}
$$
### Equações simétricas na representação de planos
Podemos pensar na reta como a intersecção de dois planos:
$$
\begin{matrix} \dfrac{x - x_0}a = \dfrac{y - y_0}b & e &\dfrac{y - y_0}b = \dfrac{z - z_0}c \end{matrix}
$$
Por exemplo, para uma reta $L$ descrita por
$$
\begin{matrix} \dfrac{x - 1}5
= \dfrac y{-2} & e & \dfrac y{-2} = \dfrac z{-3} \end{matrix}
$$
Tem-se o seguinte gráfico:
<img src="file:///home/user/Public/USP/Sistemas%20de%20Informação/2º%20semestre/Cálculo%20II/Atividade%207/Imagens/2021-11-02-18-27-36-image.png" title="" alt="" data-align="center">
## Exemplos
### Exemplo 1
Mostre que as retas $L_1$ e $L_2$ com equações paramétricas dadas por
$$
\begin{cases} \begin{matrix}
x_1 = 1 + t & y_1 = -2 + 3t & z_1 = 4 - t \\
x_2 = 2s & y_2 = 3 + s & z_2 = -3 + 4s
\end{matrix} \end{cases}
$$
são retas **reversas**, isto é, são retas que não se interceptam e não são paralelas (não pertencendo, portanto, a um mesmo plano).
#### Resolução
As retas não são paralelas, pois os componentes de seus vetores diretores $\lang 1, 3, 1 \rang$ e $\lang 2, 1, 4 \rang$ não são proporcionais entre si.
As retas também não se intersectam pois, se houvesse intersecção, o seguinte sistema haveria uma solução:
$$
\begin{cases}1 + t = 2s \\ -2 + 3t = 3 + s \\ 4- t = -3 + 4s\end{cases}
$$
O que não é o caso para qualquer valor de $t$ e $s$.
### Exemplo 2
Encontre uma equação do plano que passa pelos pontos $P(1, 3, 2)$, $Q(3, -1, 6)$ e $R(5, 2, 0)$.
#### Resolução
Os vetores **a** e **b** correspondentes a $\overrightarrow{PQ}$ e $\overrightarrow{PR}$ são
$$
\begin{cases}
\textbf a = \lang 3 - 1, -1 - 3, 6 - 2 \rang = \lang 2, -4, 4 \rang \\
\textbf b = \lang 5 - 1, 2 - 3, 0 - 2 \rang = \lang 5, 2, 0 \rang
\end{cases}
$$
Como tanto **a** quanto **b** pertencem ao plano, o produto vetorial $\textbf a \times \textbf b$ é ortogonal ao plano e pode ser tomado como o vetor normal **n**. Assim,
$$
\textbf n = \textbf a \times \textbf b = \left|\begin{matrix}
\textbf i & \textbf j & \textbf k \\
2 & -4 & 4 \\
4 & -1 & -2
\end{matrix}\right| = \left|\begin{matrix}
-4 & 4 \\
-1 & -2
\end{matrix}\right| \textbf i - \left|\begin{matrix}
2 & 4 \\
4 & -2 \end{matrix}\right| \textbf j + \left|\begin{matrix}
2 & -4 \\
4 & -1
\end{matrix}\right| \textbf k =\\
(8 + 4) \textbf i - (-4 - 16) \textbf j + (-2 + 16) \textbf k =
\lang 12, 20, 14 \rang \equiv \lang 6, 10, 7 \rang
$$
Com o ponto $P(1, 3, 2)$ e o vetor normal **n**, uma equação do plano é
$$
6(x - 1) + 10(y - 3) + 7(z - 2) = 0 \implies 6x + 10y + 7z = 50
$$
### Exemplo 3
**a.** Determine o ângulo entre os planos $x + y + z = 1$ e $x - 2y + 3z = 1$
Os vetores normais a esses planos são
$$
\begin{matrix}
\textbf n_1 = \lang 1, 1, 1
\rang & \textbf n_2 = \lang 1, -2, 3\rang
\end{matrix}
$$
Portanto, se $\theta$ é o ângulo entre os dois planos,
$$
\cos \theta = \frac{\textbf n_1 \cdot \textbf n_2}{|\textbf n_1||\textbf n_2|}
= \frac{1(1) + 1(-2) + 1(3)}{\sqrt{1 + 1 + 1} \sqrt{1 + 4 + 9}} =
\frac 2{\sqrt{42}}\\\ \\
\therefore \theta = \cos^{-1} \left(\frac 2{\sqrt{42}}\right) \approx 72\degree
$$
**b.** Determine as equações simétricas da reta intersecção $L$ desses dois planos.
Primeiro precisamos encontrar um ponto em $L$. Por exemplo, podemos achar o ponto onde a reta intercepta o plano $xy$ tomando $z = 0$ na equação dos dois planos. Isso fornece as equações $x + y = 1$ e $x - 2y = 1$, cuja solução é $x = 1$, $y = 0$. Portanto, o ponto $(1, 0, 0)$ encontra-se em $L$.
Observe que, como $L$ pertence a ambos os planos, é perpendicular ao vetor normal de ambos os planos. Então, um vetor **v** paralelo a $L$ é dado pelo produto vetorial
$$
\textbf v = \textbf n_1 \times \textbf n_2 = \left|\begin{matrix}
\textbf i & \textbf j & \textbf k \\
1 & 1 & 1 \\
1 & -2 & 3
\end{matrix} \right| = 5 \textbf i - 2 \textbf j - 3 \textbf k
$$
e assim as equações simétricas de $L$ podem ser escritas como
$$
\frac{x - 1}5 = \frac y{-2} = \frac z{-3}
$$

View File

@ -1,23 +0,0 @@
# Funções de Múltiplas Variáveis
## Funções de Duas Variáveis
Uma função $f$ de duas variáveis é uma regra que associa a cada par ordenado de números reais $(x, y)$ de um conjunto $D$ um único valor real, denotado por
$f (x, y)$. O conjunto $D$ é o domínio de $f$ e sua imagem é o conjunto de valores possíveis de $f$, ou seja, $f= \{(x, y): x, y \in D\}$. Por exemplo, funções da forma $f: \R^2 \to \R$.
### Gráficos
Se $f$ é uma função de duas variáveis com domínio $D$, então o gráfico de $f$ é
o conjunto de todos os pontos $(x, y, z)$ em $\R^3$ tal que $z = f (x, y)$ e $(x, y)$ pertença a $D$.
<img src="file:///home/user/Public/USP/Sistemas%20de%20Informação/2º%20semestre/Cálculo%20II/Atividade%207/Imagens/2021-11-02-20-08-58-image.png" title="" alt="" data-align="center">
#### Curvas de nível
As curvas de nível de uma função $f$ de duas variáveis são aquelas com equação $f (x, y) = k$, onde $k$ é uma constante (na imagem de $f$).
![](/home/user/Public/USP/Sistemas%20de%20Informação/2º%20semestre/Cálculo%20II/Atividade%207/Imagens/2021-11-02-20-15-15-image.png)
## Funções de Três ou Mais Variáveis
Uma função com três variáveis $f$, é uma regra que associa a cada tripla ordenada $(x, y, z)$ em um domínio $D \subset \R^3$ um único número real, denotado por $f(x, y, z)$. Enquanto uma função com $n$ variáveis é uma regra que associa um número $z = f(x_1, x_2, \dots, x_n)$ a uma n-upla $(y_1, y_2, \dots, y_n)$ de números reais. Denotamos por $\R^n$ o conjunto de todas essas n-uplas.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 281 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 203 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 176 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 134 KiB

View File

@ -1,65 +0,0 @@
# Atividade 8
> Resolução dos exercícios obrigatórios, feita por Guilherme de Abreu Barreto[^1].
## Capítulo 14.2
### Exercício 19
Determine o limite, se existir, ou mostre que o limite não existe:
$$
\lim_{(x,y,z) \to (\pi,\theta,1)} e^{y^2}\tan(xz)
$$
#### Resolução
O limite existe pois a função está definida para $x = \pi$, $y = \theta$ e $z = 1$:
$$
\lim_{(x,y,z) \to (\pi,\theta,1)} e^{y^2}\tan(xz)
= e^{\theta^2} \tan (\pi)
= e^{\theta^2} \cdot 0 = 0 = e^{y^2}\tan(xz)
$$
### Exercício 31
Determine o maior conjunto no qual a função é contínua:
$$
F(x, y) = \frac{1 + x^2 + y^2}{1 - x^2 - y^2}
$$
#### Resolução
$$
\frac{1 + x^2 + y^2}{1 - x^2 - y^2} = \frac{1 + x^2 + y^2}{1 - (x^2 + y^2)}
$$
Assim, A função $F(x,y)$ está definida para $\{(x,y) : x^2 + y^2 \not = 1\}$, sendo o domínio da função o maior conjunto contínuo de valores para a mesma.
## Capítulo 14.3
### Exercício 45
Use a definição de derivadas parciais como limites para encontrar $f_x(x, y)$ e $f_y(x, y)$ em
$$
f(x,y) = xy^2 - x^3y
$$
#### Resolução
$\displaystyle f_x(x,y) = \lim_{h \to 0} \frac{(x+h)y^2 - (x + h)^3y - xy^2 + x^3y}h\\ = \lim_{h \to 0} \frac{\cancel{xy^2} + hy^2 - \cancel{x^3y} - 3x^2hy - 3xh^2y - h^3y - \cancel{xy^2 + x^3y}}h \\ = \lim_{h \to 0} \frac{\cancel h (y^2 - 3x^2y - 3xhy - h^2y)}{\cancel h} = y^2 - 3x^2y\ \blacksquare$
$\displaystyle f_y(x,y) = \lim_{h \to 0} \frac{x(y + h)^2 - x^3(y + h) - xy^2 + x^3y}h\\ = \lim_{h \to 0} \frac{\cancel{xy^2} + 2yhx + h^2x - \cancel{x^3y} - x^3h - \cancel{xy^2 + x^3 y}}h \\ = \lim_{h \to 0} \frac{\cancel h (2yx + hx - x^3)}{\cancel h} = - x^2 + 2xy\ \blacksquare$
### Exercício 65
Determine a derivada parcial $f_{xyz}$ para $f(x,y,z) = e^{xyz^2}$.
#### Resolução
$f_x = e^{xyz^2} \cdot yz^2 \implies \\ f_{xy} = e^{xyz^2} \cdot z^2 + e^{xyz^2} \cdot xyz^4 \implies \\ f_{xyz} = (e^{xyz^2} \cdot 2z + e^{xyz^2} \cdot 2xyz \cdot z^2) + (e^{xyz^2} \cdot 4xyz^3 + e^{xyz^2} \cdot 2xyz e^{xyz^2} \cdot xyz^4)\\ = e^{xyz^2}(2z + 6xyz^3 + 2x^2y^2z^5)\ \blacksquare$
[^1]: nUSP 12543033; Turma 04

View File

@ -1,41 +0,0 @@
# Derivadas Parciais
Se $f$ é uma função de duas variáveis ($x$, $y$), suas derivadas parciais são as funções $f_x$ e $f_y$ definidas por
$$
f_x (x, y) = \lim_{h \to 0} \frac{f[(x + h),y] - f(x,y)}h \\\ \\
f_y (x, y) = \lim_{h \to 0} \frac{f[x,(y + h)] - f(x,y)}h
$$
Outras notações utilizadas para derivadas parciais:
$$
f_x(x,y) = f_x = \frac{\partial f}{\partial x}
= \frac{\partial}{\partial x} f(x,y) = \frac{\partial z}{\partial x} =
f_1=D_1f = D_xf
$$
Onde $z = f(x,y)$ e o numerador $1$ é um índice que indica a primeira variável do par ordenado.
## Regra para determinar Derivadas Parciais de $\mathbf{z = f(x,y)}$
1. Para determinar $f_x$, trate $y$ como uma constante e derive $f(x,y)$ com relação a $x$.
2. Para determinar $f_y$, trate $x$ como uma constante e derive $f(x,y)$ com relação a $y$.
## Derivadas de Ordem Superior
Se $f$ é uma função de duas variáveis, suas derivadas parciais $f_x$ e $f_y$ são funções de duas variáveis, de modo que podemos considerar novamente suas derivadas parciais$ (f_x)_x$, $(f_x)_y$, $(f_y)_x$ e $(f_y)_y$, chamadas **derivadas parciais de segunda ordem** de $f$. Se $z = f(x, y)$, usamos a seguinte notação, por exemplo:
$$
(f_x)_x = f_{xx} = f_{11}
= \frac \partial{\partial x} \left( \frac {\partial f}{\partial x}\right)
= \frac {\partial^2f}{\partial x^2} = \frac {\partial^2z}{\partial x^2}
$$
### Teorema de Clairaut
Suponha que $f$ seja definida em uma bola aberta $D$ que contenha o ponto $(a, b)$. Se as funções $f_{xy}$ e $f_{yx}$ forem ambas contínuas em D, então
$$
f_{xy}(a,b) = f_{yx}(a,b)
$$

View File

@ -1,13 +0,0 @@
# Limites e continuidade
Seja $f$ uma função de duas variáveis cujo domínio $D$ contém pontos arbitrariamente próximos de $(a,b)$. Dizemos que o limite de $f(x,y)$ quando $(x,y)$ tende a $(a,b)$ é $L$ e escrevemos
$$
\lim_{(x,y) \to (a,b)} f(x,y) = L
$$
se para todo número $\varepsilon > 0$ houver um número correspondente de $\delta > 0$ tal que se $(x,y) \in D$ e $0 < \sqrt{(x - a)^2 + (y - b)^2} < \delta$ então $|f(x,y) - L| < \varepsilon$[^1].
Se $f (x, y) \to L_1$ quando $(x, y) \to (a, b)$ ao longo do caminho $C_1$ e $f (x, y) \to L_2$ quando $(x, y) \to (a, b)$ ao longo do caminho $C_2$, com $L_1 \not = L_2$, então $\lim_{(x, y) \to (a, b)} f (x, y)$ não existe.
[^1]: Observe que $|f(x,y) - L |$ corresponde à distância entre os números $f (x, y)$ e $L$, e $\sqrt{(x - a)^2 + (y - b)^2}$ é a distância entre o ponto $(x, y)$ e o ponto $(a, b)$. Noutras palavras, a definição diz que a distância entre $f (x, y)$ e $L$ pode ser feita arbitrariamente pequena se tornarmos a distância de $(x, y)$ a $(a, b)$ suficientemente pequena (mas não nula).

View File

@ -1,122 +0,0 @@
# Atividade 9
> Resolução dos exercícios obrigatórios, feita por Guilherme de Abreu Barreto[^1].
## Capítulo 14.4
### Exercício 24
O índice de sensação térmica $W$ é a temperatura sentida quando a temperatura real é $T$ e a velocidade do vento, $v$. Portanto, podemos escrever $W = f (T, v)$. A tabela de valores a seguir foi extraída da Tabela 1 da Seção 14.1. Use essa tabela para determinara aproximação linear da função de sensação térmica quando $T$ estiver a -15 ºC e $v$ estiver próximo de 50 km/h. Estime, a seguir, a sensação térmica quando a temperatura estiver a -17 ºC e a velocidade do vento for de 55 km/h.
<img src="file:///home/user/Public/USP/Sistemas%20de%20Informação/2º%20semestre/Cálculo%20II/Atividade%209/Imagens/2021-11-16-11-32-12-image.png" title="" alt="" data-align="center">
#### Resolução
A aproximação linear para $f(T,v)$ é dada por:
$$
f(T,v) \approx f(a,b) + f_T(a,b)(T - a) + f_v(a,b)(v - b)
$$
Para valores $a \approx T$ e $b \approx v$. Assim sendo, para estimarmos $f(-17,55)$ utilizaremos o valor descrito na tabela para $f(a,b) = f(-15,60)$ e aqueles adjacentes a este. Assim, temos que
$f_T(-15, 60) \approx \displaystyle \lim_{h \to 5} \dfrac{f(-15 + h, 60) - f(-15,60)}{2h}\\\ \\ + \lim_{h \to -5} \dfrac{f(-15 +h, 60) - f(-15,60)}{2h} = \dfrac{\dfrac{-23 + 30}5 + \dfrac{-36 + 30}{-5}}2 = \dfrac{13}{10}$
e
$f_v(-15, 60) \approx \displaystyle \lim_{h \to 10} \dfrac{f(-15, 60 + h) - f(-15,60)}{2h}\\ \ + \lim_{h \to -10} \dfrac{f(-15, 60 + h) - f(-15,60)}{2h} = \dfrac{\dfrac{30 - 30}{10} + \dfrac{30 - 29}{-10}}2 = - \dfrac 1{20}$
Logo,
$f(-17,55) \approx f(-15, 60) + f_T(-15,60)(-17 + 15) + f_v(-15,60)(55 - 60) \\\ \\ \approx -30 + \dfrac{13}{10}(-2) - \dfrac 1{20}(-5) \approx -32,25\ \blacksquare$
### Exercício 42
Suponha que você precise saber uma equação do plano tangente à superfície $S$ no ponto $P(2, 1, 3)$. Você não tem uma equação para $S$, mas sabe que as curvas
- $\textbf r_1(t) = \lang 2 + 3t, 1 - t^2, 3 - 4t + t^2\rang$
- $\textbf r_2(u) = \lang 1 + u^2, 2u^3 - 1, 2u + 1 \rang$
ambas estão em $S$. Encontre uma equação para o plano tangente em $P$.
#### Resolução
Podemos deduzir onde as retas passam pelo ponto $P$ fazendo a seguinte comparação:
- Se $\textbf r_1(t) = \lang 2 + 3t, 1 - t^2, 3 - 4t + t^2\rang = \lang 2, 1, 3 \rang$, então
$\begin{cases}
2 + 3t = 2 \\
1 - t^2 = 1 \\
3 - 4t + t^2 = 3
\end{cases} \therefore t = 0$
Portanto, $\textbf r_1(t)$ cruza $P$ em $\textbf r_1(0)$.
- Se $\textbf r_2(u) = \lang 1 + u^2, 2u^3 - 1, 2u + 1 \rang= \lang 2, 1, 3 \rang$, então
$\begin{cases}
1 + u^2 = 2 \\
2u^3 - 1 = 1 \\
2u + 1 = 3
\end{cases} \therefore u = 1$
Portanto, $\textbf r_2(u)$ cruza $P$ em $\textbf r_2(1)$.
Derivamos então as equações das curvas para obter a reta tangente destas:
- $\textbf r_1(t) = \lang 2 + 3t, 1 - t^2, 3 - 4t + t^2\rang \implies \textbf r_1'(t) = \lang 3, - 2t, 2t - 4 \rang$
- $\textbf r_2(u) = \lang 1 + u^2, 2u^3 - 1, 2u + 1 \rang \implies \textbf r_2'(u) = \lang 2u, 6u, 2 \rang$
Com as retas tangentes conseguimos obter a reta normal $\textbf n$, ortogonal à ambas, no ponto $P = (2, 1, 3)$:
$\textbf r_1'(0) \times \textbf r_2'(1) = \lang 3, 0 , -4 \rang \times \lang 2, 6, 2 \rang \\ = \lang 0 \cdot 2 - (-4 \cdot 6), -4 \cdot 2 - 3 \cdot 2, 3 \cdot 6 - 0 \cdot 2 \rang = \lang 24, -14, 18 \rang$
Por vez, a reta normal nos permite descrever a **equação linear** do plano sobre o ponto $P$:
$24 x - 14y + 18z - (24 \cdot 2 - 14 \cdot 1 + 18 \cdot 3) = 0\\ \\ \implies 12 x - 7y + 9z - (12 \cdot 2 - 7 \cdot 1 + 9 \cdot 3) = 0\\ \\ \implies 12x - 7y + 9z - 44 = 0\ \blacksquare$
## Capítulo 14.5
### Exercício 43
Um lado de um triângulo está aumentando em uma taxa de $3\ cm/s$ e um segundo lado está decrescendo em uma taxa de $2\ cm/s$. Se a área do triângulo permanece constante, a que taxa varia o ângulo entre os lados quando o primeiro lado tem $20 cm$ de comprimento, o segundo lado tem $30 cm$ de comprimento e
o ângulo é $\frac \pi6$?
#### Resolução
Denominemos por $x$ o primeiro lado, $y$ o segundo e $\theta$ o ângulo entre eles. Pela aplicação da Lei dos senos, podemos aferir a área do triângulo $A$ como sendo $A = \frac{xy\sin\theta}2$ Assim, o valor de $A$ se dá em função de $x$, $y$ e $\theta$ e estes por vez se dão em função do tempo $t$. Sabemos pelo enunciado que a taxa de variação do comprimento de $x$, $\frac{dx}{dt} = 3$, e $y$, $\frac{dy}{dt} = -2$. Também, que para a área $A$ não ocorre variação, $\frac{dA}{dt} = 0$. Buscamos aqui saber a taxa de variação do ângulo $\theta$, $\frac{d\theta}{dt}$. Ora, podemos relacionar estes dados fazendo uso da Regra da Cadeia e inferi-la:
$\displaystyle \frac{dA}{dt} = \frac{\partial A}{\partial x}\frac{dx}{dt} + \frac{\partial A}{\partial y}\frac{dy}{dt} + \frac{\partial A}{\partial \theta}\frac{d\theta}{dt} \implies 0 = \frac{3y \sin \theta}2 - \frac{2 x \sin \theta}2 + \dfrac{xy \cos \theta}2\frac{d\theta}{dt} \\\ \\ \implies \frac{d\theta}{dt} = \frac{2x\sin \theta - 3y\sin \theta}{xy\cos \theta} = \frac{\sin \theta}{\cos \theta} \cdot \frac{2x - 3y}{xy} = \tan \left(\frac \pi 6\right) \cdot \frac{2 \cdot 2\cancel 0 - 3 \cdot 3\cancel 0}{60\cancel 0}\\\ \\ = \frac{\sqrt 3}3 \cdot - \frac 1{12} = - \frac{\sqrt 3}{36}\ \blacksquare$
### Exercício 59
A Equação 6 é uma fórmula para a derivada $dy/dx$ de uma função definida implicitamente por uma equação $F (x, y) = 0$, sendo que $F$ é diferenciável e $F_y \not = 0$. Comprove que se $F$ tem derivadas contínuas de segunda ordem, então uma fórmula para a segunda derivada de $y$ é
$$
\frac{d^2y}{dx^2} = - \frac{F_{xx}F_y^2 - 2F_{xy}F_xF_y + F_yyF_x^2}{F_y^3}
$$
#### Resolução
Dado que a função foi definida implicitamente da maneira descrita pelo enunciado, sabemos que $\frac{dy}{dx} = - \frac{F_x}{F_y}$. Denominemos $G(x,y) = - \frac{F_x}{F_y}$. Ao derivarmos ambos os lados da equação e utilizarmos a Regra da Cadeia, teremos:
$$
\displaystyle \frac{d^2y}{dx^2} = \frac{\partial G}{\partial x} \cdot \cancel{\frac{dx}{dx}}\ 1 + \frac{\partial G}{\partial y} \cdot \frac{dy}{dx}
$$
Sendo que
- $\dfrac{\partial G}{\partial x} = \dfrac{\partial}{\partial x}\left(- \dfrac{F_x}{F_y}\right) = - \dfrac{F_yF_{xx} - F_xF_{yx}}{F_y^2}$
- $\dfrac{\partial G}{\partial y} = \dfrac{\partial}{\partial y}\left(- \dfrac{F_x}{F_y}\right) = - \dfrac{F_yF_{xy} - F_xF_{yy}}{F_y^2}$
Assim,
$\displaystyle \frac{d2y}{dx2} = - \dfrac{F_yF_{xx} - F_xF_{yx}}{F_y^2} + \left(- \dfrac{F_yF_{xy} - F_xF_{yy}}{F_y^2}\right)\left(- \dfrac{F_x}{F_y}\right) = \\\ \\ - \dfrac{F_{xx}F_y^2 - F_{yx} F_xF_y - F_{xy} F_yF_x + F_{yy}F_x^2}{F_y^3}$
Consideremos agora que $F$ tem derivadas de segunda ordem contínuas então, pelo Teorema de Clauraut, $F_{xy} = F_{yx}$ e
$$
\frac{d^2y}{dx^2} = - \frac{F_{xx}F_y^2 - 2F_{xy}F_xF_y + F_yyF_x^2}{F_y^3} \ \blacksquare
$$
[^1]: nUSP 12543033; Turma 04

Some files were not shown because too many files have changed in this diff Show More