Changeset 0e200a in git
- Timestamp:
- Feb 18, 2005, 6:38:45 PM (18 years ago)
- Branches:
- (u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
- Children:
- b9e6b3a8fbdac60181ba5817714b3bde3734cdff
- Parents:
- 041f605161d1a76a1c84079b6ca824b4fe4902a3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/control.lib
r041f60 r0e200a 1 version="$Id: control.lib,v 1.2 0 2005-02-09 19:06:35 levandov Exp $";1 version="$Id: control.lib,v 1.21 2005-02-18 17:38:45 levandov Exp $"; 2 2 category="Applications"; 3 3 info=" … … 72 72 LIB "nchomolog.lib"; 73 73 LIB "gkdim.lib"; 74 74 75 //--------------------------------------------------------------- 76 static proc Opt_Our() 77 "USAGE: Opt_Our(); 78 RETURN: intvec, where previous options are stored 79 PURPOSE: save previous options and set customized options 80 " 81 { 82 intvec v; 83 v=option(get); 84 option(redSB); 85 option(redTail); 86 return (v); 87 } 75 88 proc declare(string NameOfRing, string Variables, list #) 76 89 "USAGE: declare(NameOfRing, Variables,[Parameters, Ordering]); … … 291 304 module Id = freemodule(NCols); 292 305 module N = transpose(M); 306 intvec old_opt=Opt_Our(); 293 307 Id = std(Id); 294 308 matrix T; 295 option(redSB);296 option(redTail);297 309 // check the correctness (Id \subseteq M) 298 310 // via dimension: {dim/GKdim} (M) = -1! … … 315 327 T2 = transpose(T2); 316 328 // set options back 317 option( noredTail);329 option(set,old_opt); 318 330 return(T2); 319 331 } … … 337 349 }; 338 350 //----------------------------------------------------------------------- 351 proc RightInverse(module R) 352 { 353 return(transpose(LeftInverse(transpose(R)))); 354 } 355 //----------------------------------------------------------------------- 339 356 static proc dim_Our(module R) 340 357 { … … 344 361 R = std(R); 345 362 } 346 if (Is_NC()) 347 { 348 d = GKdim(R); 349 } 350 else { d = dim(R); } 363 // if (Is_NC()) 364 // { 365 // d = GKdim(R); 366 // } 367 // else { d = dim(R); } 368 d = dim(R); 351 369 return(d); 352 370 } … … 354 372 static proc Ann_Our(module R) 355 373 { 356 if (Is_NC())357 {358 // TODO: use preAnn, that is an annihilator of the generators359 // what is a left ideal!360 return(-1);361 }362 else363 {364 return(Ann(R));365 }366 374 // if (Is_NC()) 375 // { 376 // // TODO: use preAnn, that is an annihilator of the generators 377 // // what is a left ideal! 378 // return(-1); 379 // } 380 // else 381 // { 382 // return(Ann(R)); 383 // } 384 return(Ann(R)); 367 385 } 368 386 //----------------------------------------------------------------------- … … 370 388 // mimicking 'Ext_R' from "homolog.lib" in commutative case 371 389 { 372 int ISNC = Is_NC();390 // int ISNC = Is_NC(); 373 391 int ExtraArg = ( size(#)>0 ); 374 if (ISNC)375 {376 // ExtraArg not yet implemented and thus ignored377 return( ncExt_R(i,R) );378 }392 // if (ISNC) 393 // { 394 // // ExtraArg not yet implemented and thus ignored 395 // return( ncExt_R(i,R) ); 396 // } 379 397 // the commutative case: 380 398 if (ExtraArg) … … 398 416 }; 399 417 //------------------------------------------------------------------------ 400 static proc control_output(int i, int NVars, module R, module Ext_1) 418 static proc control_output(int i, int NVars, module R, module Ext_1, list Gen) 419 //static proc control_output(int i, int NVars, module R, module Ext_1) 401 420 "USAGE: control_output(i, NVars, R, Ext_1), where 402 421 i: integer, number of first nonzero Ext or … … 410 429 { 411 430 // TODO: NVars to be replaced with the global hom. dimension of basering!!! 412 int d = dim_Our( std( transpose(R) ) ); // this is the dimension of the system413 431 string DofS = "dimension of the system:"; 414 432 string Fn = "number of first nonzero Ext:"; 433 string Gen_mes = "The following parameter constellations might lead to a non-controllable system: "; 434 435 module RK = RightKernel(R); 436 int d=dim_Our(std(transpose(R))); 437 415 438 if (i==1) 416 439 { 417 module RK = RightKernel(R);418 440 return( 419 441 list ( Fn, … … 434 456 435 457 if(i>NVars) 436 { module RK = RightKernel(R);458 { 437 459 return( list( Fn, 438 460 -1, 439 "strongly controllable , image representation:",461 "strongly controllable(flat), image representation:", 440 462 RK, 441 463 "left inverse to image representation:", 442 464 LeftInverse(RK), 443 DofS, 444 d) 465 DofS, 466 d, 467 Gen_mes, 468 Gen) 445 469 ); 446 470 }; … … 455 479 i, 456 480 "controllable, not reflexive, image representation:", 457 R ightKernel(R),481 RK, 458 482 DofS, 459 d ) 483 d, 484 Gen_mes, 485 Gen) 460 486 ); 461 487 }; … … 466 492 i, 467 493 "reflexive, not strongly controllable, image representation:", 468 R ightKernel(R),494 RK, 469 495 DofS, 470 d) 496 d, 497 Gen_mes, 498 Gen) 471 499 ); 472 500 }; … … 484 512 // TODO: NVars to be replaced with the global hom. dimension of basering!!! 485 513 int ExtIsZero; 486 487 module Ext_1 = std(Ext_Our(1,R)); 514 intvec v=Opt_Our(); 515 module R_std=std(R); 516 module Ext_1 = std(Ext_Our(1,R_std)); 517 // module Ext_1 = std(Ext_Our(1,R)); 488 518 489 519 ExtIsZero=is_zero_Our(Ext_1); … … 492 522 { 493 523 i++; 494 ExtIsZero = is_zero_Our( Ext_Our(i,R) ); 495 }; 496 497 return( control_output( i, NVars, R, Ext_1 ) ); 524 ExtIsZero = is_zero_Our( Ext_Our(i,R_std) ); 525 // ExtIsZero = is_zero_Our( Ext_Our(i,R) ); 526 }; 527 matrix T=lift(R,R_std); 528 list l=genericity(T); 529 option(set,v); 530 531 return( control_output( i, NVars, R, Ext_1, l ) ); 532 // return( control_output( i, NVars, R, Ext_1 ) ); 498 533 } 499 534 example … … 509 544 view(control(R)); 510 545 }; 546 //------------------------------------------------------------------------------------------ 547 proc control2(module R) 548 "USAGE: control2(R); R a module (R is the matrix of the system of equations which is to be investigated) 549 RETURN: list of all the properties concerning controllability of the system (behavior) represented by the matrix R 550 EXAMPLE: example control; shows an example 551 NOTE: same as control(R); but using dimensions 552 " 553 { 554 intvec v=option(get); 555 module R_std=std(R); 556 int d=dim_Our(R_std); 557 int NVars=nvars(basering); 558 int i=NVars-d; 559 module Ext_1; 560 561 if(i==1) 562 { 563 Ext_1=std(Ext_Our(1,R_std)); 564 } 565 matrix T=lift(R,R_std); 566 list l=genericity(T); 567 option(set, v); 568 return( control_output( i, NVars, R, Ext_1, l)); 569 } 570 example 571 {"EXAMPLE:";echo = 2; 572 //Wind Tunnel 573 ring A = (0,a, omega, zeta, k),(D1, delta),dp; 574 module R; 575 R = [D1+a, -k*a*delta, 0, 0], 576 [0, D1, -1, 0], 577 [0, omega^2, D1+2*zeta*omega, -omega^2]; 578 R=transpose(R); 579 view(R); 580 view(control2(R)); 581 }; 511 582 //------------------------------------------------------------------------ 512 static proc autonom_output( int i, int NVars ) 583 static proc autonom_output( int i, int NVars, module RC ) 584 //static proc autonom_output( int i, int NVars ) 513 585 "USAGE: proc autonom_output(i, NVars) 514 586 i: integer, number of first nonzero Ext or … … 527 599 i, 528 600 "not autonomous", 601 "kernel representation for controllable part", 602 RC, 529 603 DofS, 530 604 d ) … … 564 638 return( list( Fn, 565 639 i, 566 "strongly autonomous ,in particular overdetermined",640 "strongly autonomous(fin. dimensional),in particular overdetermined", 567 641 DofS, 568 642 d) … … 590 664 int d; 591 665 int NVars = nvars(basering); 592 R = transpose(R); 593 d = dim_Our( std(R) ); 594 return( autonom_output(NVars-d,NVars) ); 666 // R = transpose(R); 667 // d = dim_Our( std(R) ); 668 // return( autonom_output(NVars-d,NVars) ); 669 module RT = transpose(R); 670 module RC; //for computation of controllable part if if exists 671 d = dim_Our( std(RT) ); //this is the dimension of the system 672 int i=NVars-d; //First non-zero Ext 673 if(d==0) 674 { 675 RC=LeftKernel(RightKernel(R)); 676 } 677 return( autonom_output(i,NVars,RC) ); 595 678 } 596 679 example … … 614 697 { 615 698 int NVars=nvars(basering); 616 int ExtIsZero; 617 R=transpose(R); 618 ExtIsZero=is_zero_Our(Ext_Our(0,R)); 699 int ExtIsZero; 700 module RT=transpose(R); 701 module RC; 702 ExtIsZero=is_zero_Our(Ext_Our(0,RT)); 703 // R=transpose(R); 704 // ExtIsZero=is_zero_Our(Ext_Our(0,R)); 619 705 int i=0; 620 706 while( (ExtIsZero)&&(i<=NVars) ) 621 707 { 622 708 i++; 623 ExtIsZero = is_zero_Our(Ext_Our(i,R)); 624 }; 625 return(autonom_output(i,NVars)); 709 ExtIsZero = is_zero_Our(Ext_Our(i,RT)); 710 // ExtIsZero = is_zero_Our(Ext_Our(i,R)); 711 }; 712 if(i==0) 713 { 714 RC=LeftKernel(RightKernel(R)); 715 } 716 return(autonom_output(i,NVars,RC)); 717 // return(autonom_output(i,NVars)); 626 718 } 627 719 example … … 904 996 { 905 997 list M = L; 906 option(redSB); 907 option(redTail); 998 intvec v=Opt_Our(); 999 // option(redSB); 1000 // option(redTail); 908 1001 int s = size(L); 909 1002 int i; … … 917 1010 } 918 1011 } 919 option(noredTail); // set the initial option back 1012 option(set, v); //set old values back 1013 // option(noredTail); // set the initial option back 920 1014 return(M); 921 1015 } … … 944 1038 intvec v; 945 1039 int i,j; // counter 1040 1041 if(N==0) 1042 { 1043 v=1,1; 1044 return(v); 1045 } 946 1046 947 1047 for(i=1;i<=n;i++) // hier wird ein Element ausgewaehlt(!=0) und mit dessen Grad gestartet … … 1015 1115 " 1016 1116 { 1017 if (nvars(basering)>1) 1117 if (nvars(basering)>1) //if more than one variable, return empty list 1018 1118 { 1019 1119 list @L; … … 1034 1134 matrix mu[1][m]; //to save leadcoefficients 1035 1135 int ii; //counter 1036 ideal J; //for extgcd-computations1037 matrix T; //----------"------------1038 1136 1039 1137 while ((k!=n) && (k!=m) ) … … 1109 1207 L=extgcd(N[k-1,k-1],N[k,k]); //one can use this line if extgcd-bug is fixed 1110 1208 1111 //the next lines are needed for the divisibility condition of the entries of the Smith Form1112 1113 1209 if(!(N[k-1,k-1]==L[1])) //means that N[k-1,k-1] is not a divisor of N[k,k] 1114 1210 {
Note: See TracChangeset
for help on using the changeset viewer.