-
Notifications
You must be signed in to change notification settings - Fork 333
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
Added notebook with electric circuit #288
Conversation
Hi @miguelcocruz ! Thank you so much for your contribution! We will be reviewing this over the weekend or next week and merge this once everything is OK! Have a good day! cc: @whzup |
Hey @ljvmiranda921 ! Thank you for the opportunity! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @miguelcocruz thanks for this nice PR 🎊:+1:. I really like it 😃.
I have some additions, though:
- I think it would be prettier to have the function with out
kwargs
, i.e. instead of:
def cost_function(I, U, R, I_s, v_t = 25.85 / 1000):
c = abs(U - v_t * np.log(abs(I[:, 0] / I_s)) - R * I[:, 0])
return c
More like this:
def cost_function(I):
# Define U, v_t here as constants
c = abs(U - v_t * np.log(abs(I[:, 0] / I_s)) - R * I[:, 0])
return c
This way it is clear that it is only a onedimensional optimization. It might even increase the speed of the optimization.
-
It would be nice to have a graph with the cost function and a comparison to another method of finding out the current. I made a screen capture of my TI-Nspire with a
solve
for this purpose:
You can use this one or if you know something that can solve equations in Python that would be even cooler 😉. -
The optimization now takes over 18 seconds which is extremely long for just a small
solve
operation in a 1-dimensional space. Could you try lowering the number of iterations (100 or even 10-20 if that works) and look if this works, too?
Again thanks for the PR. It's nice to have you as a contributor 😄.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really nice! 😄 Thank you for your work @miguelcocruz! 💯
Woohoo, my first PR! 🎊 Thank you @whzup for the suggestions |
Hey, congratulations @miguelcocruz for your first PR! 🎉 🎉 |
I've put up a pull request to add @miguelcocruz! 🎉 |
Add a new example for the usage of pyswarms. It shows how a simple circuit can be analyzed by using PSO. Resolves #202
Add a new example for the usage of pyswarms. It shows how a simple circuit can be analyzed by using PSO. Resolves #202
Add a new example for the usage of pyswarms. It shows how a simple circuit can be analyzed by using PSO. Resolves #202
Related Issue
#202