-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathREADME.Rmd
More file actions
99 lines (56 loc) · 2.55 KB
/
README.Rmd
File metadata and controls
99 lines (56 loc) · 2.55 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
---
output:
md_document:
variant: markdown_github
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#",
fig.path = "tools/"
)
```
# bertini
<!-- badges: start -->
[](https://cran.r-project.org/package=bertini)
[](https://travis-ci.org/dkahle/bertini)
[](https://ci.appveyor.com/project/dkahle/bertini)
<!-- badges: end -->
__bertini__ is an R package that provides methods and data structures for [numerical algebraic geometry](https://en.wikipedia.org/wiki/Numerical_algebraic_geometry), the numerical solution to (nonlinear) systems of polynomial equations using homotopy continuation.
It is still experimental, but the core functionality in the zero-dimensional case is quite stable.
_Note: the following assumes you have [Bertini](https://bertini.nd.edu) and bertini recognizes its path. To do this properly, see `?set_bertini_path()`._
```{r load}
library("bertini")
```
## Basic usage
```{r basic-usage}
code <- "
INPUT
variable_group x, y;
function f, g;
f = x^2 + y^2 - 1;
g = y - x;
END;
"
bertini(code)
```
## Solving zero-dimensional systems of polynomial equations
`poly_solve()` is the basic workhorse for solving systems of polynomial equations. For example, if we want to solve the system $y = x$ and $x^{2} + y^{2} = 1$, which corresponds geometrically to the points where the identity line intersects the unit circle, we can use:
```{r poly-solve}
poly_solve(c("y = x", "x^2 + y^2 = 1"), varorder = c("x", "y"))
```
## Polynomial optimization over compact varieties
`poly_optim()` can be used to find the critical points of polynomials over varieties. For example, if we want to find the maximum value of the function $f(x,y) = x + y$ over the unit circle:
```{r poly-optim}
poly_optim("x + y", "x^2 + y^2 = 1")
```
## Installation
* From Github (dev version):
```{r, eval=FALSE}
if (!requireNamespace("devtools")) install.packages("devtools")
devtools::install_github("dkahle/mpoly")
devtools::install_github("dkahle/bertini")
```
## Acknowledgements
This material is based upon work supported by the National Science Foundation under Grant Nos. [1622449](https://nsf.gov/awardsearch/showAward?AWD_ID=1622449) and [1622369](https://www.nsf.gov/awardsearch/showAward?AWD_ID=1622369).