Scipy library

28 views
Skip to first unread message

romain.j...@gmail.com

unread,
Jun 11, 2018, 8:39:46 AM6/11/18
to QPython
Hi,
I would like to run a script using a scipy function : fsolve. Is it possible or this library is not available on qpython?

QPython Support

unread,
Jun 11, 2018, 10:29:56 PM6/11/18
to qpy...@googlegroups.com
Dear User,
Scipy function is available on qpython you just have have to install it from QPYPI.
QPYTHON TEAM

On Mon, Jun 11, 2018 at 5:39 PM, <romain.j...@gmail.com> wrote:
Hi,
I would like to run a script using a scipy function : fsolve. Is it possible or this library is not available on qpython?

--
You received this message because you are subscribed to the Google Groups "QPython" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qpython+unsubscribe@googlegroups.com.
To post to this group, send email to qpy...@googlegroups.com.
Visit this group at https://groups.google.com/group/qpython.
To view this discussion on the web visit https://groups.google.com/d/msgid/qpython/050d1fd3-a91f-4a4f-a207-ad8bbe2c9a54%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

romain.j...@gmail.com

unread,
Jun 12, 2018, 9:42:28 AM6/12/18
to QPython
Thank you very much for your answer,

I have tested fsolve function with a simple equation and it works perfectly.
I am now trying something a bit more complicated with a resolution of a system of non-linear equations using finite difference scheme. (my aim is to solve this kind of system with 100 equations)
It is not working when there are more than 3 equations: N>3 (considering that first and last equations are boundary conditions..)
Although the code is working perfectly on my computer, when I run it on qpython on my phone (samsung galaxy A5 2017) X[i] becomes NaN during the process.
I thought it could be a problem linked to the size of the floats so I changed everything in float16 but it didn't fix it.
Any idea?

My code :

from scipy.optimize import fsolve

import numpy as np


B=[0]*4

B=np.float16(B)


def func(X):

X=np.float16(X)

N=4

Bsup = 2

Binf = 0

dx=(Bsup-Binf)/(N-1)

dx=np.float16(dx)

Phi=[0]*N

for i in range (1,N-1):

Phi[i]=(X[i-1]-2*X[i]+X[i+1])/dx**2 - X[i]**2

print(X[i])

Phi[0]=X[0]-1

Phi[N-1]=X[N-1]-5

Phi=np.float16(Phi)

return Phi

[A,infodict,ier,mesg]=fsolve(func,B,xtol=1e-5,maxfev=10000,full_output=1)

print(A)

print(infodict)  

QPython Support

unread,
Jun 12, 2018, 11:45:55 PM6/12/18
to qpy...@googlegroups.com
Dear User,
Can you send us the screenshot of the code so we can see what kind of error it is showing.
QPYTHON TEAM

--
You received this message because you are subscribed to the Google Groups "QPython" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qpython+unsubscribe@googlegroups.com.
To post to this group, send email to qpy...@googlegroups.com.
Visit this group at https://groups.google.com/group/qpython.

romain.j...@gmail.com

unread,
Jun 13, 2018, 4:04:36 AM6/13/18
to QPython
Here is the code and the output on the console.
Erreur_qpython.jpg
Code.jpg

QPython Support

unread,
Jun 15, 2018, 3:31:51 AM6/15/18
to qpy...@googlegroups.com
Dear User,
Please stay tuned as our Team will look into your problem and will give you a suitable answer as soon as possible.
Thank you for your patience
QPYTHON TEAM

On Wed, Jun 13, 2018 at 1:04 PM, <romain.j...@gmail.com> wrote:
Here is the code and the output on the console.

--
You received this message because you are subscribed to the Google Groups "QPython" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qpython+unsubscribe@googlegroups.com.
To post to this group, send email to qpy...@googlegroups.com.
Visit this group at https://groups.google.com/group/qpython.

romain.j...@gmail.com

unread,
Jun 25, 2018, 5:06:50 AM6/25/18
to QPython
Any news ? 


Le vendredi 15 juin 2018 09:31:51 UTC+2, QPython Lab a écrit :
Dear User,
Please stay tuned as our Team will look into your problem and will give you a suitable answer as soon as possible.
Thank you for your patience
QPYTHON TEAM
On Wed, Jun 13, 2018 at 1:04 PM, <romain.j...@gmail.com> wrote:
Here is the code and the output on the console.

--
You received this message because you are subscribed to the Google Groups "QPython" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qpython+u...@googlegroups.com.

To post to this group, send email to qpy...@googlegroups.com.
Visit this group at https://groups.google.com/group/qpython.
Reply all
Reply to author
Forward
0 new messages