Changeset 23 in TRACY3 for branches/tracy3-3.10.1b/tracy/tracy/src/tpsa_lin.cc
- Timestamp:
- Dec 6, 2013, 5:12:43 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/tracy3-3.10.1b/tracy/tracy/src/tpsa_lin.cc
r3 r23 414 414 } 415 415 416 /**************************** 417 * tan(x) 418 * *************************/ 416 419 417 void datan(const tps_buf &x, tps_buf &z) 420 418 { … … 424 422 } 425 423 426 /************************* 427 * cotan(x) 428 * ***********************/ 429 void dactan(const tps_buf &x, tps_buf &z) 430 { 431 tps_buf c, s; 432 433 dacos(x, c); dasin(x, s); dadiv_(c, s, z); 434 } 435 436 /************************************* 437 * 438 * Purpose: 439 * Get the derivatives of the arcsin(x) 440 * 441 * d(arcsin(u))/dx = (1/sqrt(1-u^2))*du/dx; 442 * 443 * Input: 444 * x: u 445 * Output: 446 * z: the differential of x. 447 * 448 * 449 * Comments: 450 * 13/11/2012 451 * Written by Jianfeng Nadolski @ LAL 452 * 453 * ***********************************/ 454 void daarcsin(const tps_buf &x, tps_buf &z) 455 { 456 int i; 457 double a; //differential of x; a = sqrt(1/1-u^2) 458 459 a = x[0]; z[0] = asin(a); a = 1.0/sqrt(1.0-sqr(a)); 460 for (i = 1; i <= ss_dim; i++) 461 z[i] = a*x[i]; 462 } 463 464 /************************************* 465 * 466 * Purpose: 467 * Get the derivatives of the arccos(x) 468 * 469 * d(arccos(u))/dx = -(1/sqrt(1-u^2))*du/dx; 470 * 471 * Input: 472 * x: u 473 * Output: 474 * z: the differential of x. 475 * 476 * 477 * Comments: 478 * 13/11/2012 479 * Written by Jianfeng Nadolski @ LAL 480 * 481 * ***********************************/ 482 void daarccos(const tps_buf &x, tps_buf &z) 483 { 484 int i; 485 double a; //differential of x; a = -sqrt(1/1-u^2) 486 487 a = x[0]; z[0] = asin(a); a = -1.0/sqrt(1.0-sqr(a)); 488 for (i = 1; i <= ss_dim; i++) 489 z[i] = a*x[i]; 490 491 } 492 /************************************* 493 * 494 * Purpose: 495 * Get the derivatives of the arctan(x) 496 * 497 * d(arctan(u))/dx = (1/1+u^2)*du/dx; 498 * 499 * Input: 500 * x: u 501 * Output: 502 * z: the differential of x. 503 * 504 * 505 * ***********************************/ 424 506 425 void daarctan(const tps_buf &x, tps_buf &z) 507 426 { 508 427 int i; 509 double a; //differential of x; a = (1/1+u^2)428 double a; 510 429 511 430 a = x[0]; z[0] = atan(a); a = 1.0/(1.0+sqr(a)); … … 514 433 } 515 434 516 /*************************************517 *518 * Purpose:519 * Get the derivatives of the arcctan(x)520 *521 * d(arcctan(u))/dx = -(1/1+u^2)*du/dx;522 *523 * Input:524 * x: u525 * Output:526 * z: the differential of x.527 *528 *529 * ***********************************/530 void daarcctan(const tps_buf &x, tps_buf &z)531 {532 int i;533 double a; //differential of x; a = -(1/1+u^2)534 535 a = x[0]; z[0] = atan(a); a = -1.0/(1.0+sqr(a));536 for (i = 1; i <= ss_dim; i++)537 z[i] = a*x[i];538 }539 435 540 436 void dafun_(const char *fun, const tps_buf &x, tps_buf &z) 541 437 { 542 438 tps_buf u; 543 439 544 440 if (!strncmp(fun, "INV ", dafunlen)) 545 441 dainv_(x, u); … … 554 450 else if (!strncmp(fun, "COS ", dafunlen)) 555 451 dacos(x, u); 556 else if (!strncmp(fun, "TAN ", dafunlen))557 datan(x, u);558 else if (!strncmp(fun, "CTAN ", dafunlen))559 dactan(x, u);560 452 else if (!strncmp(fun, "SINH ", dafunlen)) 561 453 dasinh(x, u); 562 454 else if (!strncmp(fun, "COSH ", dafunlen)) 563 455 dacosh(x, u); 564 else if (!strncmp(fun, "ASIN", dafunlen)) 565 daarcsin(x, u); 566 else if (!strncmp(fun, "ACOS", dafunlen)) 567 daarccos(x, u); 456 else if (!strncmp(fun, "TAN ", dafunlen)) 457 datan(x, u); 568 458 else if (!strncmp(fun, "ATAN", dafunlen)) 569 459 daarctan(x, u); 570 else if (!strncmp(fun, "ACTAN", dafunlen))571 daarcctan(x, u);572 460 else { 573 461 printf("dafun: illegal function %s\n", fun);
Note: See TracChangeset
for help on using the changeset viewer.