Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined variables in examples #781

Open
akaph2p opened this issue Sep 24, 2024 · 1 comment
Open

Undefined variables in examples #781

akaph2p opened this issue Sep 24, 2024 · 1 comment

Comments

@akaph2p
Copy link

akaph2p commented Sep 24, 2024

Hi,

trying to run the differential_equation_tutorial.py example on WSL (Ubuntu 20.04). I run into this error:

f: [-x0+sin(x0)]
Traceback (most recent call last):

  File "<ipython-input-19-db1b5dee6fb7>", line 1, in <module>
    runfile('/mnt/c/Users/user/OneDrive - University of Pittsburgh/Research/PhD/Software/Ariadne/tutorial.py', wdir='/mnt/c/Users/user/OneDrive - University of Pittsburgh/Research/PhD/Software/Ariadne')

  File "/usr/lib/python3/dist-packages/spyder_kernels/customize/spydercustomize.py", line 827, in runfile
    execfile(filename, namespace)

  File "/usr/lib/python3/dist-packages/spyder_kernels/customize/spydercustomize.py", line 110, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "/mnt/c/Users/user/OneDrive - University of Pittsburgh/Research/PhD/Software/Ariadne/tutorial.py", line 53, in <module>
    flow()

  File "/mnt/c/Users/user/OneDrive - University of Pittsburgh/Research/PhD/Software/Ariadne/tutorial.py", line 34, in flow
    domain=BoxDomainType([ (x_(0,x_(2))) ])

NameError: name 'x_' is not defined

Could you provide some guidance? I tried running a different example but a similar issue comes up. Is the python script not importing pyariadne properly?

@akaph2p
Copy link
Author

akaph2p commented Sep 24, 2024

Script

from pyariadne import *

def flow():
    #! Make a function f and compute the flow of the differential equation dx/dt=f(x)
    x=RealVariable("x")
    f=make_function([x],[-x+sin(x)])
    print("f:",f)


    domain=BoxDomainType([ (x_(0,x_(2))) ])
        #!< Specify that the bounds as written are exact double-precision numbers
    step=Dyadic(x_(1.5))
        #!< Specify that the bounds as written are exact double-precision numbers

    #! Solve to a tolerace of 10^-9; time-out after 32 steps
    tolerance=1e-9
    order=12

    integrator = TaylorSeriesIntegrator(tolerance, order)

    #! Solve for the root of g in the given region using the interval Newton method
    phi=integrator.flow_step(f,domain,step)
    print("phi=flow(f):",phi)
    print()



if __name__=='__main__':
    flow()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant