Skip to content

Issue with examples in new function corr in the parser #3025

@dvd101x

Description

@dvd101x

Hi, I was checking on the new function corr to see how it works and found the following while typing help(corr) in the Demo

corr([2, 4, 6, 8], [1, 2, 3, 6])
# yields TypeError: Unexpected type of argument in function matrix (expected: string or Array or Matrix or boolean, actual: number, index: 0)

It works correctly by adding a dimension:

corr([[2, 4, 6, 8]], [[1, 2, 3, 6]])
# yields [0.95618288746751]

Nonetheless outside the parser it works as expected regarding if it's a 1D array

math.corr([2, 4, 6, 8], [1, 2, 3, 6])
// yields 0.9561828874675149

Also noticed that the second example includes the function matrix which is by default in the parser.

corr(matrix([[1, 2.2, 3, 4.8, 5], [1, 2, 3, 4, 5]]), matrix([[4, 5.3, 6.6, 7, 8], [1, 2, 3, 4, 5]]))
# yields [0.95699416885036, 1]

So this could also work with a bit of simplification.

corr([[1, 2.2, 3, 4.8, 5], [1, 2, 3, 4, 5]], [[4, 5.3, 6.6, 7, 8], [1, 2, 3, 4, 5]])
# or
corr([1, 2.2, 3, 4.8, 5; 1, 2, 3, 4, 5], [4, 5.3, 6.6, 7, 8; 1, 2, 3, 4, 5])
# yields [0.95699416885036, 1]

The function corr is really cool, just wanted to let you know of these issues in the parser.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions