Merge branch 'master' into rtoy-generate-command-line-texi-table
[maxima.git] / archive / share / trash / sqdnst.mcs
blob97f77a50a06f8e5ba63e2aa6a7e93a6590ca3959
1 /* -*- Mode: MACSYMA -*- */
3 SQRTDENEST(A):=
4   BLOCK([DISCR,MAX,MIN],
5         SUBST("^" = LAMBDA([A,B],
6                        IF EVENP(DENOM(B)) AND NOT ATOM(A) AND INPART(A,0) = "+"
7                                           AND (MAX:MAX(FIRST(A),REST(A)),
8                                                MIN:A-MAX,
9                                                NUMBERP(DISCR:SQRT(1-(MIN/MAX)^2)))
10                           THEN (SQRT(MAX*(1+DISCR)/2)+SIGNUM(MIN)*SQRT(MAX*(1-DISCR)/2))^(2*B)
11                           ELSE A^B),
12               A));