use quarto, not Pluto to render pages

This commit is contained in:
jverzani
2022-07-24 16:38:24 -04:00
parent 93c993206a
commit 7b37ca828c
879 changed files with 793311 additions and 2678 deletions

View File

@@ -2,7 +2,8 @@
In this section we use the following add on packages:
```juila
```julia
using CalculusWithJulia
using Plots
using SymPy
@@ -191,11 +192,9 @@ quotient, remainder = divrem(x^4 + 2x^2 + 5, x - 2)
The answer is a tuple containing the quotient and remainder. The quotient itself could be found with `div` or `÷` and the remainder with `rem`.
```julia; echo=false
note("""
For those who have worked with SymPy within Python, `divrem` is the `div` method renamed, as `Julia`'s `div` method has the generic meaning of returning the quotient.
""")
```
!!! note
For those who have worked with SymPy within Python, `divrem` is the `div` method renamed, as `Julia`'s `div` method has the generic meaning of returning the quotient.
As well, the `apart` function could be used for this task. This function
@@ -286,12 +285,11 @@ multiplicity must be accounted for and $x^2 + 1$ to see why complex
values may be necessary.)
```julia; echo=false
alert(raw"""
The special case of the ``0`` polynomial having no degree defined
eliminates needing to exclude it, as it has infinitely many roots. Otherwise, the language would be qualified to have ``n \geq 0``.
""")
```
!!! warning
The special case of the ``0`` polynomial having no degree defined
eliminates needing to exclude it, as it has infinitely many roots.
Otherwise, the language would be qualified to have ``n \geq 0``.
## Finding roots of a polynomial
@@ -458,11 +456,9 @@ q = sympy.Poly(p, x) # identify `x` as indeterminate; alternatively p.as_poly(x
roots(q)
```
```julia; echo=false
note("""
The sympy `Poly` function must be found within the underlying `sympy` module, a Python object, hence is qualified as `sympy.Poly`. This is common when using `SymPy`, as only a small handful of the many functions available are turned into `Julia` functions, the rest are used as would be done in Python. (This is similar, but different than qualifying by a `Julia` module when there are two conflicting names. An example will be the use of the name `roots` in both `SymPy` and `Polynomials` to refer to a function that finds the roots of a polynomial. If both functions were loaded, then the last line in the above example would need to be `SymPy.roots(q)` (note the capitalization.)
""")
```
!!! note
The sympy `Poly` function must be found within the underlying `sympy` module, a Python object, hence is qualified as `sympy.Poly`. This is common when using `SymPy`, as only a small handful of the many functions available are turned into `Julia` functions, the rest are used as would be done in Python. (This is similar, but different than qualifying by a `Julia` module when there are two conflicting names. An example will be the use of the name `roots` in both `SymPy` and `Polynomials` to refer to a function that finds the roots of a polynomial. If both functions were loaded, then the last line in the above example would need to be `SymPy.roots(q)` (note the capitalization.)
### Numerically finding roots
The `solve` function can be used to get numeric approximations to the
@@ -583,11 +579,9 @@ in fact there are three, two are *very* close together:
N.(solve(h))
```
```julia; echo=false
note("""
The difference of the two roots is around `1e-10`. For the graph over the interval of ``[-5,7]`` there are about ``800`` "pixels" used, so each pixel represents a size of about `1.5e-2`. So the cluster of roots would safely be hidden under a single "pixel."
""")
```
!!! note
The difference of the two roots is around `1e-10`. For the graph over the interval of ``[-5,7]`` there are about ``800`` "pixels" used, so each pixel represents a size of about `1.5e-2`. So the cluster of roots would safely be hidden under a single "pixel."
The point of this is to say, that it is useful to know where to look
for roots, even if graphing calculators or graphing programs make
@@ -713,8 +707,8 @@ choices = [
"``6``",
"``0``"
]
ans = 3
radioq(choices, ans)
answ = 3
radioq(choices, answ)
```
@@ -728,8 +722,8 @@ choices = [
"``x^2 - 2x + 2``",
"``2``"
]
ans = 2
radioq(choices, ans)
answ = 2
radioq(choices, answ)
```
###### Question
@@ -744,8 +738,8 @@ choices = [
"``x^3 + x^2 - 1``",
"``-2x + 2``"
]
ans = 3
radioq(choices, ans)
answ = 3
radioq(choices, answ)
```
###### Question
@@ -770,8 +764,8 @@ choices = [
"``x^5 + 2x^4 + 4x^3 + 8x^2 + 15x + 31``",
"``x^4 +2x^3 + 4x^2 + 8x + 15``",
"``31``"]
ans = 1
radioq(choices, ans)
answ = 1
radioq(choices, answ)
```
@@ -784,8 +778,8 @@ choices = [
"``x^5 + 2x^4 + 4x^3 + 8x^2 + 15x + 31``",
"``x^4 +2x^3 + 4x^2 + 8x + 15``",
"``31``"]
ans = 4
radioq(choices, ans)
answ = 4
radioq(choices, answ)
```
What is $r$?
@@ -797,8 +791,8 @@ choices = [
"``x^5 + 2x^4 + 4x^3 + 8x^2 + 15x + 31``",
"``x^4 +2x^3 + 4x^2 + 8x + 15``",
"``31``"]
ans = 5
radioq(choices, ans)
answ = 5
radioq(choices, answ)
```
@@ -813,8 +807,8 @@ choices = [
L" $2$ and $3$",
L" $(x-2)$ and $(x-3)$",
L" $(x+2)$ and $(x+3)$"]
ans = 2
radioq(choices, ans)
answ = 2
radioq(choices, answ)
```
@@ -860,8 +854,8 @@ q"[-0.434235, -0.434235, 0.188049, 0.188049, 0.578696, 4.91368]",
q"[-0.434235, -0.434235, 0.188049, 0.188049]",
q"[0.578696, 4.91368]",
q"[-0.434235+0.613836im, -0.434235-0.613836im]"]
ans = 3
radioq(choices, ans)
answ = 3
radioq(choices, answ)
```
@@ -916,8 +910,8 @@ numericq(1)
Let $f(x) = x^5 - 4x^4 + x^3 - 2x^2 + x$. What does Cauchy's bound say is the largest possible magnitude of a root?
```julia; hold=true; echo=false
ans = 1 + 4 + 1 + 2 + 1
numericq(ans)
answ = 1 + 4 + 1 + 2 + 1
numericq(answ)
```
What is the largest magnitude of a real root?
@@ -925,8 +919,8 @@ What is the largest magnitude of a real root?
```julia; hold=true; echo=false
f(x) = x^5 - 4x^4 + x^3 - 2x^2 + x
rts = find_zeros(f, -5..5)
ans = maximum(abs.(rts))
numericq(ans)
answ = maximum(abs.(rts))
numericq(answ)
```
@@ -970,8 +964,8 @@ choices = [
"``2x^2``",
"``x``",
"``2x``"]
ans = 1
radioq(choices, ans)
answ = 1
radioq(choices, answ)
```
* True or false, the $degree$ of $T_n(x)$ is $n$: (Look at the defining relation and reason this out).
@@ -992,8 +986,8 @@ The Chebyshev polynomials have the property that in fact all $n$ roots are real,
@syms x
p = 16x^5 - 20x^3 + 5x
rts = N.(solve(p))
ans = maximum(norm.(rts))
numericq(ans)
answ = maximum(norm.(rts))
numericq(answ)
```
* Plotting `p` over the interval $[-2,2]$ does not help graphically identify the roots: