Enabling Mathematical Search inside Wolfram Mathematica

Flavio B. Gonzaga, SearchOnMath

(RowDefault[, (Spacer1), , (Spacer1), ])  #WolframTechConf

ABSTRACT

SearchOnMath is a search engine specialized in formulas and text from several domains with math content. The web version indexes domains like Wolfram MathWorld, Stack Exchange (Math, Physics, and MathOverflow), Wikipedia, and others. The scientific version indexes preprints from arXiv, allowing users to submit queries and filter results by year, author, and/or area of knowledge.

The SearchOnMath core is mainly composed of two parts:
(i) Lexical analysis, which makes representation independent of notation. For example, variables can be denoted by Roman letters (x, y, z, x_0, x_1, …), Greek letters (α, β, …), and so on.
(ii) Degree of similarity analysis, using a powerful engine to compare the structure of the target formula with that of all other formulas in the database. Formulas that are more similar in structure tend to appear first on the results page.

This presentation shows a detailed view of SearchOnMath, including the ability to search arXiv preprints. It also shows how to integrate the SearchOnMath API into Wolfram Mathematica, including access to all features available on the SearchOnMath website. This integration enables countless possibilities, such as instantly searching from inside a Mathematica notebook all the main websites of mathematical content as well as all of arXiv.

SearchOnMath - a brief history

• The SearchOnMath project began in August 2008 as part of my PhD work at the Federal University of Rio de Janeiro.

• In March 2013, I finished my doctorate and the first version of SearchOnMath was released.

• In 2015 SearchOnMath became an incubated start-up at NidusTec, the business incubator of Federal University of Alfenas.

• In 2021 SearchOnMath became part of the AWS EdStart program, and the first version indexing the arXiv base was released.

SearchOnMath functionalities

Performing a search through the website

• When visiting SearchOnMath, users can choose between using the web index and using the scientific index.
• The web index is available at searchonmath.com, while the scientific index is available at searchonmath.com/arxiv.

* Queries may include text and/or math formulas in LaTeX format.
** Formulas must be enclosed between the \( and \) delimiters.

Analyzing the results page

• Results are ordered first by formula similarity, then by textual content.
• Similarity decreases as long as SearchOnMath identifies the need for replacing symbols. 
• For example, a user searching for

sin(x)

will receive results containing sin(x) better ranked than results containing sin(y).

SearchOnMath functionalities

The scientific version

• When using the scientific version, users can filter by year, author, or area.
• The available areas are the same defined by arXiv.

The SearchOnMath API

Specifications

• The SearchOnMath API is available at
https://www.searchonmath.com/webservice/api.
• The main parameters are listed bellow. A complete list is available at searchonmath.com/doc.

* By default, SearchOnMath will consider all domains included in its web index.
* To submit a query to the scientific index, the domains parameter must have the value x.

The SearchOnMath API

Some examples... receiving the results in JSON format

• Using the web index:

somMessage=Import["https://www.searchonmath.com/webservice/api?query="<>URLEncode["The Taylor series \\(f(x) = \\sum_{k=0}^{\\infty} \\frac{f^{(k)}(a)}{k!} \\, (x-a)^{k}\\)"]<>"&page=1&user="<>URLEncode["fbgonzaga@gmail.com"]<>"&key="<>URLEncode["77+9O++/ve+/ve+/vR8u77+9Pe+/ve+/ve+/vRAZcO+/vQ=="],"RawJSON"]

• Using the scientific index:

somMessage=Import["https://www.searchonmath.com/webservice/api?query="<>URLEncode["Taylor series \\(f(x) = \\sum_{k=0}^{\\infty} \\frac{f^{(k)}(a)}{k!} \\, (x-a)^{k}\\)"]<>"&page=1&user="<>URLEncode["fbgonzaga@gmail.com"]<>"&key="<>URLEncode["77+9O++/ve+/ve+/vR8u77+9Pe+/ve+/ve+/vRAZcO+/vQ=="]<>"&domains=x","RawJSON"]

The SearchOnMath API

Formatting the results

