Questions tagged [equation-solving]

763 questions
0
votes
0 answers

Generating random SoLE with certain conditions

I have to write an algorithm (using NumPy) that creates: random system of 4 linear equations with 4 variables and integer coefficients two column vectors b_1, b_2 with integer numbers such that: 1) The first one makes created system Ax = b_1…
Lev
  • 146
  • 2
  • 12
0
votes
0 answers

How can the user input an equation for the program to understand?

OK so I'm fairly new to c# in the big scheme of things. I have encountered one of the first things I'm not 100% sure on how to overcome. At the moment I have a program that asks the user to input a number. This is fine if the user inputs something…
TOASTED PIE
  • 37
  • 1
  • 8
0
votes
0 answers

Octave dsolve with some symbolic parameters

I want to solve the following equation with Octave: syms y(t) k T T1 % k, T and T1 are constants. eq1 = diff(y,t)-k*y+k*T == 0 cond=y(0)==T1 dsolve(eq1,cond) but Octave runs it like this: { (sym) k⋅t y(t) = T + (-T +…
0
votes
0 answers

Calculate stationary points in JS with math.js

I want to calculate the stationary points of a derivative in JavaScript with the external library math.js. So if I have f(x) = x^2, the derivative is 2x and the stationary points can be calculated making 2x = 0 so x = 0 . But the function in math.js…
user9885084
0
votes
1 answer

Why is an empty list returned when solving for this linear system in Maxima?

I'm trying to solve a simple linear system in Maxima using solve like so: /*Standard form*/ eq1 : x1 + 3*x2 + s1 = 6; eq2 : 3*x1 + 2*x2 + s2 = 6; base1 : solve([eq1,eq2],[s1,s2]); This however returns an empty list and I don't know why. Any…
sesodesa
  • 1,473
  • 2
  • 15
  • 24
0
votes
1 answer

Solve quadratic equations without individually specifying cofficients

I am trying to solve equations like: 3*(3x-12)/(x+3)-2*(2x+3)/(3x-1) = 5 This is the code that I use: eqn1 = 3*(3*X-12)/(X+3)-2*(2*X+3)/(3*X-1) == 5; sol = solve(eqn1, X); xSol = sol.X This is the error that I get: Error using sym/subsref Too many…
0
votes
1 answer

How to solve multi-variable simultaneous equations numerically with some variables known?

How to solve a pair of nonlinear equations using Python? In this question a pair of nonlinear equations that each has two arguments were solved. Now I have more than two equations, each has a number of arguments. The number of arguments is more than…
Zhidong Li
  • 61
  • 1
  • 9
0
votes
1 answer

Matrix data in Python Sub & Upper Diagonals

I have a file with a matrix: let's say matrix.dat and I want to extract the diagonal, subdiagonal and upper diagonal from it, to create a new tridiagonal matrix M. I know that with numpy you can get the diagonal, but is there any way to extract the…
0
votes
0 answers

Passing multiple arguments in form of Dataframe and Arrays to fsolve in Python

I am trying to convert a matlab code into Python and need a help with fsolve function. The Matlab function is of form {[beta0,val,exitflag] = fsolve(@(beta) solve_obj(beta,y,x,z,z1), tb);} where, y,x,z and z1 are given arguments and function need to…
0
votes
1 answer

Why does some garbage appears instead of array values?

I take equation from a user (ex: 1X1+2X2=24 ) whatever the number of variables , i am toking it to 1X1 ,2X2 by +, - or = and then put them in array of char and each toking by x or X, and put it on another array ,but some garbage comes…
0
votes
0 answers

vpasolve return an empty sym 0x1 variable, while system clearly does have a solution (Matlab)

When I run this code I get empty strings for when setting a range for vpasolve, when I do not set the range I only get one solution, even with random on. The range is set so that it does include the one solution matlab gives me, x=2, y=0 and…
Bob van de Voort
  • 211
  • 1
  • 11
0
votes
1 answer

Solving integral for x in MATLAB, where x is bound and part of the integrand

I am trying to solve an equation for x in Matlab, but keep getting the error: Empty sym: 0-by-1 The equation has an integral, where x is the upper bound and also part of the integrand 1. The code I use is the following: a = 0.2; b= 10; c = -10; d…
Mike Lang
  • 65
  • 5
0
votes
1 answer

nleqslv, R, nonlinear equation system

I have the following nonlinear equation system: r1*r2*(0.25*0.6061-0.5)+r1+(0.25*r2) = 0.6061 r1*r2*(0.25*0.6429-0.5)+r1+(0.25*r2) = 0.6429 I need to find the r1 and r2. Their solution should be equal to: r1 = 0.5754 r2 = 0.6201 which resulted…
0
votes
0 answers

Error using linsolve: Matrix must be positive definite

I am trying to use compressed sensing for a 2D matrix. I am trying to run the following piece of code - Nf=800; N=401; E=E(Nf,N); %matrix of signal(this only for sampling) real matrix E is 2D matrix with size of Nf and N % compressive…
Neda
  • 9
  • 4
0
votes
1 answer

Making Sympy's system of equations iterable

I am trying to figure out an efficient way for solving systems of equations in Sympy "automatically". Let me exemplify, this is a standard approach to formulating the code n = 3 y = sp.symbols('y1:{}'.format(n +…