Skip to content

Commit

Permalink
Update macros/contexts/contextLimitedRadical.pl
Browse files Browse the repository at this point in the history
Co-authored-by: Glenn Rice <[email protected]>
  • Loading branch information
Alex-Jordan and drgrice1 authored Oct 10, 2023
1 parent 8ac4b56 commit f36100e
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions macros/contexts/contextLimitedRadical.pl
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,11 @@ sub _contextLimitedRadical_init {
# Pass $a,$b, get Formula("$a sqrt($b)") but simplified

sub preprad {
my $a = shift;
my $b = shift;
if ($a == 0 or $b == 0) { return Formula("0"); }
my $sign = ($a > 0) ? '' : '-';
my $simplifieda = (abs($a) == 1) ? $sign : $a;
if ($b == 1) {
return Formula("$a");
} else {
return Formula("$simplifieda sqrt($b)");
}
my ($a, $b) = @_;
return Formula("0") if $a == 0 or $b == 0;
return Formula("$a") if $b == 1;
my $simplifieda = abs($a) == 1 ? ($a > 0 ? '' : '-') : $a;
return Formula("$simplifieda sqrt($b)");
}

###########################
Expand Down

0 comments on commit f36100e

Please sign in to comment.