Comments (2)
Thanks for reaching out and for your question! I'm not sure the following answers the question, so I'll try to guide you through the code, and indicate where you can modify something.
sqrt(::Taylor1)
executes this line. The first code block checks where the first non-zero coefficient of the Taylor1 polynomial is located; that is actually where the error is thrown, since for t=Taylor1(5)
the first non-zero coefficient in this case is odd. The reason to distinguish odd and even first non-zero coefficients is, essentially, to be able to factor an expression of the form
The next code block computes order by order the Taylor expansion. It uses sqrt!
to update (modify in place) the Taylor coefficient of order k
of c
, which is the returned result. sqrt!
is coded here, and you can check the docstrings here or in the REPL (? TaylorSeries.sqrt!
). The function essentially implements the relevant formula (which does not appear properly displayed as it should in the documentation).
Let me point out that sqrt!
throws no error, that sqrt(::Taylor1)
computes the 0-th order coefficient separatelly, and that the rest of the coefficients are computed using sqrt!
. So, if you want to code your own mysqrt
, you should perhaps compute the Taylor expansion using sqrt!
directly, including the first non-zero coefficient. Be aware that Inf
s and NaN
s may propagate in the series, because the computation is recursive. This means that mysqrt(t)
may return something like Inf t - Inf t² + Inf t³ - Inf t⁴ + Inf t⁵ + 𝒪(t⁶)
.
I hope this is useful for your application.
from taylorseries.jl.
Closing. Feel free to reopen this issue if you want further explanations..
from taylorseries.jl.
Related Issues (20)
- Upcoming `lu` issue on nightly HOT 7
- Missing division method `HomogeneousPolynomial`
- Implement special functions: erf, erfc, etc. HOT 4
- Should `AbstractSeries` be `<:Real` instead of `<:Number`? HOT 6
- !(iszero(constant_term(b))) HOT 2
- abs2 incorrectly defined for Taylor{Complex{T}} HOT 4
- `lu(A::AbstractMatrix{Taylor1{T}})` method not properly inferred in Julia v1.8 HOT 9
- Stange behaviour when Taylor1 pass to Taylor1 constructor. HOT 2
- Support for Implicitly defined functions HOT 2
- Matrix element type for `A*A'` HOT 2
- Taylor1 with empty vector HOT 1
- order of the remainder HOT 1
- Implementation for log1p? HOT 3
- Implement cospi and sinpi HOT 6
- `x^(3/4)` fails when x==0 but not when 0 \in x HOT 5
- Include offset in struct definition HOT 5
- Compatibility with Multi-Threading HOT 3
- Broaden the applicability of `NumberNotSeries`
- Address ordering for nested `Taylor1`s
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from taylorseries.jl.