Questions tagged [equation-solving]

763 questions
1
vote
2 answers

Translating dictionaries and a list of strings into variables to solve ODE

say I have a list of strings representing equations ['', '-protein_0*Kdeg_protein_0+mRNA_0*Ktrans_0', '-mRNA_0*Kdeg_mRNA_0+gene_0*Kprod_0', '+mRNA_0*Kdeg_mRNA_0+protein_0*Kdeg_protein_0'] a dictionary with parameter values as…
1
vote
1 answer

Why MATLAB cannot give the correct result of the quartic equation?

Although the MATLAB owns the built-in solve() to solve the quartic equation, the solve() function gives some error information in some cases. So I write a user-defined function called solveQuartic() to solve the roots of quartic equations. The…
xyz
  • 413
  • 2
  • 19
1
vote
0 answers

DerivativeCheck fails in fsolve function (Jacobian)

I am trying to find a solution for a non-linear system in MATLAB using the fsolve function. I have an idea of the region the solution is, so my initial points are a random variation inside this area. The code follows: %MATLAB parameters digits =…
gstorto
  • 165
  • 8
1
vote
1 answer

Solving for a variable in matlab

I have a system of two equations and I need Matlab to solve for a certain variable. The problem is the variable I need is inside an expression, and trig functions. I wrote the following code: function [ V1, V2 ] = find_voltages( w1, l1, d, w2, G1,…
1
vote
1 answer

Solving bitwise XOR and ADD equation

Naturally XOR can be used twice to get back the original value. What if the original value is part of the mask? Encoding: e[i] = c[i] ^ (c[i] + c[i-1]) Assuming: starting value c[-1] = 0, ^ means bitwise XOR In imperative C form: void encode(byte…
Fil
  • 1,766
  • 1
  • 15
  • 15
1
vote
2 answers

Solve equation with exponential term

I have the equation 1 = ((π r2)n) / n! ∙ e(-π r2) I want to solve it using MATLAB. Is the following the correct code for doing this? The answer isn't clear to me. n= 500; A= 1000000; d= n / A; f= factorial( n ); solve (' 1 = ( d * pi * r^2 )^n / f …
walaa ali
  • 11
  • 1
1
vote
2 answers

Scipy - Non-linear Equations System with linear constraints (beginner)

I have seen this amazing example. But I need to solve system with boundaries on X and F, for example: f1 = x+y^2 = 0 f2 = e^x+ xy = 0 -5.5< x <0.18 2.1< y < 10.6 # 0.15< f1 <20.5 - not useful for this example # -10.5< f2 < -0.16 - not…
Fruitty
  • 57
  • 2
  • 10
1
vote
2 answers

Is it possible to get explicit solution to the following equation in Matlab?

Note, the question is edited. I set the restrictions as suggested and received the following outcome: syms f1 f2 M b1 b2 assume (M > 1 & b1 > 0 & b2 > 0) S = solve ( [(f1^M)/(f2^M) - M/(b1*f1) + M + 1 == 0, ... (f2^M)/(f1^M) - M/(b2*f2) + M + 1 ==…
Beck
  • 121
  • 5
1
vote
3 answers

Is it possible to find the value of x in python? i.e asking python to solve an equation such as 2x + 23 - 7x when x is not a pre-defined variable

What I want is a program that can determine the value of x from an equation when x is not yet defined i.e. not a python variable. Just an example below, not the real thing. sol = eval("input please type the equation: ") #i.e sol = 32x -…
1
vote
1 answer

Finite difference - wave equation - boundary conditions and setting things up

I am working on a project that has to do with solving the wave equation in 2D (x, y, t) numericaly using the central difference approximation in MATLAB with the following boundary conditions: The general assembly formula is: I understand some of…
1
vote
1 answer

nonlinear matrix equation solving in matlab

is it possible to solve below equation in matlab? A*X+B*exp(X)=C A, B are square and constant matrices. C is a constant and column matrix. X is a column matrix which should be found.( exp() acts element by element on X).
Mr. Nobody
  • 327
  • 2
  • 8
  • 21
1
vote
4 answers

How would I have my program calculate two equations from one input field?

I need two functions to be calculated from the user and wanted to know how I would use the same input field to display in an dialog box both answers when it is done. I am in the fourth week of my comp sci class and I feel like I have dove into a bit…
1
vote
1 answer

Matlab doesn't output the numerical solution of a equation (instead output ``Rootof some polynomials'' )

I am trying to solve the following equation numerically under Matlab2014b environment.However matlab does not output numerically solutions, it instead output the following >>solve(1/beta(13,11)*x^(12)*(1-x)^(10)==1.8839,x) RootOf(z^11 - 5*z^10…
1
vote
1 answer

How to decide which approach need to be used to write algorithms?

A light store owner has several bulb chains of different types which consist of bulbs of different colors in different order. In addition to that, he has large collection of bulbs of each colors. A bulb chain is identified by the color sequence of…
Alok Mishra
  • 926
  • 13
  • 39
1
vote
1 answer

Why does lsoda (in R) fail to complete running duration, with warning messages?

I am writing a numerical model in R, for an ecological system, and solving it using "lsoda" from package deSolve. My model has 14 state variables. I define the model, set it up fine, and give time duration according to…
JB8365
  • 21
  • 1
  • 4