Stefan, I manage to figure out what the k1_func() works. My questions is how to use this inside the def" my_first_derivative" ? And one more please, this problem theoretically should be solved with a Newton iteration, cause is a 2 boundary condition ODE. Through this way ( without using scikits.bvp_solver ) , I will calculate the u approximation root on each x ?
kind regards, Kas On Saturday, March 30, 2013 6:17:41 PM UTC-6, Stefan Krastanov wrote: > > Here is how I would proceed (given that this is numerics it is > completely in numpy/scipy) > > - I am assuming your free variable is x > > 1. Get k in a nice form > - if they come from arrays, get interpolation functions for them: > `k_func=scipy.interpolate.interp1d(x_array,k_array)` > - if they come from a known expression of x, u and u' just implement > it as a function > > 2. Rewrite the scalar second order ode into a vector first order ode > (this is maybe the most fundamental idea in numerical ode solving. It > is important because first order ODEs are "trivial" to solve by > iteration (not really, but you can search for the details)) > > u'' == f(u', u, x) becomes [v', u'] == [f(v, u, x), v] (i.e. just u' = > v). Now write a function `def my_first_derivative` that takes as an > argument [v, u] and returns [f(v, u, x), v] > > 3. Use the ode solver > solution_array = scipy.integrate.odeint(my_first_derivative, > initial_conditions_u_v, array_of_x_points) > > > Most importantly, read the documentation of the functions that I > mentioned. > -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscr...@googlegroups.com. To post to this group, send email to sympy@googlegroups.com. Visit this group at http://groups.google.com/group/sympy?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.