I am trying to solve some physics problem in which i need to solve 625 linear coupled differential equations. I am using the command DSolve for solving them. When i used the same procedure for 25 equations it is working well.
Only difference is, in 25 equations there are no other parameters all coefficients are numerical values. but in case of 625 equations there are some 7 parameters in symbolic form like delta, omega .etc.. ( i think it doesn't matter )
Can Mathemetica solve them ? what is the limiting factor in using the DSolve command ? If not "DSolve" what could be the other command which can give me the output ?. I tried very hard to get to this 625 equations now if i have to go for some other software it will be very very tough for me...
Related
An interesting feature regardin NSolve[] with Mathematica is that it seems to provide all the solutions it can find (and hopefully it is exhaustive). For instance, as stated in the examples:
NSolve[{x^2 + y^3 == 1, 2 x + 3 y == 4}, {x, y}]
would return an array of 3 solutions.
From what I could try, it seems to scale quite well even for, say, 20 multivariate polynomial equations with 20 variables as it can be seen in this notebook.
Alternatively, I am quite found of using Sympy which also features a kind of nsolve function.
But there is a catch: this function requires a starting point "x0" and it would possibly find only one solution - and still, provided you are lucky enough to have chosen a proper x0.
Some users suggested in the past to use a "multi-start method" where one would choose a grid of potential starting points and run nsolve multiple times. But this doesn't seem to fit with my problem: if the grid is of size d for one variable, then it would scale exponentially as 20^d starting points for my own problems of 20 variables. It doesn't seem to match with Mathematica which seems to run in a blink.
What is mathematica doing to achieve such a fast solving? Is it due to the nature of the equations? (Maybe some Groebner basis computations behind the scene)
Could it be done with Sympy?
Thank you for your help!
Many papers are using SAT, but few mentioned how to convert an addition to CNF.
Since CNF only allows AND OR NOT operation, it is difficult to describe addition operation. For example,
x1 + x2 + x3 + ... +x1599 < 30, xi is binary.
Map these equations into a Boolean circuit.
Apply Tseitin's transformation to the circuit and convert it into DIMACS format.
But is there any way to read the results? I do think it is possible to read the results if all the variables are defined by ourself, so figuring out how to convert a linear constraint to SAT problem is necessary.
If there are 3 or 4 variables, i.e. x1+x2+x3 <3, we can use truth table to solve this conversion. Also, a direct way is that chose 29 (any number smaller than 30) variables from 1600 variables to be 1, the others to be 0. But there are too many possibilities which makes this problem hard to solve.
I have used STP, but it can only give 1 answer. As the increasing number of variables and clauses, it costs a long time for STP to run.
So I tried to use SAT to solve the cnf given by STP, it can give out answers in a minutes. But the results cannot be read.
In the end, I found some paper,
1. Encoding Linear Constraints with Implication Chains to CNF,
2. SAT-Based Techniques for Integer Linear Constraints. This may be helpful.
What you're describing is known as a cardinality constraint. There are many ways of encoding these in CNF. As a starting point, some of these encodings are explained in
http://www.carstensinz.de/papers/CP-2005.pdf and
https://arxiv.org/pdf/1012.3853.pdf.
Many are implemented in the PySAT python toolkit
https://pysathq.github.io/docs/html/api/card.html
I have some experimental data and I would like to fit them to obtain my parameters using the least-square method (Levenberg-Marquardt).
I am using two non-linear equations and I am using some computational programs (Origin and Matlab).
The first is:
y=A+B*(((2*pi*x)^2+Alfa4^2)*((2*pi*x)^2+Alfa5^2))/(((2*pi*x)^2+Alfa1^2)*((2*pi*x)^2+Alfa2^2)*((2*pi*x)^2+Alfa3^2));
Non-linear equation with the parameters (Alfa1,Alfa2,Alfa3,Alfa4,Alfa5)
And the second fitting equation is:
y=((T2^2+Lc^2*(2*pi*x)^2)/(((2*pi*x)^2*(Lc^2*(2*pi*x)^2+T8))+T6^2))*A1+G;
Rational function, i.e. quadratic function on the numerator and a 4th polynomial function on the denominator
I want to fit using this two equations, but I dont know how to do it. If someone want the experimental data I can post here.
Thank you very much,
Eduardo
I have a system consisting of 2 polynomials, in 2 variables, with complex coefficients.
The general case consists of a finite number of pairs of complex numbers.
NSolve[{poly1==0,poly2==0},{x,y}]
in Mathematica works for lower degree polynomials, but the time needed to find all roots
seems to be exponential, 2^deg. Is there an alternative to NSolve, which is more efficient?
In other language? The degree we're aiming for is in the range 15-25, higher is better.
I did not find a solution, but seems like lesser number of cores is better.
(Compared with 2,4 and 50 processor cores), and 64 bit architecture is 2 times faster.
All this using NSolve. System of 2 degree 17 polynomials in 2 variables took 24 hours to solve.
I have an interesting algorithm problem here. The problem is in a way related to simulation of electronic designs.
Say for example, I have a structure containing some gates. say a 3-input AND gate.
There are 8 possible inputs i.e
000
001
...
111
Out of these 8 inputs, if I only feed in two inputs (000) and (111), I get both the possible outputs i.e 0 and 1.
So The minimal set of input vectors that produces both the states '0' and '1' on the output are {000, 111}.
The problem is given a design, some arrangement of gates, give an algorithm to find the minimal set of input vectors that produces both the states (i.e 0 and 1) on the final output.
Your problem is equivalent to solving the boolean satisfiability problem. It is therefore NP-complete.
To get one of the inputs you can choose an arbitrary input and see if that gives either 0 or 1. To find an input that gives the other output you need a SAT solver.
Wikipedia suggests some algorithms that can be used:
DPLL algorithm
Chaff algorithm
GRASP
WalkSAT
etc...
If you don't want to implement it, there are tools that are ready-to use SAT solvers:
CVC3 (open-source LGPL)
Yices (free for non-commercial use)
This is solved with the Quine McCluskey algorithm. There are also some JavaScripts and Tools which may solve your problem.