Is there any package / method / function to determine and Solve Limits Problem in Julia?

Hi all,

I was thinking plotting the graph is a nice solution to know a limit of a function, I have this problem from Calculus book:

\lim_{\theta \rightarrow 0} \frac{\sin^{2} \theta}{\theta^{2}}

(I think by hand we can try to do some tricks using trigonometric identities, etc to make a simpler form, how about by computer / by Julia? Can we perform the algebraic substitution to make a simpler form to solve limits problem? Like performing Gaussian elimination step by step with Julia )

I read this:

From @j_verzani there is the code:

g(x) = x^2 + 1 + log(abs( 11*x-15 ))/99
g (generic function with 1 method)

julia> limit(g, 15//11)

And from this site:

(still from the same author Verzani)

The code to calculate limit is:

f(x) = (1 - cos(x))/x^2
xs = [ (1/10)^i for i in 1:10 ];
ys = map(f, xs);
[xs ys]

I don’t really know which one to use (the code) to gain better understanding in limits concept, or is there a new package or method to calculate limit? not only to infinity, limit to 0 or to certain real numbers.

The book said Calculus is the Study of Limits. Haha.

Thanks all.

I would say that computers are not the right tool to enhance the understanding of the concept of limits. One reason for this is that there is no general way of “calculating” limits. Furthermore, the space of Floats is not a complete metric space.
What I mean by this is that there will always be an example where the plotting approach fails because of the finiteness of floating point numbers. (Plotting always depicts the function on a finite set of points)
If we look at your first example, the plot would suggest that the limit is 1. But are we sure? Luckily in this example it is quite easy to prove (L'HĂ´pital's rule - Wikipedia).
Hopefully, I understood your question correctly and manged to convey the message that plotting to get insights is helpul, but to be sure that a limit is correct a formal proof is needed.


Yes I believe that we as human, if we manage to enhance and maximize our brain capacity and potential can still beat current computers to enhance the science not only in limit and calculus field.

Computers and Julia(for example) as programming language are only helping tools to calculate fast, plotting, modelling, designing. But the one create, code Julia are still human till now.

Can AI really be smarter than human? Well, if AI can finish all problems in Calculus book with the steps by steps (proofing, plotting, etc) and finishing time within 10 seconds, then there might be different scenario for human.

I already got the code to calculate limit here:

using SymPy

f(x) = sin.(4x)/tan.(x)
g(x) = sin.(3x)/x
h(x) = (1-cos.(x))/sin.(x)

i(x) = tan.(2x)/(sin.(2x) - 1)
j(x) = (sin.(3x) + 4x)/(x*sec.(x))
k(x) =  (sin.(x)^2)/(x^(2))


just change the g in the limit(g,0)

is such a package, see the examples section for an example on sin(x) /x

I still think one has to understand the math behind these tools before you should use them.
Consider for example

using SymPy

In this case SymPy will tell you that the limit is -\infty. But this limit does not exists.

I plot it, is it an aysmptote like tan function? What is the different between infinity limit and does not exist? People who is not experienced in rigorous Math will think they are the same.

\lim_{x \rightarrow 1} \frac{1}{(x-1)^{2}} = \infty

Often wikipedia is not a particularly good reference for math, but to get an idea it might be helpful:

Basically, in order for a limit to exist, comming from the left and from the right has to yield the same result.
A limit does not need to exist, e.g., \lim_{x\rightarrow 0} \sin(\frac{1}{x}). Around 0 it oscillates so fast that you can’t tell whether it should be 1 or -1. If a limit exists and happen to be \infty it still exists.

1 Like

This is more an issue with the default setting of SymPy (right limits) being different from the expectation from a calculus classroom. You can pass dir="+-" to see what SymPy returns for a two-sided limit.

I know. I just wanted to demonstrate that using these kind of tool without the basic understanding of the underlying math could lead to mistakes.