Skip to content

Commit

Permalink
Merge pull request #129 from jverzani/v0.19a
Browse files Browse the repository at this point in the history
updates after up
  • Loading branch information
jverzani authored May 25, 2024
2 parents 52aaa5d + 00cbbf7 commit 5866fa9
Show file tree
Hide file tree
Showing 6 changed files with 347 additions and 9 deletions.
15 changes: 15 additions & 0 deletions quarto/alternatives/symbolics.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -838,10 +838,18 @@ substitute(ΣqᵢΘᵢ, d)
The package provides an algorithm for the creation of candidates and the means to solve when possible. The `integrate` function is the main entry point. It returns three values: `solved`, `unsolved`, and `err`. The `unsolved` is the part of the integrand which can not be solved through this package. It is `0` for a given problem when `integrate` is successful in identifying an antiderivative, in which case `solved` is the answer. The value of `err` is a bound on the numerical error introduced by the algorithm.


::: {.callout-note}
### This is currently broken

The following isn't working with `SymbolicNumericIntegration` version `v"1.4.0"`. For now, the cells are not evaluated.

:::

To see, we have:


```{julia}
#| eval: false
using SymbolicNumericIntegration
@variables x
Expand All @@ -852,6 +860,7 @@ The second term is `0`, as this integrand has an identified antiderivative.


```{julia}
#| eval: false
integrate(exp(x^2) + sin(x))
```

Expand All @@ -862,13 +871,15 @@ Powers of trig functions have antiderivatives, as can be deduced using integrati


```{julia}
#| eval: false
u,v,w = integrate(sin(x)^5)
```

The derivative of `u` matches up to some numeric tolerance:


```{julia}
#| eval: false
Symbolics.derivative(u, x) - sin(x)^5
```

Expand All @@ -879,6 +890,7 @@ The integration of rational functions (ratios of polynomials) can be done algori


```{julia}
#| eval: false
import SymbolicNumericIntegration: factor_rational
@variables x
u = (1 + x + x^2)/ (x^2 -2x + 1)
Expand All @@ -889,13 +901,15 @@ The summands in `v` are each integrable. We can see that `v` is a reexpression t


```{julia}
#| eval: false
simplify(u - v)
```

The algorithm is numeric, not symbolic. This can be seen in these two factorizations:


```{julia}
#| eval: false
u = 1 / expand((x^2-1)*(x-2)^2)
v = factor_rational(u)
```
Expand All @@ -904,6 +918,7 @@ or


```{julia}
#| eval: false
u = 1 / expand((x^2+1)*(x-2)^2)
v = factor_rational(u)
```
Expand Down
1 change: 1 addition & 0 deletions quarto/derivatives/newtons_method.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ For the function $f(x) = \cos(x) - x$, we see that SymPy can not solve symbolica


```{julia}
#| error: true
@syms x::real
solve(cos(x) - x, x)
```
Expand Down
6 changes: 5 additions & 1 deletion quarto/differentiable_vector_calculus/plots_plotting.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ We can parameterize the sphere by plotting values for $x$, $y$, and $z$ produced


```{julia}
#| hold: true
#| eval: false
thetas = range(0, stop=pi, length=50)
phis = range(0, stop=pi/2, length=50)
Expand All @@ -379,6 +379,7 @@ For convenience, the `plot_parametric` function from `CalculusWithJulia` can pro


```{julia}
#| eval: false
#| hold: true
F(theta, phi) = [X(1, theta, phi), Y(1, theta, phi), Z(1, theta, phi)]
plot_parametric(0..pi, 0..pi/2, F)
Expand All @@ -401,6 +402,7 @@ $$
To illustrate, we have:

```{julia}
#| eval: false
# cf. https://discourse.julialang.org/t/general-plotting-code-for-cone-in-3d-with-glmakie-or-plots/92104/3
basecurve(u) = [cos(u), sin(u) + sin(u/2), 0]
Expand All @@ -419,6 +421,7 @@ To use it, we see what happens when a sphere if rendered:


```{julia}
#| eval: false
#| hold: true
f(x,y,z) = x^2 + y^2 + z^2 - 25
CalculusWithJulia.plot_implicit_surface(f)
Expand All @@ -428,6 +431,7 @@ This figure comes from a February 14, 2019 article in the [New York Times](https


```{julia}
#| eval: false
#| hold: true
a,b = 1,3
f(x,y,z) = (x^2+((1+b)*y)^2+z^2-1)^3-x^2*z^3-a*y^2*z^3
Expand Down
Loading

0 comments on commit 5866fa9

Please sign in to comment.