473,385 Members | 1,782 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Solving nonlinear algebraic systems

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello everybody,
I am looking into a problem that probably someone had before, so I hope
I can avoid reinventing the wheel...

I am looking into different alternatives to simulate a chemical process
with a number of unit operations (heat exchangers, chemical reactors and
so on). There are some commercial products (such as Hysys) that do this,
but have a number of shortcomings: Hysys is overkill and is way too
bloated, and Simulink has a nasty habit of crashing on algebraic loops.
Therefore I am considering using C++ directly.

Until now I considered formulating the problem as a list of objects I
call UnitOps:

class UnitOp {...};
class HeatExchanger : public UnitOp {...};
class Tank : public UnitOp {...};
class Reactor : public UnitOp {...};

Each of the sub-classes will have its own states (temperature, liquid
level, whatever), but all should provide a list of parameters (contact
area, height, volume, specific heat of the entering fluid...) and a list
of functors in the form f(x) = 0 that describe the relations (in general
non-linear, but usually not freakishly so) between those parameters.
For instance, a heat exchanger would have a functor representing:

Q - U×A×ΔT = 0

don't worry about what that is if you don't know anything about heat
exchangers, it's just an algebraic relation among its parameters.

So, my idea would be to take a list of UnitOp*, merge all the parameters
from these, take all their functors, add some more functors to account
for the relations among different UnitOp (say we assign the entering
temperature of a heat exchanger, or that the entering flow is equal to
the one exiting from another unit - whatever), and when I have N
parameters and N functors I should be able to feed all this to a
root-finding algorithm as those I can find in the GSL.

The problems at this point are:
1) How do I make sure that the problem is well formed, and that the
functors are actually independent from each other? The system is
nonlinear, so checking a matrix' rank is no option. I cannot simply
assume that the system _is_ well formed, since it will be the program's
user's task to decide the equations determining the last functors, and I
need to tell him if something is wrong (and possibly what).
2) A lot of those functors represent explicit relations (like the heat
exchanger formula above), but if I feed everything to a root-finding
algorithm I would be using an implicit method. This is going to be a
serious performance hit as I would be using a solution space with many
more dimensions than strictly necessary. I cannot hard-code the direct
relations since in general I do not know which these are.

When I got to this point, I realised that I cannot be the first person
with such an issue, so I was wondering whether anyone here saw some
library or procedure that does something similar to what I described.

Any thoughts, anyone?

Cheers,
- -Federico
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

iD8DBQFIWRpSBIpu+y7DlLcRAovhAJ92VIdHh2dk1kWp4LiX3l NdlAqsOACfQqM/
HnjvlbKuOY17E+Tp4jxY2EY=
=pLrD
-----END PGP SIGNATURE-----
Jun 27 '08 #1
2 2083
Federico Zenith wrote:
[..]
The problems at this point are:
1) How do I make sure that the problem is well formed, and that the
functors are actually independent from each other? The system is
nonlinear, so checking a matrix' rank is no option. I cannot simply
assume that the system _is_ well formed, since it will be the program's
user's task to decide the equations determining the last functors, and I
need to tell him if something is wrong (and possibly what).
Federico, that question has nothing to do with C++ *language*. You need
help with your math, please consider posting to 'sci.math.num-analysis'.
2) A lot of those functors represent explicit relations (like the heat
exchanger formula above), but if I feed everything to a root-finding
algorithm I would be using an implicit method. This is going to be a
serious performance hit as I would be using a solution space with many
more dimensions than strictly necessary. I cannot hard-code the direct
relations since in general I do not know which these are.
Again, this doesn't seem like a language issue.
When I got to this point, I realised that I cannot be the first person
with such an issue, so I was wondering whether anyone here saw some
library or procedure that does something similar to what I described.

Any thoughts, anyone?
Post to the proper newsgroup. In most cases it's not the language that
defines the library that you're going to use, it's the problem domain.
That's why asking in the newsgroup that deals with your problem domain
or with the *methods* for solving problems in your domain (mathematics
in your case) is actually going to get you closer to finding a solution
than asking in the newsgroup for the *language* in which you're going to
program.

Good luck!

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jun 27 '08 #2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Victor Bazarov wrote:
Federico Zenith wrote:
>[..]
The problems at this point are:
1) How do I make sure that the problem is well formed, and that the
functors are actually independent from each other? The system is
nonlinear, so checking a matrix' rank is no option. I cannot simply
assume that the system _is_ well formed, since it will be the program's
user's task to decide the equations determining the last functors, and I
need to tell him if something is wrong (and possibly what).

Federico, that question has nothing to do with C++ *language*. You need
help with your math, please consider posting to 'sci.math.num-analysis'.
Sorry, I obviously misunderstood the topic of the newsgroup. Please
don't shoot the noob...

Cheers,
- -Federico
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

iD8DBQFIWhhlBIpu+y7DlLcRAoIcAJ45DlsO1nkpKft4fsRiZs dBcuA+wwCgsM9t
7cCQ0VgJQfIJ1ei6Hfc/thQ=
=T3v3
-----END PGP SIGNATURE-----
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Mikito Harakiri | last post by:
I wonder if WITH RECURSIVE MaryAncestor(anc,desc) AS ( (SELECT parent as anc, child as desc FROM ParentOf WHERE desc = "Mary") UNION (SELECT A1.anc, A2.desc FROM MaryAncestor A1, MaryAncestor...
2
by: Anatoly | last post by:
Hi All !!! Can anyone give me link to the C++ source or to the compiled program unit (compatible with Microsoft VC++), designed for the solving of the algebraic linear systems with rare matrices...
7
by: laniik | last post by:
Hi, I am looking for a way to do nonlinear minimization in c++ (c is acceptable also) with constraints (a la minimize f() with parameters x,y such that x+y<1) or somthing.. I was wondering if...
3
by: Michele Simionato | last post by:
I want to interpolate a data distribution with a function depending on various parameters; the function can be a Gaussian, a Breit-Wigner, a custom function. Where should I look? I am getting lost...
6
by: DavidM | last post by:
Hi, Are there any libraries for manipulating algebraic expression trees? In particular, take an expression tree and simplify it down. I'm working up the next release of PyGene, the genetic...
9
by: Cristian | last post by:
algebraic expression 'a*b+c' with CIN .Is it possible? How to transfer the algebraic expression 'a*b+c' to the variable s (all double) with cout in a "Console Application" ? cout<<"Input a,b,c...
14
nurulshidanoni
by: nurulshidanoni | last post by:
DEAL ALL EXPERTS, How can i write random nonlinear function? Let say, the nonlinear is 2 x power of 3. But , I want the random function of nonlinear. Thank you. Ashida.
6
by: omesh | last post by:
hi guys.. i got a problem.. could anyone help me write a program.. the program is as follows:- 2. Solving systems of Linear equations using Iteration: You are required to write a C++ program...
1
by: Uwe Kotyczka | last post by:
Hallo, sorry for multiposting, but I am really looking for some hint to solve my problem. And no, I don't use Matlab, but maybe the matlab people have an idea nevertheless. I have to solve a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.