equation

karplus equation in gnuplot

余生长醉 提交于 2019-12-24 04:31:53
问题 I want plot karplus equation f(t)=a*cos(t+o)**2 + b*cos(t+o) + c with gnuplot for different value of a, b, c, o values. In particular the parameters a, b, c, o have tabular form (in file data.dat): a b c o 1 2 3 60 4 5 6 180 -3 -5 -9 -120 and t has range from -180 to 180 for each row in data.dat file. Can you help me? Thanks everyone. Lucio 回答1: AFAIK it is not possible to have a "parameter file" with different parameters to plot in a function since the plot command can either take a function

How can you solve equations in PHP?

耗尽温柔 提交于 2019-12-23 17:37:41
问题 I'm looking for a generalized equation solver in PHP. This could either be in the form of in-built functionality, a library, or even integration with another language if it comes to it. I am even comfortable with a joint solution that involves some combination of the above. I need this for an educational website on which I am working. Let me give a series of equations that I would ideally expect such a solver to deal with: x+5=8 => x=3 x^2=5 => x=+/-sqrt(5) [exact solution in terms of sqrt,

Integral solution to equation `a + bx = c + dy`

a 夏天 提交于 2019-12-23 09:17:16
问题 In the equation a + bx = c + dy , all variables are integers. a , b , c , and d are known. How do I find integral solutions for x and y ? If I'm thinking right, there will be an infinite number of solutions, separated by the lowest common multiple of b and d , but all I need is one solution, and I can calculate the rest. Here's an example: a = 2 b = 3 c = 4 d = 5 a + bx: (2, 5, 8, 11, 14) c + dy: (4, 9, 14, 19, 24) a + bx intersects c + dy at 14, so: x = 4 y = 2 Right now, I'm looping through

Solving simultaneous equations in Sage

萝らか妹 提交于 2019-12-23 04:26:42
问题 In Sage (using the Sage terminal in Sage Cloud), I expected the following to yield the result [t == (1/2)] . However, it yields the result [] . sage: var('x1 y1 x2 y2 t') (x1, y1, x2, y2, t) sage: eq1 = x1==t sage: eq2 = y1==t sage: eq3 = x2==t sage: eq4 = y2==1-t sage: solve([eq1,eq2,eq3,eq4,x1==x2,y1==y2],t) [] The following reformulation doesn't help: sage: eq5 = x1==x2 sage: eq6 = y1==y2 sage: solve([eq1,eq2,eq3,eq4,eq5,eq6],t) [] Where am I going wrong? 回答1: If you write solve([eq1,eq2

Creating a function that takes an equation given as a string and computes it [duplicate]

被刻印的时光 ゝ 提交于 2019-12-23 02:20:47
问题 This question already has answers here : Evaluating a mathematical expression in a string (11 answers) Closed 4 years ago . As part of an assignment, I am creating a function that takes in a string, which is an equation. here is an example of one: 48+6x6/3=6x8-9x2. The compute function takes one side of the equal sign and evaluates it. I am not too concerned with splitting the equation. I believe I can just slice it with s[:s.find("=")] . My main problem is the compute function itself. I will

Creating a function that takes an equation given as a string and computes it [duplicate]

懵懂的女人 提交于 2019-12-23 02:20:44
问题 This question already has answers here : Evaluating a mathematical expression in a string (11 answers) Closed 4 years ago . As part of an assignment, I am creating a function that takes in a string, which is an equation. here is an example of one: 48+6x6/3=6x8-9x2. The compute function takes one side of the equal sign and evaluates it. I am not too concerned with splitting the equation. I believe I can just slice it with s[:s.find("=")] . My main problem is the compute function itself. I will

OCR for Equations and Formulae on the iOS Platform (Xcode)

▼魔方 西西 提交于 2019-12-22 04:47:11
问题 I'm currently developing an application which uses the iOS enabled device camera to recognise equations from the photo and then match these up to the correct equation in a library or database - basically an equation scanner. For example you could scan an Image of the Uncertainty Principle or Schrodinger Equation and the iOS device would be able to inform the user it's name and certain feedback. I was wondering how to implement this using Xcode, I was thinking of using an open-source framework

Solve Quadratic Equation in C++

倖福魔咒の 提交于 2019-12-21 12:43:34
问题 I am trying to write a function in C++ that solves for X using the quadratic equation. This is what I have written initially, which seems to work as long as there are no complex numbers for an answer: float solution1 = (float)(-1.0 * b) + (sqrt((b * b) - (4 * a * c))); solution1 = solution1 / (2*a); cout << "Solution 1: " << solution1 << endl; float solution2 = (float)(-b) - (sqrt((b*b) - (4 * a * c))); solution2 = solution2 / (2*a); cout << "Solution 2: " << solution2; If, for example, I use

Equations for 2 variable Linear Regression

╄→尐↘猪︶ㄣ 提交于 2019-12-21 06:07:50
问题 We are using a programming language that does not have a linear regression function in it. We have already implemented a single variable linear equation: y = Ax + B and have simply calculated the A and B coefficents from the data using a solution similar to this Stack Overflow answer. I know this problem gets geometrically harder as variables are added, but for our purposes, we only need to add one more: z = Ax + By + C Does anyone have the closed form equations, or code in any language that

Solve this equation with fixed point iteration

╄→尐↘猪︶ㄣ 提交于 2019-12-21 04:04:15
问题 How can I solve this equation x 3 + x - 1 = 0 using fixed point iteration? Is there any fixed-point iteration code (especially in Python) I can find online? 回答1: Using scipy.optimize.fixed_point: import scipy.optimize as optimize def func(x): return -x**3+1 # This finds the value of x such that func(x) = x, that is, where # -x**3 + 1 = x print(optimize.fixed_point(func,0)) # 0.682327803828 The Python code defining fixed_point is in scipy/optimize/minpack.py. The exact location depends on