<commit_before>    --! env rima = require("rima")

# Rima Manual: Differentiation

[ [Contents](contents.html) | Previous: [Nonlinear Problems](nonlinear.html) ]

Rima can symbolically differentiate an expression with respect to a variable:

    rima.define("x, y")
    print(rima.diff(1, x))                            --> 0
    print(rima.diff(x, x))                            --> 1
    print(rima.diff(y, x))                            --> 0
    print(rima.diff(x * y, x))                        --> y
    print(rima.diff(x^2, x))                          --> 2*x

or even:

    --! continue
    print(rima.diff((rima.sin(x))^(x^2), x))          --> (cos(x)/sin(x)*x^2 + 2*log(sin(x))*x)*sin(x)^x^2

Rima uses automatic differentiation to generate gradients and hessians for
nonlinear problems.

[ [Contents](contents.html) | Previous: [Nonlinear Problems](nonlinear.html) ]
<commit_msg>updated differentiation docs to match the earlier fix in pow<commit_after>    --! env rima = require("rima")

# Rima Manual: Differentiation

[ [Contents](contents.html) | Previous: [Nonlinear Problems](nonlinear.html) ]

Rima can symbolically differentiate an expression with respect to a variable:

    rima.define("x, y")
    print(rima.diff(1, x))                            --> 0
    print(rima.diff(x, x))                            --> 1
    print(rima.diff(y, x))                            --> 0
    print(rima.diff(x * y, x))                        --> y
    print(rima.diff(x^2, x))                          --> 2*x

or even:

    --! continue
    print(rima.diff((rima.sin(x))^(x^2), x))
      --> (cos(x)/sin(x)*x^2 + 2*log(sin(x))*x)*sin(x)^(x^2)

Rima uses automatic differentiation to generate gradients and hessians for
nonlinear problems.

[ [Contents](contents.html) | Previous: [Nonlinear Problems](nonlinear.html) ]

{'fraction_non_alphanumeric': 0.15426695842450766, 'fraction_numerical': 0.010940919037199124, 'mean_word_length': 2.0947546531302876, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6403669', 'n_tokens_mistral': 615, 'n_tokens_neox': 572, 'n_words': 135}