> For the complete documentation index, see [llms.txt](https://jona-projects.gitbook.io/kiwicalc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jona-projects.gitbook.io/kiwicalc/symbolic-computation/exponent.md).

# Exponent

The exponent class helps you deal with expressions with exponents, such as $$2^{x+3}$$, or $$x^x$$. It is still an experimental feature and thus has relatively limited support.

```python
class Exponent(IExpression, IPlottable, IScatterable):
```

#### Creating a new instance

You have several ways to create exponent. For instance:

```python
x = Var('x')
exponent1 = 3*Exponent(x, x)
exponent2 = 3 *x ** x
exponent3 = Exponent(base=x, power=x, coefficient=3)
                    
```

#### Arithmetic Operators

You can apply arithmetic operators to the `Exponent` object. For example:

```python
x = Var('x')
my_exponent = x ** x
print(my_exponent + x ** x)
print(my_exponent - x ** x)
print(my_exponent * 2)
print(my_exponent / 2)
                    
```

#### Assign values

You can assign values to the `Exponent` objects via the `assign()` method, or via the `when()` method if you don't want to modify the original object. For instance:

```python
x, y = Var('x'), Var('y')
my_exponent = x ** x
print(my_exponent.when(x=2))

other_exponent = x ** y
print(my_exponent.when(y=2))
                    
```

#### Evaluate to `int` or `float`

You can try to evaluate the `Exponent` object via the `try_evaluate()` method. For instance:

```python
x = Var('x')
my_exponent = Exponent(2, 2)
print(my_exponent.try_evaluate())
                    
```

#### `to_lambda()`

You can generate a lambda expression from the exponent object via the `to_lambda()` method. For example:

```python
x = Var('x')
print((x**x).to_lambda())
                    
```

#### Plotting

You can plot and scatter `Exponent` objects via the `plot()` and `scatter()` method. For instance:

```python
x, y = Var('x'), Var('y')
(x**x).plot()
(x**x).scatter()
(x**y).plot()
(x**y).scatter()
           
```
