# Coding for radicals

**URL:** <https://cl.desmos.com/t/coding-for-radicals/2425>\
**Category:** Questions\
**Created:** [January 19, 2021, 9:40pm UTC](https://cl.desmos.com/t/coding-for-radicals/2425 "2021-01-19T21:40:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Frances\_Janowiak](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/frances_janowiak/32/1410_2.png) [@Frances\_Janowiak](https://cl.desmos.com/u/Frances_Janowiak)\
**Post date:** [January 19, 2021, 9:40pm UTC](https://cl.desmos.com/t/coding-for-radicals/2425/1 "2021-01-19T21:40:09Z")

</div>

I am currently having student rewrite exponents as radicals and vice versa. I tried playing with the code but did not have any luck. ![1](https://canada1.discourse-cdn.com/flex031/uploads/desmos/original/2X/9/9856b9ef2402635967964b4fd4c9cb810e7a91fb.jpeg)

Here is an example of what I am looking for. Any assistance with the code would be greatly appreciated. If possible I would prefer to use a table.

---

<div class="post-metadata">

**Author:** ![Mirko\_Danilovic](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/mirko_danilovic/32/1781_2.png) [@Mirko\_Danilovic](https://cl.desmos.com/u/Mirko_Danilovic)\
**Post date:** [January 20, 2021, 4:17am UTC](https://cl.desmos.com/t/coding-for-radicals/2425/2 "2021-01-20T04:17:43Z")

</div>

This is a code that I tried and it seems to work.  
#=================================================  
var1="\sqrt[{r1}]{x^{{exp1}}}"  
var2=“x^{\frac{{exp1}}{{r1}}}”  
#root is:  
r1=3  
#exponent is:  
exp1=5

bool1= this.cellContent(1,2)=var2

cellContent(1,1):var1  
cellContent(1,3): when bool1 “✅” otherwise var2  
correct: bool1  
#===========================================

This works for different roots and exponents over x. Just change the numbers and add boolean to each row.

Edit:  
This parsed the code wrongly.  
[Activity that I tested](https://teacher.desmos.com/activitybuilder/custom/6007a69a2f367f43acffb1be)
