-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpart_1.Rmd
67 lines (41 loc) · 1.2 KB
/
part_1.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
---
title: 'EDS 212 Day 2 Part 1: Derivative and Git Intro'
author: "Dalila Lara"
date: "2022-08-02"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## Derivatives in R
Find the derivative of $$f(x) =5x^2$$
```{r}
ex_1 <- expression(5 * x ^ 2)
my_derivative <- deriv(ex_1, "x")
my_derivative
```
#I want to find the slope at x = 2.8 #Create a sequence of values to evaluate multiple different integers for derivative.
```{r}
x <- 2.8
eval(my_derivative)
```
\#***Second method*** to find a derivative Find the slope of $g(z) = 2z^3-10.5z^2+4.1$ D gives us a simple output
```{r}
gz <- expression(2 * z ^ 3 - 10.5 * z ^ 2 + 4.1 )
dg_dz <- D(gz, 'z')
dg_dz
```
#Evaluate the slope over a range of values
```{r}
z <- seq(from = -3, to = 4, by = 0.5)
eval(dg_dz)
```
Git Hub
usethis::use_git()
Then appears as tab in rstudio.
- Commit locally
- Then push local files to github
- this creates a separate file from the main file with new updates
usethis::git_default_branch_rename(from = 'master', to = 'main')
function renames branch/file to main
Now this project branch name is main. For new project then would need to use this function again.