somQuery[query_String]:=Module[{somMessage=Import["https://www.searchonmath.com/webservice/api?query="<>URLEncode[query]<>"&page=1&user="<>URLEncode["fbgonzaga@gmail.com"]<>"&key="<>URLEncode["77+9O++/ve+/ve+/vR8u77+9Pe+/ve+/ve+/vRAZcO+/vQ=="],"RawJSON"]},CellPrint[TextCell[Column[{Hyperlink[Style[#["title"],FontColor->Blue,Underlined],#["url"]],Style[#["sch"],FontWeight->Bold],StringReplace[StringReplace[#["abst"],RegularExpression["(<b><u>(.+?)</u></b>)"]:>"\!\(\*StyleBox[\"$2\",FontColor->RGBColor[1,0.5,0]]\)"],RegularExpression["(<mark>.+?</mark>)"]->Style[ToExpression[#["equation"],TeXForm,HoldForm],FontColor->Orange]],Graphics[{Orange,Line[{{0,0},{10,0}}]}]}],"Text",ShowStringCharacters->False,FontSize->18,FontColor->Black]&/@somMessage["result"]]]

somQuery["The Taylor series \\(f(x) = \\sum_{k=0}^{\\infty} \\frac{f^{(k)}(a)}{k!} \\, (x-a)^{k}\\)"]

({{(HyperlinkURL["What is the Taylor series of e^((-x)^2)?", https://socratic.org/questions/what-is-the-taylor-series-of-e-x-2])}, {"Socratic"}, {"...Calculus Power Series Constructing a \!\(\*StyleBox[\"Taylor\",FontColor->RGBColor[1,0.5,0]]\) Series ↳Redirected from \"What is an example of an Ideal gas law practice problem?\" 1 Answer Shura May 12, 2015 \!\(\*StyleBox[\"The\",FontColor->RGBColor[1,0.5,0]]\) answer, when \\(a=0\\) , is : \\(f(x)=sum_{k=0}^inftyx^(2k)/(k!)\\) \!\(\*StyleBox[\"The\",FontColor->RGBColor[1,0.5,0]]\) \!\(\*StyleBox[\"Taylor\",FontColor->RGBColor[1,0.5,0]]\) \!\(\*StyleBox[\"series\",FontColor->RGBColor[1,0.5,0]]\) is given by : "~~f[x]==((s u (Subscript[m, k==0]^i) n f t y (f^k)[a] (((x-a))^k))/(k!))~~" . We know that the \!\(\*StyleBox[\"Taylor\",FontColor->RGBColor[1,0.5,0]]\) \!\(\*StyleBox[\"series\",FontColor->RGBColor[1,0.5,0]]\) of \\(e^(x)\\) , when \\(a=0\\) , is : \\(f(x)=sum_{k=0}^inftyx^(k)/(k!)\\) So now, we just need to replace the \\(x\\) of the above \!\(\*StyleBox[\"series\",FontColor->RGBColor[1,0.5,0]]\) with \\((-x)^(2)\\) (in op..."}, {}})

({{(HyperlinkURL["How to compute power series by composition", https://math.stackexchange.com/questions/867976/how-to-compute-power-series-by-composition#comment-1789576])}, {"StackExchange Math"}, {"...Tha \!\(\*StyleBox[\"Taylor\",FontColor->RGBColor[1,0.5,0]]\) \!\(\*StyleBox[\"series\",FontColor->RGBColor[1,0.5,0]]\) for \\(f(x)\\) at \\(a\\) is the \!\(\*StyleBox[\"Taylor\",FontColor->RGBColor[1,0.5,0]]\) \!\(\*StyleBox[\"series\",FontColor->RGBColor[1,0.5,0]]\) of \\(f(y+a)\\) at \\(y=0\\) , then substituting \\(y=x-a\\) . So: "~~f[x]==(∑_(k=0)^∞)(((f^k)[a] (((x-a))^k))/(k!))~~" See [Wikipedia definition](http://en.wikipedia.org/wiki/Taylor_series#Definition)..."}, {}})

({{(HyperlinkURL["Difference between Taylor's theorem and Taylor's series?", https://math.stackexchange.com/questions/2665793/difference-between-taylor%27s-theorem-and-taylor%27s-series%3F#answer-2665894])}, {"StackExchange Math"}, {"...\\(f(x) \\approx\\hbox{ a polynomial.}\\) Why this is important? Because polynomials are calculable. If \\(f\\) is \\(C^\\infty\\) , you can write the \!\(\*StyleBox[\"Taylor\",FontColor->RGBColor[1,0.5,0]]\) \!\(\*StyleBox[\"series\",FontColor->RGBColor[1,0.5,0]]\) \\(\\sum_{k=0}^\\infty\\frac{f^{(k)}(a)}{k!}(x - a)^k,\\) but "~~f[x]==(∑_(k=0)^∞)(((f^k)[a] (((x-a))^k))/(k!))~~" can be false. When is true (this depends obviously of the behavior of the remainder) we say that the function is analytic. But being \\(C^\\infty\\) isn't enough. \!\(\*StyleBox[\"The\",FontColor->RGBColor[1,0.5,0]]\) function \\(f(x) = e^{-1/x^2}\\) for \\(x\\ne 0\\) , \\(f(0) = 0\\)..."}, {}})

({{(HyperlinkURL["Deriving fourier series using complex numbers - introduction", https://math.stackexchange.com/questions/71593/deriving-fourier-series-using-complex-numbers---introduction#answer-71598])}, {"StackExchange Math"}, {"...\\((a_n+ib_n)(\\cos(nt)+i\\sin(nt))+(a_n-ib_n)(\\cos(nt)-i\\sin(nt)) = 2a_n\\cos(nt)-2b_n\\sin(nt)\\) So dealing with trig functions or exponentials is just a matter of notation/taste. Now to address your question as to what these \!\(\*StyleBox[\"series\",FontColor->RGBColor[1,0.5,0]]\) are for... Recall that an analytic function is equal to its \!\(\*StyleBox[\"Taylor\",FontColor->RGBColor[1,0.5,0]]\) series: "~~f[x]==(∑_(k=0)^∞)(((f^k)[a] (((x-a))^k))/(k!))~~" If we stop this sum, say at \\(N\\) , we have \\(f(x) \\approx \\sum\\limits_{k=0}^N \\frac{f^{(k)}(a)}{k!}(x-a)^k\\) which is a polynomial approximation of \\(f(x)\\) . Polynomials are nice. \!\(\*StyleBox[\"Taylor\",FontColor->RGBColor[1,0.5,0]]\) polynomials give us easily understood ap..."}, {}})

({{(HyperlinkURL["Why is the Taylor expansion of $\\sin(z)$ about $z_{0}=-j$ different from what I expect?", https://math.stackexchange.com/questions/1213255/why-is-the-taylor-expansion-of-%24%5Csin%28z%29%24-about-%24z_%7B0%7D%3D-j%24-different-from-what-i-expect%3F#answer-1213261])}, {"StackExchange Math"}, {"...When you create a taylor \!\(\*StyleBox[\"series\",FontColor->RGBColor[1,0.5,0]]\) centered about \\(a\\) , you use the formula: "~~f[x]==(∑_(k=0)^∞)(((f^k)[a] (((x-a))^k))/(k!))~~" This means that you have to consider what \\(\\sin^{(k)}(-j)\\) is as opposed to just plugging \\(-j\\) into the \!\(\*StyleBox[\"series\",FontColor->RGBColor[1,0.5,0]]\) for \\(\\sin(x)\\) \!\(\*StyleBox[\"The\",FontColor->RGBColor[1,0.5,0]]\) reason there are two \!\(\*StyleBox[\"series\",FontColor->RGBColor[1,0.5,0]]\) is because for even values of \\(k\\) the \\(k\\)..."}, {}})

({{(HyperlinkURL["Taylor series with a base point different from $0$", https://math.stackexchange.com/questions/3027162/taylor-series-with-a-base-point-different-from-%240%24])}, {"StackExchange Math"}, {"...Taylor \!\(\*StyleBox[\"series\",FontColor->RGBColor[1,0.5,0]]\) with a base point different from \\(0\\) What's the need for "~~f[x]==(∑_(k=0)^∞)(((f^k)[a] (((x-a))^k))/(k!))~~" if we already have the formula at \\(0\\) ? Isn't the \\((x-a)\\) just making the \\(a\\) as the new origin? When is this formula more useful than that at \\(0\\) ..."}, {}})

({{(HyperlinkURL["Why does the error term in Taylor's Theorem converge to Zero (in two senses)?", https://math.stackexchange.com/questions/1901632/why-does-the-error-term-in-taylor%27s-theorem-converge-to-zero-%28in-two-senses%29%3F])}, {"StackExchange Math"}, {"...mainder term converge to \\(0\\) ? In particular, why do we have that \\(\\lim_{x \\to a} h_k(x) = 0\\) as well as that \\(\\lim_{k \\to\\infty} h_k(x) = 0?\\) If I understood this last statement, in particular, then I would understand why "~~f[x]==(∑_(k=0)^∞)(((f^k)[a] (((x-a))^k))/(k!))~~" which has also been a source of confusion for me..."}, {}})

({{(HyperlinkURL["Binomial theorem for non integers ? O_o ??", https://math.stackexchange.com/questions/640895/binomial-theorem-for-non-integers-%3F-o_o-%3F%3F#answer-2397474])}, {"StackExchange Math"}, {"...The generalized binomial theorem is actually a special case of Taylor's theorem, which states that "~~f[x]==(∑_(k=0)^∞)(((f^k)[a] (((x-a))^k))/(k!))~~" Where \\(f^{(k)}(a)\\) is the \\(k\\) th derivative centered at \\(a\\) . In particular if we have \\(f(x)=x^t\\) , note that \\(f'(x)=tx^{t-1}\\\\ f''(x)=t(t-1)x^{t-2}\\\\ \\vdots\\\\ f^{(k)}(x)=t(t-1)(t-2)\\dots(t-k+1)x^{t-k}\\)..."}, {}})

({{(HyperlinkURL["Evaluate the sum of the Series", https://math.stackexchange.com/questions/1987957/evaluate-the-sum-of-the-series#answer-1987991])}, {"StackExchange Math"}, {"...\\(f(x)\\) is analytic, assuming it converges for some \\(x\\) with radius of convergence greater than \\(0\\) . According to Taylor's theorem, we then have \\(f(0)=a_0\\\\ f'(0)=a_1\\\\ f''(0)=2a_2\\\\ f'''(0)=6a_3\\) More generally, we have "~~f[x]==(∑_(k=0)^∞)(((f^k)[a] (((x-a))^k))/(k!))~~" where \\(f^{(n)}(x)\\) is the \\(n^{\\text{th}}\\) derivative of \\(f\\) ..."}, {}})

({{(HyperlinkURL["Question Regarding The Power Series For $e^x$", https://math.stackexchange.com/questions/93868/question-regarding-the-power-series-for-%24e%5Ex%24#answer-93872])}, {"StackExchange Math"}, {"...The power \!\(\*StyleBox[\"series\",FontColor->RGBColor[1,0.5,0]]\) you wrote down is the \!\(\*StyleBox[\"Taylor\",FontColor->RGBColor[1,0.5,0]]\) \!\(\*StyleBox[\"series\",FontColor->RGBColor[1,0.5,0]]\) of \\(e^x\\) at \\(a=0\\) . Recall that the \!\(\*StyleBox[\"Taylor\",FontColor->RGBColor[1,0.5,0]]\) \!\(\*StyleBox[\"series\",FontColor->RGBColor[1,0.5,0]]\) of a function \\(f(x)\\) at \\(a\\) is given by "~~$Failed~~" Now if \\(f(x)=e^x\\) and \\(a=0\\) , we have \\(f^{(k)}(0)=e^x\\big|_{x=0}=1\\) . This implies that the \!\(\*StyleBox[\"Taylor\",FontColor->RGBColor[1,0.5,0]]\) \!\(\*StyleBox[\"series\",FontColor->RGBColor[1,0.5,0]]\) of \\(e^x\\) at \\(0\\) is given by \\(e^x=\\sum_{k=0}^\\infty\\frac{1}{k!}x^k=1 + x + \\frac{x^2}{2!} + \\frac{x^3}{3!} + \\frac{x^4}{4!} + ...\\)..."}, {}})

Enabling Mathematical Search inside Wolfram Mathematica

Flavio B. Gonzaga, SearchOnMath
flavio@searchonmath.com
Thank you!

(RowDefault[, (Spacer1), , (Spacer1), ])  #WolframTechConf