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

Support for functions expecting callbacks and mapping variables #17

Open
glenfletcher opened this issue May 3, 2014 · 0 comments
Open
Assignees
Milestone

Comments

@glenfletcher
Copy link
Owner

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

@glenfletcher glenfletcher added this to the v2.0 milestone May 3, 2014
@glenfletcher glenfletcher self-assigned this May 3, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant