Function Repository Resource:

# UseRealRoots

Convert all nth roots in an expression, where n is an odd integer, to their real-valued nth roots

Contributed by: Dennis M Schneider
 ResourceFunction["UseRealRoots"][expr] converts all nth roots in expr, where n is an odd integer, to their real-valued nth roots. Otherwise, it uses the principal roots in expr.

## Details and Options

In effect, ResourceFunction["UseRealRoots"][expr] replaces every occurrence of Power that involves an odd integer root of a real number with an equivalent expression using Surd.
ResourceFunction["UseRealRoots"] allows the user to use standard mathematical syntax (e.g. x1/5 in place of Surd[x,5]) when entering expressions.
ResourceFunction["UseRealRoots"][expr] modifies Power when expr is being evaluated. The default behavior of Power is restored after expr is evaluated.

## Examples

### Basic Examples (6)

UseRealRoots converts an odd integer root in an expression to an expression using Surd:

 In[1]:=
 Out[1]=

Unlike Surd, UseRealRoots evaluates even roots of negative real numbers:

 In[2]:=
 Out[2]=
 In[3]:=
 Out[3]=

Plot over a subset of the reals (compare this with the corresponding example on the Surd documentation page):

 In[4]:=
 Out[4]=

Compare a plot of the function f(x) with UseRealRoots[f(x)]:

 In[5]:=
 Out[5]=

Compare the real and imaginary parts of and UseRealRoots[] over the reals (compare this with the corresponding example on the Surd documentation page):

 In[6]:=
 Out[6]=

EnhancedPlot automatically incorporates UseRealRoots:

 In[7]:=
 Out[7]=

Compare with Plot:

 In[8]:=
 Out[8]=

### Scope (2)

UseRealRoots can be used on any expression and it threads elementwise over lists and matrices:

 In[9]:=
 Out[9]=
 In[10]:=
 Out[10]=
 In[11]:=
 Out[11]=

Use UseRealRoots with FindRoot:

 In[12]:=
 Out[12]=

Check:

 In[13]:=
 Out[13]=

#### Function Properties  (6)

UseRealRoots[x1/n] and Surd[x,n] are both defined for all real values when n is an odd positive integer:

 In[14]:=
 Out[14]=

Compare with Power:

 In[15]:=
 Out[15]=

For positive even integers n, UseRealRoots[x1/n] and Surd[x,n] are both real-valued for non-negative x:

 In[16]:=
 Out[16]=

For negative n, UseRealRoots[x1/n] and Surd[x,n] are both defined for all positive x:

 In[17]:=
 Out[17]=

UseRealRoots[x1/n] and Surd[x,n] both assume all real values when n is an odd positive integer:

 In[18]:=
 Out[18]=

For positive even integers n, the range of both UseRealRoots[x1/n] and Surd[x,n] is the set of non-negative real numbers:

 In[19]:=
 Out[19]=

For negative odd n, 0 is removed from the range:

 In[20]:=
 Out[20]=

#### Differentiation (3)

The first derivative with respect to x:

 In[21]:=
 Out[21]=

Higher derivatives of an even root with respect to x using UseRealRoots:

 In[22]:=
 Out[22]=

Higher derivatives of an odd root with respect to x using UseRealRoots:

 In[23]:=
 Out[23]=

Using Surd:

 In[24]:=
 Out[24]=

Plot the higher derivatives computed using UseRealRoots:

 In[25]:=
 Out[25]=

Plot the higher derivatives computed using Surd:

 In[26]:=
 Out[26]=

#### Integration (3)

Compute the indefinite integral:

 In[27]:=
 Out[27]=

Verify by differentiating:

 In[28]:=
 Out[28]=

Definite integral:

 In[29]:=
 Out[29]=

An improper integral:

 In[30]:=
 Out[30]=

#### Series Expansions (1)

Find the Taylor expansion using Series:

 In[31]:=
 Out[31]=
 In[32]:=
 Out[33]=

## Publisher

Dennis M Schneider

## Version History

• 1.0.0 – 11 September 2020

## Author Notes

The formula for the kth derivative of Surd with respect to x is wrong and has been reported to Wolfram Research:

 In[1]:=

Check with k=1:

 In[2]:=