Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>There is nothing impossible. Just write new class with regex inside with your programming language and define new syntax. It will be your personal regular expression syntax. For example, like:</p> <pre><code>result = latex_string.match("p'(x,y,z)", "full"); // match dp/dx, dp/dy, dp/dz result = latex_string_array.match("p'(x,y,z)", "partial"); // match ∂p/∂x, ∂p/∂y, ∂p/∂z . . . </code></pre> <p>The method <code>match</code> will treat new, pseudo-regular expression inside the your class and will return the result in desirable form. You can simply make input definition as a string and/or array form. Actually, if some function have to be matched by all derivatives, you must simplify search notation to <code>.match("p'")</code>. </p> <p>One simple notice:</p> <p><img src="https://i.stack.imgur.com/lpF7k.png" alt="latex equation">,</p> <p>have source: <code>\mathrm{d}y=\frac{\mathrm{d}y}{\mathrm{d}t}\mathrm{d}t</code>, and:</p> <p><img src="https://i.stack.imgur.com/HjkVH.png" alt="latex equation">,</p> <p><code>dy=\frac{dy}{dt}dt</code>, and finally:</p> <p><img src="https://i.stack.imgur.com/okwc3.png" alt="latex equation">,</p> <p>is <code>dy=(dy/dt)dt</code></p> <p>The problem of generalization for latex equations meaning with regular expressions is human input factor. It is just a notation and author can select various manners of input.</p> <p>The best and precise way is to analysis of formula content and creation a computation three. In this case, you will search not just notations of differentials or derivatives, but instructions to calculate differentials and derivatives, but anyway it is connected with detailed analysis of the formula string with multiple cases of writing manners.</p> <p>One more thing, and good news for you! It's not necessary to define magic regex-latex multibyte letter greek alphabet. UTF-8 have <code>ρ - GREEK SMALL LETTER RHO</code> you can use in UI, but in search method treat it as <code>\rho</code>, and use simply <code>/\\frac{d\\rho}{dx}/</code> regex notation.</p> <p><strong>One more example:</strong></p> <p><img src="https://i.stack.imgur.com/1IS1Z.png" alt="enter image description here"></p> <pre><code>// search string equation = "dU= \left(\frac{\partial U}{\partial S}\right)_{V,\{N_i\}}dS+ \left(\frac{\partial U}{\partial V}\right)_{S,\{N_i\}}dV+ \sum_i\left(\frac{\partial U}{\partial N_i}\right)_{S,V,\{N_{j \ne i}\}}dN_i"; . . . // user input by UI . . . // call method equation.equation_match("U'");// example notation for all types of derivatives for all variables . . . // inside the 'equation_match' method you will use native regex methods matches1 = equation.match(/dU/); // dU matches2 = equation.match(/\\partial U/); // ∂U etc. return(matches);// combination of matches </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload