Skip to content
Discussion options

You must be logged in to vote

The easiest way to make a value (or an operation) concrete, is to use the np version rather than the jnp version:

def parity(f):
    a = np.linspace(-1.0, 1.0, 21)
    if np.allclose(f(a), f(-a)):
        return 'symmetric'
    if np.allclose(f(a), -f(-a)):
        return 'antisymmetric'
    return 'undefined'

Replies: 2 comments 9 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
9 replies
@mariogeiger
Comment options

@jakevdp
Comment options

@mariogeiger
Comment options

@bonfab
Comment options

@soraros
Comment options

Answer selected by mariogeiger
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants