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

Could we implement the differential equations in symbolic format? #219

Open
HuynhTran0301 opened this issue May 23, 2024 · 3 comments
Open

Comments

@HuynhTran0301
Copy link

Hello everyone,
I am trying to solve the differential equations by using neurodiffeq. I need to implement a large system for example a system with 78 equations in total. I think expressing the equations in symbolic format will help to minimize the effort when implementing as well as make the package more universal usage.

Do you have any documents or instructions on implementing the system in symbolic format?
Thank you for your time and consideration.

@shuheng-liu
Copy link
Member

Hi Huynh, can you provide a sample code snippet so that I can know what kind of symbolic format you want us to implement?

@sathvikbhagavan
Copy link
Collaborator

Is usage of sympy applicable here? It would be good to some existing library of symbolics for parsing and lowering.

@HuynhTran0301
Copy link
Author

@shuheng-liu Thank you for your reply.
This is the example of equations that I want to implement.

eq12 = [
    if i in bus_gen
        j = bus_gen.index(i)
        0 ~ (Id[j]*V[i]*(A[j]*y[i] - B[j]*x[i]) + Iq[j]*V[i]*(B[j]*y[i] + A[j]*x[i])) - Pd[i] - 
        sum(Y_matrix[i,k].im*V[i]*V[k]*(x[i]*y[k] - y[i]*x[k]) + Y_matrix[i,k].re*V[i]*V[k]*(y[i]*y[k] + x[i]*x[k]) for k in 1:n)
    else
        0 ~ -Pd[i] -
        sum(Y_matrix[i,k].im*V[i]*V[k]*(x[i]*y[k] - y[i]*x[k]) + Y_matrix[i,k].re*V[i]*V[k]*(y[i]*y[k] + x[i]*x[k]) for k in 1:n)
    for i in 1:n
]

Where Id, Iq, A, B, V, x, y are variables and Y_matrix and Pd are parameters (constants)
I have a several set of equations like this and the total of equations can be 78 or more. So a symbolic format will be convenient when I change the system (for a larger system).

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

No branches or pull requests

3 participants