I was working out the details of functions like sqrt, atan and log for my implementation of the Levi-Civita field.

I thought I'd mention a technique that's available for these quantities that doesn't work as well for ordinary reals. For my example this isn't meant to be the most efficient method, just an illustration of the approach.

Consider f(x)=1/√(1+x) for infinitesimal x. We could just use the Taylor series. For infinitesimal x it will always converge in the Levi-Civita field. (We can also use Newton-Raphson and I think there's also a direct back substitution method.)

Here's another way:

We have f'(x)=-x^(3/2)/2 = -f(x)^2/2. This is an ODE for f. We can rewrite this as an integral equation:

f(x) = 1-(1/2)∫f(x)^3 dx where the integral is on [0,1].

This looks useless, but...

When working in Haskell I make the elements of the LC field streams of (power,coefficient) pairs. Haskell is happy for you to write a circular definition of a stream as long as when you evaluate the nth element you only use the first n-1 elements. It looks like recursion but for an infinite stream there's no base case so technically it's a corecursion.

Now define a linear partial function on the Levi-Civita field "∫" that maps ε^n to ε^(n+1)/(n+1).

This has the property that if a is real and b is finite, computing the nth element of a+∫b requires looking at only the first n-1 elements of b. So the equation

f(x) = 1-(1/2)∫f(x)^3 dx

can be translated directly into Haskell.

Many interesting functions have ODEs, and hence integral equations that can be exploited like this.

FWIW the actual line of code I tested was:

y = 1 +∫ ((-1 / 2) * d v * y * y * y)

where "+∫" (and d) are functions I define elsewhere.

@dpiponi Wait, you're on mathstodon.xyz but not taking advantage of TeX math formatting? I thought it was the main selling point.

@theohonohan It was for me until I realized it locks out people following from other servers.

@dpiponi @theohonohan what do you mean with “locks out”? Does it actually blocks ppl from reading your post? From all other servers or does it just depends on servers?

@KodeGhinn -
people from other servers just see the source code, not the pretty math. Like this:

$$ \frac{1}{\sqrt{\int_{-\infty}^\infty e^{-x^2} \, dx}} = \pi^{-1/4} $$

@dpiponi @theohonohan

@johncarlosbaez @dpiponi @theohonohan another of the many things Mastodon needs fixing

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.