I have four ordinary differential equation written in mathmatica : Simplify[DSolve[{y1'[x] == -0.162y1[x], y2'[x]=-0.148 y2[x]+ 0.055y1[x],y3'[x]==-0.134 y3[x]+ 0.033y1[x]+ 0.039y2[x],y4'[x]==-0.125y4[x]+0.021 y1[x]+0.025y2[x]+ 0.043y3[x], y1[0] == 100,y2[0]==4.76,y3[0]==69.7,y4[0]==0}, {y1[x], y2[x],y3[x],y4[x]}, x]] I am trying to write them in python I have try the following : def n1(y,x): s1 = 0.162131 dydx = -s1 * y return dydx def n2(y,x): s2 = 0.148234 s12= 0.0555877 dydx2 = -s2 * y + s12 * n1(y,x) return dydx2 def n3(y,x): s3 = 0.134337 s13= 0.0333526 s23= 0.0389114 dydx3 = -s3 * y + s13 * n1(y,x) + s23 * n2(y,x) return dydx3 def n4(y,x): s4= 0.125072 s14= … +0 I am trying to calculate some thing called directional derivatives of a vector b (which defined in attached file as an example) to calculate the directional derivatives of the vector b . the result of the example is also in the attached file. I serached in goolge to find how we can calculate the directional derivatives, but I could not find any function in python to do this kind of calculation ; the only thing I found which do derivative in python is: scipy.misc.derivative(func, x0, dx=1.0, n=1, args=(), order=3) this function dose not give me the right answer . Could … +0 How can I calculate the average weight in python for two columns (x,y) data file, between 8 Rc : return rho0*np.exp(-(r-Rc)/Rd) r = np.linspace(0,20, 1000) y= Density(rho0, r, Rc, Rd) plt.plot(r, y) plt.show() I am getting this error: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all(). I do not know how can I solve this problem?or +0 Hello, I'm trying to plot this function with using this values: Rh = 9.8 H0 = 0.063 def Thickness_H(H0, r, Rh): return float(H0)*np.exp(float(r)/float(Rh)) r = np.linspace(0,1, 10) x =Thickness_H(H0, r, Rh) plt.plot(r, x) plt.show() I'm trying to defind r like what i know but this dose not work, I'm getting this error: only length-1 arrays can be converted to Python scalars. may you please help me in this point? Thank you +0 I am trying to define a function in c++, I wrote it in main function. I am getting an error : a function-definition is not allowed here before ‘{’ token}I have defined it as following : float distance(float x, float y, float pitch) { float r; //local variable r = sqrt(x * x + y * y); Bangle = arctan2(pitch*(y/r) + x , pitch*(x/r) -y); return (cos(Bangle),sin(Bangle)); } I dont know what dose this means. Any sugestion +0 I am trying to define the archimedean spiral: when im trying to define the inclination angle (incl) of the tangent vector to the orbit ( i.e: tan(incl)) im getting an error :"'numpy.ufunc' object does not support item assignment". the same error when I want to calculate cos(incl), and sin(incl). Any suggestion and help. My code is: a= 2. # will turn the spiral v= 0.23 omega = 0.2 r0 = v/omega t=np.linspace(0,T,N+1) r= v*t #theta = a + r/r0 theta = omega*t x=r* np.cos( omega*t) y=r* np.sin( omega*t) dxdr = np.cos(theta) - (r/r0)*np.sin(theta) dydr = np.sin(theta) + (r/r0)*np.cos(theta) dydx = … +0 How can we insert two independent random number to two equations (x,y) contain two parts like this: x = a* randomnumber1 + b* randomnumber2 y = c* randomnumber1 + d* randomnumber2 these two random number should be independent. Thank inadvance. +0 I plot the archimedaen spirlas for one branch, how can I plot more than one branches starting from the original, my code that I have written : n= 1000 a= 2. # will turn the spiral v= 1 omega = 0.1 r0 = v/omega T=100 N=10000 t=np.linspace(0,T,N+1) r= v*t theta = a + r/r0 dt=float(T)/N x=r* np.cos(theta) y=r* np.sin(theta) plt.plot(x,y) plt.show() +0 Hello, I am trying to write two equations, each element in the equation is an arry , double XDiffusion (int D,int D11, int x, int s) { float DeltaX; return DeltaX; } double YDiffusion (int D,int D11, int x, int s) { float DeltaY; return DeltaY; } int main() { int T =100; int N = 1000; float dt = float (T)/ N; int x = 0; int D = 10; int DII = 10000; double Bx[2] = {cos(x),-sin(x)}; double By[2]= {sin(x), cos(x)}; srand(time(0)); float s = (float(rand())/(RAND_MAX)) + 1;// give random number between(0,1) float DeltaX = Bx[0]*sqrt(2*D*dt)*s + Bx[1]*sqrt(2*DII*dt)*s; … +0

The End.