# Checking fractions

**URL:** <https://cl.desmos.com/t/checking-fractions/2987>\
**Category:** Questions\
**Tags:** patterns, validation, correctness\
**Created:** [March 24, 2021, 10:29am UTC](https://cl.desmos.com/t/checking-fractions/2987 "2021-03-24T10:29:41Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![tarnold](https://avatars.discourse-cdn.com/v4/letter/t/c5a1d2/32.png) [@tarnold](https://cl.desmos.com/u/tarnold)\
**Post date:** [March 24, 2021, 10:29am UTC](https://cl.desmos.com/t/checking-fractions/2987/1 "2021-03-24T10:29:41Z")

</div>

Hi , I’m trying to cheack that students input to a probabilty question is correct: Thia is the code I have 🙂  
t=table1  
cellContent(1,3): when t.cellNumericValue(1,2)= \frac{1}{6} “✅” OTHERWISE “N”

---

<div class="post-metadata">

**Author:** ![SteinSchreiber](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/steinschreiber/32/2267_2.png) [@SteinSchreiber](https://cl.desmos.com/u/SteinSchreiber)\
**Post date:** [March 24, 2021, 1:20pm UTC](https://cl.desmos.com/t/checking-fractions/2987/2 "2021-03-24T13:20:33Z")

</div>

You want cellContent not cellNumericValue.

If within the same component in this case table1 you can use “this” instead of “table1”

cellContent(1,3): when this.cellContent(1,2)= `\frac{1}{6}` “✅” otherwise “N”

---

<div class="post-metadata">

**Author:** ![SteinSchreiber](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/steinschreiber/32/2267_2.png) [@SteinSchreiber](https://cl.desmos.com/u/SteinSchreiber)\
**Post date:** [March 24, 2021, 1:22pm UTC](https://cl.desmos.com/t/checking-fractions/2987/3 "2021-03-24T13:22:37Z")

</div>

Also this would work and reduces the number of table columns.  
cellSuffix(1,2): when this.cellContent(1,2)= `\frac{1}{6}` “✅” otherwise “N”

---

<div class="post-metadata">

**Author:** ![Amy\_Towriss](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/amy_towriss/32/1549_2.png) [@Amy\_Towriss](https://cl.desmos.com/u/Amy_Towriss)\
**Post date:** [March 2, 2022, 1:44pm UTC](https://cl.desmos.com/t/checking-fractions/2987/4 "2022-03-02T13:44:00Z")

</div>

How can I get my table to mark correct for fraction answers? On slide 16… I have tried numeric value and cellContent. Neither work.

Thank You

> **[\[Copy of\] Geo-Coordinate Geometry Day 1 • Activity Builder by Desmos](https://teacher.desmos.com/activitybuilder/custom/620a8f94de9bd40a1e60b478)**
>
> Re-Introduction to algebra for coordinate geometry proofs

---

<div class="post-metadata">

**Author:** ![tarnold](https://avatars.discourse-cdn.com/v4/letter/t/c5a1d2/32.png) [@tarnold](https://cl.desmos.com/u/tarnold)\
**Post date:** [March 2, 2022, 2:26pm UTC](https://cl.desmos.com/t/checking-fractions/2987/5 "2022-03-02T14:26:29Z")

</div>

use latex=`\frac{2}{3}`

---

<div class="post-metadata">

**Author:** ![tarnold](https://avatars.discourse-cdn.com/v4/letter/t/c5a1d2/32.png) [@tarnold](https://cl.desmos.com/u/tarnold)\
**Post date:** [March 2, 2022, 2:27pm UTC](https://cl.desmos.com/t/checking-fractions/2987/6 "2022-03-02T14:27:37Z")

</div>

You need backticks round \frac{2}{3}

---

<div class="post-metadata">

**Author:** ![Daniel\_Grubbs](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/daniel_grubbs/32/719_2.png) [@Daniel\_Grubbs](https://cl.desmos.com/u/Daniel_Grubbs)\
**Post date:** [March 2, 2022, 5:08pm UTC](https://cl.desmos.com/t/checking-fractions/2987/7 "2022-03-02T17:08:37Z")

</div>

There are numerous ways to check fractions (for simplicity examples are for an input)

1. Latex matching: `check= this.latex=`/frac{2}{3}` `  
Short and sweet, but can be inaccurate. Copy paste from Desmos calculator for intended latex.
2. Inequalities:  
a. `check= this.numericValue<=0.67 and this.numericValue>0.6`  
b. `check= numericValue(`\abs(\frac{2}{3}-${this.numericValue})`)<0.01`
3. simpleFunction (a little more accurate than numericValue):

```auto
check= simpleFunction(`\frac{2}{3}).evaluateAt(0)=simpleFunction(this.latex).evaluateAt(0)

```

1. Pattern matching:

```auto
p=patterns
check= p.fraction(p.integer.satisfies(`x=2`), p.integer.satisfies(`x=3`)).matches(this.latex)

```
