From: Mike G. v. a. <we...@ma...> - 2005-07-04 15:26:13
|
Log Message: ----------- Commenting out unused code. This file still needs a lot of work. Modified Files: -------------- pg/macros: PGdiffeqmacros.pl Revision Data ------------- Index: PGdiffeqmacros.pl =================================================================== RCS file: /webwork/cvs/system/pg/macros/PGdiffeqmacros.pl,v retrieving revision 1.2 retrieving revision 1.3 diff -Lmacros/PGdiffeqmacros.pl -Lmacros/PGdiffeqmacros.pl -u -r1.2 -r1.3 --- macros/PGdiffeqmacros.pl +++ macros/PGdiffeqmacros.pl @@ -351,198 +351,7 @@ #The inputs are given as arguments viz: ivy ($a,$b,$c,$m,$n). #The output is the solution as a string giving a function of t. -#sub oldivy { -# # the two roots are: -b/(2a) plus/minus sqrt(b*b - 4*a*c)/(2a) -# my ($a,$b,$c,$m,$n) = @_; -# my $denom = 2*$a ; -# my $discriminant = ($b*$b)-(4*$a*$c); -# my $outa = frac(-$b,2*$a); -# my $dabs = abs($discriminant); -# my $ira = rad(1,2*$a,$dabs); -# -# # let $r = "-$b/(2*$a)" where the fraction is in lowest form. -# my $r = $outa->{displaystr}; -# -# # make sure you take a square root of positive number. -# # let $w = sqrt(abs(-b/(2a))) -# my $w = sqrt($dabs); -# -# # let $irra = "sqrt($dabs)/(2a)" in lowest form. -# my $irra = $ira->{displaystr}; -# -# my @suma = add($r,$b,$irra,$discriminant); -# my @sumb = add($r,$b,"-$irra",$discriminant); -# -# # $r1 is string of root1. $r2 is string of root2. -# -# # let $r2 = "$r + $irra" = "(-$b+sqrt($dabs))/(2a)". -# my $r2 = $suma[0]; -# -# # let $r1 = "$r - $irra" = "(-$b-sqrt($dabs))/(2a)". -# my $r1 = $sumb[0]; -# -# # if the sqrt(discriminant) is an integer (real solutions)... -# if ($w == int($w)) { -# my $outb = frac(-$b-$w,$denom); -# my $outc = frac(-$b+$w,$denom); -# -# # then let $r1 = (-$b-sqrt($dabs))/(2a). the "plus" term. -# $r1 = $outb->{displaystr}; -# -# # then let $r2 = (-$b+sqrt($dabs))/(2a). the "minus" term. -# $r2 = $outc->{displaystr}; -# } -# -####### -# # let $exp = "exp( (-$b)/(2a) t)"; -# my $exp = simpleexp ($r ,0 ); -# -# #first find a fundamental set of solutions. -# #initialize: -# -# # Solution: Ae^(($r1)t) + Be^(($r2)t) = y(t) -# # $y1 = e^(($r1)t), $y2 = e^(($r2)t) -# # $y1prime = ($r1)*e^(($r1)t), $y2prime = ($r2)*e^(($r2)t) -# -# my $y1 = "0"; -# my $y2 = "0"; -# my $y1prime = "0"; -# my $y2prime = "0"; -# -# if ($discriminant==0) { -# $y1 = simpleexp ($r,0); -# $y2 = "t* $y1 "; -# $y1prime = "$r *$y1"; -# $y2prime = "(1 + $r*t)*$y1 "; -# if ($r eq "0") { -# $y1prime = "0"; -# $y2prime = "1"; -# $y2 = "t"; -# } -# } -# -# # if the discriminant is positive, -# if ($discriminant>0) { -# $y1 = simpleexp ($r1,0); -# $y2 = simpleexp ($r2,0); -# $y1prime = "($r1)*$y1"; -# $y2prime = "($r2)*$y2"; -# } -# -# # if the discriminant is negative, then the roots are imaginary. -# # recall e^(ix) = cos x + isin x -# # and e^(ix) + e^(-ix) = 2cos x -# -# if ( $discriminant<0) { -# my $arg = "($irra )*t"; -# if ($w == $denom) { -# $arg = "t"; -# } -# my $cos = "cos($arg ) "; -# my $sin = "sin($arg ) "; -# -# if ($b == 0) { -# $y1 = "$cos"; -# $y2 = "$sin"; -# $y1prime = "(-$irra)*$y2"; -# $y2prime = "($irra)*$y1"; -# } else { -# $y1 = "($exp)*($cos) "; -# $y2 = "($exp)*($sin) "; -# $y1prime = "(-$irra)*($y2) + ($r)*($y1)"; -# $y2prime = "($irra)*($y1) + ($r)*($y2)"; -# } -# } -# print ("discriminant=$discriminant\n"); -# -######Need to get coef below to solve iv problem -#### Used Cramer's rule -##initialize -# my $coef1 = "0"; -# my $coef2 = "0"; -# my $t1 = 0; -# my $t2 = 0; -# my $out = frac(2,1); -# -# my $k = ($m*$b*.5)+($a*$n); -# my $kk = ($m*$b)+(2*$a*$n); -# -# # if the discriminant is zero, then you have twin roots. ($r1=$r2) -# # so, Ae^(($r1)t)+Bte^(($r2)t) = Ae^(($r1)0)+B*0*e^(($r2)0) = y(0) = A+Bt = A = m. -# -# if ($discriminant==0) { -# $coef1 = "$m"; -# #$coef2 = "$kk /$denom"; -# $out = frac($kk, $denom); -# $coef2 = $out->{displaystr}; -# $t1 = $m; -# $t2 = $kk; -# } elsif ($discriminant>0) { -# my $coef1numb = $w*$m - $kk; -# my $coef2numb = $w*$m + $kk; -# $t1 = $coef1numb; -# $t2 = $coef2numb; -# my $teiler = 2*$w; -# my $test = int($w); -# if ($w == $test) { -# #$coef1 = "$coef1numb / $teiler"; -# $out = frac($t1,$teiler); -# $coef1 = $out->{displaystr}; -# #$coef2 = "$coef2numb / $teiler"; -# $out = frac($t2,$teiler); -# $coef2 = $out->{displaystr}; -# } else { -# my $dd = 2*$discriminant; -# my $irc = rad($kk,$dd,$discriminant); -# my $irrc = $irc->{displaystr}; -# my $mfirst = frac($m,2); -# my $mf = $mfirst->{displaystr} ; -# my @sumc = add($mf,$m,$irrc,$kk); -# my @sumd = add($mf,$m,"-($irrc)",$kk); -# -# # coef1 = coefficient of the first solution, coef2 = coefficient of second solution -# -# # let $coef2 = "$mf+$kk/(2*sqrt($discriminant))"; -# $coef2 = $sumc[0]; -# -# # let $coef1= "$mf-$kk/(2*sqrt($discriminant))"; -# $coef1 = $sumd[0]; -# } -# } else { -# -# # $coef2 = ($kk)/sqrt($dabs) = ($kk/$dabs)*sqrt($dabs) -# $coef1 = "$m"; -# my $ire = rad($kk,$dabs,$dabs); -# $coef2 = $ire->{displaystr}; -# $t1 = $m; -# $t2 = $kk; -# if ($w ==int($w)) { -# my $outd = frac($kk,$w); -# # let $coef2 = "$kk/$w"; -# $coef2 = $outd->{displaystr}; -# } -# } -# -# my $z1 = "($coef1 ) *$y1"; -# if ($y1 eq "1") { -# $z1 = $coef1; -# } -# -# my $z2 = "($coef2 ) *$y2"; -# -# # if you have "($coef2)*1" then just write "$coef2". -# if ($y2 eq "1") { -# $z2 = $coef2; -# } -# -# # $z1 = Ae^(($r1)t), $z2 = Be^(($r2)t) -# # $t1 = numerical value of A, $t2 = numerical value of B -# -# my @sume = add($z1,$t1,$z2,$t2); -# my $y = $sume[0] ; -# $y; -#} -#### + sub undeterminedExp { my ($A,$B,$C,$r,$q0,$q1,$q2) = @_; |