equation

Storing formula (equations) in database to be evaluated later (SQL Server 2005)

家住魔仙堡 提交于 2019-11-28 11:40:57
I'm calculating linear regressions based on a data set. I do not know the regression model or number of parameters at compile-time. I'm storing the regression equation in a SQL Server 2005 database as the string y = 3x^2 + 2x // just an example When I need to make a prediction, I grab the equation from the database, substitue x with the value I'm predicting, and use NCalc to evaluate the resulting string. That method seems to work OK, but I'm wondering if there's a better way or a built-in feature of SQL Server that I've missed that would allow me to do these calculations on the database side

R expression results in NaN for no obvious reason [duplicate]

荒凉一梦 提交于 2019-11-28 10:08:59
问题 This question already has an answer here: How to calculate any negative number to the power of some fraction in R? 2 answers How can it be that the expression > (exp(17.118708 + 4.491715 * -2)/-67.421587)^(-67.421587) results in [1] NaN while > -50.61828^(-67.421587) which should basically have the same outcome, gives me [1] -1.238487e-115 This is driving me crazy, I spent hours searching for the Error. "-2", in this case, is a Parameter of the function. I really can't think of a solution.

C# dll to solve simple equation

↘锁芯ラ 提交于 2019-11-28 04:22:08
问题 I am looking for a C# dll to solve simple equation. Example .. 10 = 2 + 3 + x Result should be x = 5; Is there a free DLL? 回答1: I've used this Math Expression Parsing library with positive results. The documentation he's provided was very useful to boot. http://www.codeproject.com/KB/recipes/MathieuMathParser.aspx?display=Print Your app can then accommodate ad hoc equations which the library will parse into component parts. You can then provide the values for required variables and it will

User input string equation, converted to an int answer C#

天涯浪子 提交于 2019-11-28 02:27:23
Int answer; String equation = Console.ReadLine(); Console.writeLine("your equation is {0}", equation); How do I convert the string into a solvable equation? Take a look at NCalc - Mathematical Expressions Evaluator for .NET It'll let you do this sort of thing: var inputString = "2 + 3 * 5"; Expression e = new Expression(inputString); var result = e.Evaluate(); eval.js: package BLUEPIXY { class Math { static public function Evaluate(exp : String) : double { return eval(exp); } } } compile to eval.dll >jsc /t:library eval.js calc.cs: using System; using System.Text.RegularExpressions; class Calc

Safely evaluate simple string equation

余生长醉 提交于 2019-11-27 23:21:57
I'm writing a program in which an equation is inputted as a string, then evaluated. So far, I've come up with this: test_24_string = str(input("Enter your answer: ")) test_24 = eval(test_24_string) I need both a string version of this equation and an evaluated version. However, eval is a very dangerous function. Using int() doesn't work, though, because it's an equation. Is there a Python function that will evaluate a mathematical expression from a string, as if inputting a number? One way would be to use numexpr . It's mostly a module for optimizing (and multithreading) numpy operations but

Looking for a self-contained equation rendering library [closed]

隐身守侯 提交于 2019-11-27 20:49:41
问题 Is there such a thing as a small, self-contained library that will render an equation written in a text-based format (e.g. LaTeX or MathML) to an image (either vector or raster)? It would be preferable if it's in Python or Python-friendly. (One possibility that I've found: Matplotlib has Python code to parse and display LaTeX equations, using gl2ps. If I don't find anything else it seems possible to extract all the relevant bits into a separate library.) EDIT: by "self-contained" I mean they

Mathematical equation manipulation in Python

那年仲夏 提交于 2019-11-27 19:52:37
I want to develop a GUI application which displays a given mathematical equation. When you click upon a particular variable in the equation to signify that it is the unknown variable ie., to be calculated, the equation transforms itself to evaluate the required unknown variable. For example: a = (b+c*d)/e Let us suppose that I click upon "d" to signify that it is the unknown variable. Then the equation should be re-structured to: d = (a*e - b)/c As of now, I just want to know how I can go about rearranging the given equation based on user input. One suggestion I got from my brother was to use

Storing formula (equations) in database to be evaluated later (SQL Server 2005)

偶尔善良 提交于 2019-11-27 19:21:40
问题 I'm calculating linear regressions based on a data set. I do not know the regression model or number of parameters at compile-time. I'm storing the regression equation in a SQL Server 2005 database as the string y = 3x^2 + 2x // just an example When I need to make a prediction, I grab the equation from the database, substitue x with the value I'm predicting, and use NCalc to evaluate the resulting string. That method seems to work OK, but I'm wondering if there's a better way or a built-in

Math equations on the web

杀马特。学长 韩版系。学妹 提交于 2019-11-27 17:12:54
How can I render Math equations on the web? I am already familiar with LaTeX's Math mode. It turns out this is a bit of a pain. You can use MathML , but browser support is still iffy. If you are starting with latex you've got a few options for converting to html, but they'll all typically end up rendering the actual equations to images and inlining those. Nothings all that pretty (unless you resort to pdf or something). What's best will depend a bit on what sort of content, how many equations, and how complicated the equations are. Here is a decent summary. Colonel Panic The other answers are

Typesetting LaTeX fraction terms to be larger in an equation

旧巷老猫 提交于 2019-11-27 16:15:13
问题 I have the following formula in LaTeX, based on Fisher's Exact Test. ( NOTE : requires the use of the amsmath package for \binom .) \begin{equation} P(i,j) = \sum_{x=|N(V_i) \cap V_j|}^{\min\{|V_j|, |N(V_i)|} \frac{ \binom{|V_j|}{x} \binom{|V - V_j|}{|N(V_i)| - x}} {\binom{|V|}{|N(V_i)|}} \end{equation} This renders the fraction portion with very small, difficult to read text: I would like my text more readable, as in the following example: equation with readable text in fraction http://www