Skip to content

Commit

Permalink
Improve display of inverse square roots.
Browse files Browse the repository at this point in the history
  • Loading branch information
corywalker committed Nov 7, 2018
1 parent 08ba3e0 commit e8d014f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions expreduce/builtin_power.go
Expand Up @@ -134,6 +134,16 @@ func getPowerDefinitions() (defs []Definition) {
return true, fmt.Sprintf("Sqrt[%v]", this.GetPart(1).StringForm(nextParams))
}
}
if atoms.IsSameQ(this.GetPart(2), atoms.NewRational(big.NewInt(-1), big.NewInt(2))) {
nextParams := params
nextParams.PreviousHead = "<TOPLEVEL>"
if params.Form == "TeXForm" {
return true, fmt.Sprintf("\\frac{1}{\\sqrt{%v}}", this.GetPart(1).StringForm(nextParams))
}
if params.Form == "InputForm" {
return true, fmt.Sprintf("(1/Sqrt[%v])", this.GetPart(1).StringForm(nextParams))
}
}
}
return toStringInfixAdvanced(this.GetParts()[1:], "^", "System`Power", false, "", "", params)
},
Expand Down

0 comments on commit e8d014f

Please sign in to comment.