Hello, RedApe, you wrote: RA> Hello, RA> And whether someone can direct me to the necessary side. How difficult electrical circuits settle up? Clearly, there are any human methods, type there planimetric currents, the equivalent generator and so forth But if we have only a graph containing circuit resistors, EMF and current sources how it is possible to fulfill the approximate calculation? If a circuit linear that is possible approximately so: #include <math.h> #include <stdio.h> enum {item_E, item_I, item_R}; struct Item {int type; double value; int p [2];}; struct Solver {double U (int k) const {return x [k];} double I (int k) const {return x [np+k];} Solver (int count, Item* items) {rc=solve (count, items);} ~Solver () {delete [] x; x=0;} operator int () const {return rc == 0;} int nl, np; protected: int n, rc; double *x;//x [n] = {u [np], i [nl]} int solve (int count, Item* items) {int nn, k, i, r, ik, u1, u0; double *A, *b;//find np np =-1; nl=count; for (int k=0; k <nl; k ++) {if (np <items [k].p [0]) np=items [k].p [0]; if (np <items [k].p [1]) np=items [k].p [1];} np ++; n=nl+np; nn=n * (n+1);//prepare x=new double [n]; A=new double [nn]; b=new double [n+1]; for (i=0; i <n; i ++) x [i] =b [i] =0; for (i=0; i <nn; i ++) A [i] =0;//build equations for (k=0; k <nl; k ++) {ik=np+k; u1=items [k].p [1]; u0=items [k].p [0];//lines [0. np) A [ik+u0*n] =-1; break; case item_R: {//i [k] *R=u1-u0 A [ik+ik*n] =items [k].value; A [u1+ik*n] =-1; A [u0+ik*n] = +1;} break;}}//line=n A [n*n] =1; b [n] =0;//u [0 =0 r=slae (n, n+1, A, x, b);//solve with 1 dependant equation delete [] b; delete [] A; return r;} static int slae (int n, int m, double *A, double *x, double *b) {//m> =n int i, j, k, mi; double mv, t; for (i=0; i <n; i ++) {//forward mi=i; mv=fabs (A [i+i*n]); for (j=i+1; j <m; j ++) {//find best t=fabs (A [i+j*n]); if (mv <t) {mv=t; mi=j;}} if (mv == 0.0) return 1;//singular if (mi! =i) {//swap for (j=i; j <n; j ++) {t=A [j+i*n]; A [j+i*n] =A [j+mi*n]; A [j+mi*n] =t;} t=b } for (i=n-1; i> =0; i-) {//backward t=b [i]; for (j=i+1; j <n; j ++) T - = A [j+i*n] *x [j]; x [i] =t/A [i+i*n];} return 0;}}; int main (int argc, char ** argv) {/* +------------------------------- + | | (0) - [E] - (1) - R100 - (2) - R200 - (0) | | (2) - R300 - (0) nl - number of lines np - number of points */Item items [] = {{item_E, 5,0,1}, {item_R, 100,1,2}, {item_R, 200,2,0}, {item_R, 300,2,0}}; enum {N=sizeof (items)/sizeof (*items)}; Solver s (N, items); if (! s) printf ("singular\n"); else {for (int k=0; k <s.np; k ++) printf ("U%d = % 8.3f V\n", k, s. U (k)); for (int k=0; k <s.nl; k ++) printf ("I%d = % 8.3f A\n", k, s. I (k type - member type in a line (E-eds, I-ist a current, R-loading) value - value In, And, the Ohm p [0] - quits what point p [1] - in what point enters U (k) - potential of a point I (k) - a current into lines If anywhere has to work.