Skip to content
This repository was archived by the owner on Mar 29, 2023. It is now read-only.
This repository was archived by the owner on Mar 29, 2023. It is now read-only.

Support for functions expecting callbacks and mapping variables #17

@glenfletcher

Description

@glenfletcher

Currently the structure of the expression is not good for functions expecting a callback i.e. scipy.quad for intergation

conisdier the following example

from Equation import Expression
fn = Expression("exp((-2*m_e/hbar)*integrate(0,gap,re(sqrt((V(x)-E)*(1+0i))),x)",["gap","E","V"])
V = lambda x: 9-1*x
E = 5
gap = 2
T = fn(gap,E,V)

The following should result in a sub Expression of re(sqrt((V(x)-E)*(1+0i))) being created with a single variable of x, any variable know at the time of the call to the top level would be map are predefined variable to the sub Expression.
if integrate were to map the sub expression to scipy.quad(SubExpression,0,gap) this would calculate the numerical integral of the sub expression.

Note: use of V(x) depends on Issue #16 to allow the use of callbacks

This can be achieved by adding meta information to functions and operators and restructuring the internal expr from postfix to prefix notation this will allow the sub expression to be extracted and minulaped, before passing to the function expecting a callback

Metadata

Metadata

Assignees

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions