Re: [sympy] get sqrt to work

2022-08-18 Thread Peter Stahlecker
I am certainly no expert in sympy or inpython, but maybe one more point: I think, it is ‚dangerous‘ to do it like this: from sympy import sqrt, sin, cos and then use sqrt, sin, cos later. I could imagine, that lambdify gets confused. I feel, it is better to do it like this: import sympy as sp Im

Re: [sympy] get sqrt to work

2022-08-18 Thread Zohreh Karimzadeh
the following code is ok when expression is passed as : import numpy as np from scipy.optimize import minimize, curve_fit from lmfit import Model, Parameters L = np.array([0.299, 0.295, 0.290, 0.284, 0.279, 0.273, 0.268, 0.262, 0.256, 0.250]) K = np.array([2.954, 3.056, 3.119, 3.163, 3.215, 3.274

Re: [sympy] get sqrt to work

2022-08-18 Thread Peter Stahlecker
In your first return statement, where it works, you seem to return a number. In your second return, your a ‚mixture‘ of numbers and functions: Vlam_est is a *function*, which requires four arguments as per its definition. Would you not have to return Vlam_est(alpha, beta, gamma, eta) ? On Thu 18.

Re: [sympy] get sqrt to work

2022-08-18 Thread Zohreh Karimzadeh
It seems always an expression of parameters and independent variables is needed to be passed to fit and find parameters. Zohreh Karimzadeh *https://www.researchgate.net/profile/Zohreh-Karimzadeh* Skype Name 49a52224a8b6b38b Twitter Account @z

Re: [sympy] get sqrt to work

2022-08-18 Thread Peter Stahlecker
I just have no idea what np.sum((np.log(AV) + Vlam_est)**2) could possibly mean. np.log(VA) is an array of floats, that is an array of *numbers*. Vlam_est is a *function*. How you can add numbers and a function I do not know.. Vlam_est will become an array of numbers, once you give it the argume

Re: [sympy] get sqrt to work

2022-08-18 Thread Zohreh Karimzadeh
L and K are independent variables that will be passed to minimize. Zohreh Karimzadeh *https://www.researchgate.net/profile/Zohreh-Karimzadeh* Skype Name 49a52224a8b6b38b Twitter Account @zohrehkarimzad1 z.karimza...@gmail.com +989102116325 ((

Re: [sympy] get sqrt to work

2022-08-18 Thread Peter Stahlecker
Whatever they are, I believe your second return statement does not work, because you are adding ‚things‘ which cannot be added. I do not understand your program, but I do understand, that your second return statement cannot work. On Thu 18. Aug 2022 at 18:56 Zohreh Karimzadeh wrote: > L and K ar

Re: [sympy] get sqrt to work

2022-08-18 Thread Zohreh Karimzadeh
thank you very much. Zohreh Karimzadeh *https://www.researchgate.net/profile/Zohreh-Karimzadeh* Skype Name 49a52224a8b6b38b Twitter Account @zohrehkarimzad1 z.karimza...@gmail.com +989102116325 Value Water))) On

Re: [sympy] get sqrt to work

2022-08-18 Thread Peter Stahlecker
Most welcome! If I was of help, great! If not, I still enjoyed our conversation. On Thu 18. Aug 2022 at 19:08, Zohreh Karimzadeh wrote: > thank you very much. > Zohreh Karimzadeh > *https://www.researchgate.net/profile/Zohreh-Karimzadeh* >

Re: [sympy] get sqrt to work

2022-08-18 Thread Zohreh Karimzadeh
Very useful, can I ask a question? If you need to make your expression in a symbolic way using sympy which includes log or exp. Which fitting library would you recommend to easily pass your sympy expression and get your fitted parameters. Zohreh Karimzadeh *https://www.researchgate.net/profile/Zohr

Re: [sympy] get sqrt to work

2022-08-18 Thread gu...@uwosh.edu
Based on my experience developing fitting tools to be used by undergraduates (see https://jupyterphysscilab.github.io/jupyter_Pandas_GUI/) I think your choice of lmfit and scipy.optimize are good options. Jonathan On Thursday, August 18, 2022 at 7:35:00 AM UTC-5 z.kari...@gmail.com wrote: > V

Re: [sympy] get sqrt to work

2022-08-18 Thread Zohreh Karimzadeh
But not working here. Zohreh Karimzadeh *https://www.researchgate.net/profile/Zohreh-Karimzadeh* Skype Name 49a52224a8b6b38b Twitter Account @zohrehkarimzad1 z.karimza...@gmail.com +989102116325 Value Water))) On

Re: [sympy] get sqrt to work

2022-08-18 Thread Peter Stahlecker
Dear Zohreh, Sorry, but I am of no help with this. I have never used lmfit in any serious way, so I barely know it exists. ( i have made so many mistakes with sympy.lambdify(..) so I know it a bit by now) Peter On Thu 18. Aug 2022 at 19:35 Zohreh Karimzadeh wrote: > Very useful, can I ask a que

Re: [sympy] get sqrt to work

2022-08-18 Thread gu...@uwosh.edu
I think they should work. I think you are not passing them the correct information from your model function. To restate Peter's comments in a different way. The model function must return numerical values which can be compared to your data for the fit algorithms to work. Do not try to do any fi

Re: [sympy] get sqrt to work

2022-08-18 Thread Zohreh Karimzadeh
Thanks I will work on it, Zohreh Karimzadeh *https://www.researchgate.net/profile/Zohreh-Karimzadeh* Skype Name 49a52224a8b6b38b Twitter Account @zohrehkarimzad1 z.karimza...@gmail.com +989102116325 Value Water)))

Re: [sympy] get sqrt to work

2022-08-18 Thread Aaron Meurer
Instead of generating a separate lambdified function for every input, you may find it simpler to lambdify a single function with your params as extra symbolic parameters, then pass those in using the args() argument to minimize(). Aaron Meurer On Thu, Aug 18, 2022 at 4:35 AM Zohreh Karimzadeh wr