Skip to content

algebraic inputs for variables #10

Description

@georgekenison

Consider the following (probabilistic) program, say fibonacci.prob, for the Fibonacci recurrence with algebraic initial values.

f0 = 1
f1 = 2**(1/2)
while true:
    f0o = f0
    f1o = f1
    f0 = f1
    f1 = f0o + f1o
end

or

f0 = 1
f1 = sqrt(2)
while true:
    f0o = f0
    f1o = f1
    f0 = f1
    f1 = f0o + f1o
end

I run the following task python3.8 polar.py benchmarks/fibonacci.prob --plot f0 and obtain the outputs

Computing samplesPolynomial sqrt(2) is not a number in state {f0: 0.0}

and

Unexpected token Token('BOPEN', '(') at line 2, column 10.
Expected one of: 
	* RBRACE
	* _NL
	* BCLOSE
	* LBRACE
	* MULT
	* MINUS
	* PLUS
	* COP
	* OR
	* POW
	* COMMA
	* DIV
	* COLON
	* AND

respectively.

It would be useful if Polar could interpret algebraic inputs (in common standard forms).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions