Questions tagged [equation-solving]

763 questions
0
votes
0 answers

Derive all possible combinations of the number of canaries, parrots, cats living in the apartment with this total number of paws

Canaries, parrots and cats live in the apartment in such a number that only K paws. Derive all possible combinations of the number of canaries, parrots, cats living in the apartment with this total number of paws. Here's a bit of code that I came up…
Ivan
  • 11
0
votes
0 answers

Finding the intersection of two functions

I have two equations: one linear and one exponential, and I need to find where they intersect. They are of the form: y1 = a * x y2 = b * exp(c * x) + d where the variables a, b, c and d are known. I've tried looking online for solutions to find…
0
votes
1 answer

Solving a single variable equation in R using unitroot

I have a complicated equation for which I have written the code as follows: sigma = 1.336449027; f_t = 0.500185113; alpha = 0.364; #elasticity of capital beta = 0.115; #elasticity of labor R = 3.131696599; chi = 0.5; M = log(1056); sigma =…
riskiem
  • 187
  • 2
  • 7
0
votes
1 answer

Invalid NaN comparison for system of Abs/Piecewise equations in SymPy

I try to solve a system of equations in python (with sympy) but I get "TypeError: Invalid NaN comparison". The equations are "almost linear" (linear equations but also contains an abs part). For a function f I try to find 2 points [x0, x1] such that…
dacian
  • 95
  • 1
  • 8
0
votes
1 answer

NotImplementedError: Initial conditions produced too many solutions for constants [SymPy]

I attempted to solve this differential equation by adapting the code found here. import sympy as sp t = sp.symbols('t', real=True) x = sp.Function('x', real=True) diffeq = sp.Eq(x(t).diff(t), sp.sqrt(1 - x(t)**2)) res = sp.dsolve(diffeq,…
Galen
  • 1,128
  • 1
  • 14
  • 31
0
votes
1 answer

fsolve with multiple lineare equations

Please can someone explain me what is wrong with my code. I try to solve a system of multiple equation with fsolve. `clear clc close all Modellpar.Sp11 = 0.025; Modellpar.Sp12 = 0.8; Modellpar.Sp21 = 0.04; Modellpar.Sp22 = 0.96; …
pat des pat
  • 117
  • 3
0
votes
0 answers

How to calculate coefficients for given values, having Mean and N

I have the following data: Number of views (n) Mean position in search (m) Possible values for position: 1 to 8 I need to calculate the possible variations of values. Ex: n = 4442, m = 1.1. So, the variations would be: (1*x + 2*y + ... + 8*z) /…
Alina
  • 11
  • 2
0
votes
0 answers

Calculate MIN of "y" with 2 equations and 5 unknown variables

I need help as I am stuck at the follwing: Calculate 5 unknown variables if Y gets to the minimum and only have 2 equations as follow in R. 1) Unknown variables to calculate. Price_p1 Price_p2 Price_p3 Price_p4 Price_p5 y # Minimum possible…
0
votes
0 answers

Solve equation with vectors instead of single values

I need to solve an equation, which I currently do like this: def alpha_calculator(vals1: List[float], vals2: List[float], vals3: List[float]): from sympy import symbols, solve solutions = [] for i, x in enumerate(vals3): x =…
Denver Dang
  • 2,433
  • 3
  • 38
  • 68
0
votes
0 answers

Does Masters Theorem work where the coefficients are functions?

I am learning about Masters Theorem and solving recurrence relations using it, but I can only find questions like: T(n) = 16T(n/2) + 1 On google, where Masters Theorem is clearly applicable. I just came across a question: T(n) = 2^(n/2) T(n/2) +…
0
votes
1 answer

How to solve non-linear equations numerally in python

I'm trying to using sympy find the intersection of two functions. See below code. import sympy x = sympy.symbols('x') f_x = x**-0.5 g_x = -1*sympy.log(0.1+x**-0.5, 10) sol = sympy.solve(f_x - g_x, x) num = float(sol[0]) print(num) When I run…
0
votes
0 answers

Solving transcendental equation with secant method

Good time of day. There is a function Phi(alpha) = sinc(pi*a/l*sin(alpha)) = sin(pi*a/l*sin(alpha))/(pi*a/l*sin(alpha)), domain is [-pi/2;pi/2]. I need to solve equation Phi(alpha) = c using the secant method. Default c is 0.7. As Phi is even…
0
votes
2 answers

Python Sympy : Why can't it find the root of the equation

I am trying to find the real root of the 5th degree equation shown below. As a result of the solution, there are 4 imaginary and 1 real root, but I found this solution in a different way. I couldn't get it using python sympy. What could be the…
0
votes
0 answers

API for equations

Equation Let's say we have the following equation: E = Q / P From that, we also have the following two equations: Q = E * p P = Q / E So, given two of the three variables, we can find the other variable. Class representation Here's a class that we…
dharmatech
  • 8,979
  • 8
  • 42
  • 88
0
votes
1 answer

Programmatically solve for chemical molar ratio between multiple reactions

Consider the reactions: C6.H12.O6+6O2->6H2.O1+6C1.O2 (glucose + 6oxygen ->6 water + 6carbon dioxide) 2C1.H4.O1+C1.O2->C3.H6.O3+H2.O1 (2*methanol + carbon dioxide -> 1,3-dihydroxypropanone + water) How can I programmatically figure out the molar…