Questions tagged [equation-solving]

763 questions
0
votes
0 answers

How would I find the runtime complexity of a program with 2 for loops nested inside another for loop?

static int bar(int[] z) { int x = z.length; for (int i = 0; i < x/2; i++) { for (int j = 0; j < x; j += 3) { if (z[i] == 10) { System.out.println("Hi"); break; } } for (int k = 0; k < x; k++) { …
cool
  • 1
0
votes
1 answer

Python code to find the integer solutions of multivariable cubic equation (Diophantine equation)?

My equation is a multivariable cubic equation, and I want to find its integer solutions in a given interval x = range(-10,11). The equation is a3 + b3 + c3 + d3 + e3 - (a + b + c + d + e)3 = 0 Is the following code correct? from itertools import…
epsilon
  • 1
  • 1
0
votes
0 answers

Is it possible to run the R function nleqslv in parallel?

I'm implementing the code for an extension of the Cox model in R and I need to find the roots of an estimating equation (derivative of the log-likelihood = 0). I managed to get the solution with the nleqslv function of the homonymous package but the…
0
votes
0 answers

Why does the SymPy diophantine module occasionally return a solution for an expression in some symbols, but not for the same expression in others?

Having imported the following: from sympy.solvers.diophantine.diophantine import diop_ternary_quadratic from sympy.abc import x,y,z,d,h,c Running the code diop_ternary_quadratic(-7938*x**2+14436*x*y-98*y**2-z**2) returns (761, 441, 15120), however…
0
votes
2 answers

How to use R to solve the unknowns in an equation?

I have an equation here: 2/(1+exp(-4.292*x))-1 = 0.95 I want to find the unknown x without changing the formula. Can this be done in R or Excel? Thank you in advance!
Chouette
  • 153
  • 7
0
votes
1 answer

Python (using SciPy) is unable to solve for a variable in an equation

I am having a problem solving for the variable x_Prime using the scipy.optimize.fsolve() function. Below is what I have: import math import scipy.optimize as so c_val = 100 f_NFW_val = math.log(1+c_val)-c_val/(1+c_val) psi_prime =…
ellipse314
  • 47
  • 3
0
votes
1 answer

Breaking an equation step by step based on the arithmetic dependencies in Python

I am trying to break an equation step by step by checking the arithmetic dependencies. I have tried using the sympy.simplify() and sympy.expand(), but I am not getting the desired output. Input: m = 10*((9*(x**3) + 2*(y**4))**3) + 3*(y**3 +…
Shikhar
  • 93
  • 7
0
votes
0 answers

Find probability of solution to system of linear equations, where A and x contain only 0s and 1s?

Given an n by m matrix A, filled with only 0s and 1s, and an n by 1 matrix b, filled with non-negative integer values, I want to find the probability that a specific element of x is 1, if I were to choose a random m by 1 matrix x containing only 0s…
0
votes
1 answer

The "solve" function in MATLAB is not solving my equations correctly

I have a for loop creating a super equation that is the sum of a group of equations that could use variables A1 to A7. Each looping would increase the amount of As, which represents the amount of equations in that group. The super equation would…
Faito Dayo
  • 115
  • 4
0
votes
0 answers

Solving system of integral equations numerically

Please, help me to understand... Im solving system of equations `f1[\[Lambda]1_, t_] := \[Lambda]1*Exp[-\[Lambda]1*t]; f2[\[Lambda]2_, t_] := \[Lambda]2*Exp[-\[Lambda]2*t]; f3[\[Lambda]3_, t_] := \[Lambda]3*Exp[-\[Lambda]3*t]; …
Danone
  • 1
  • 1
0
votes
1 answer

Solve a system of N equations with N unknowns using Julia

I have : a set of N locations which can be workplace or residence a vector of observed workers L_i, with i in N a vector of observed residents R_n, with n in N a matrix of distance observed between all pair residence n and workplace i a shape…
0
votes
1 answer

How do I solve for X on Matlab when X is on both sides of the equation

Suppose i have an equation that looks like this: x = y + zx I have the values for y and z, I want to calculate x. How would I do this on Matlab without having to solve for x on paper? Probably a simple equation but I am new, thank you! I tried just…
0
votes
0 answers

How to derive multidimensional array direction vectors?

For leetcode problem https://leetcode.com/problems/walls-and-gates/solution/ The BFS solution has ....... private static final List DIRECTIONS = Arrays.asList( new int[] { 1, 0}, new int[] {-1, 0}, new int[] { 0, …
0
votes
1 answer

System of 4 equations with Sympy

I am trying to solve a system of 4 equations with four unknows with non define constatnt, but when I run my program in Spyder the consol display ''solution'' without giving the solution. this is what I have In[54]:…
Lavoisier
  • 1
  • 2
0
votes
2 answers

Generating all solutions to an under-determined system of equations with a restriction

I have an under-determined system of equations in which the solutions are either 0 or 1 for each variable and each variable coefficient is 1. Is there a way to generate all possible solutions? For example, if the system only has the equation…
ordptt
  • 130
  • 6