Tamour_Zubair

80 Reputation

One Badge

2 years, 18 days

MaplePrimes Activity


These are replies submitted by Tamour_Zubair

@Preben Alsholm

Thanks a lot for your kind responses. Its very helpful for me. I need to apply to the system. It does not take equal time intervals? I need to avalaute the system on time=0,0.01,0.02,0.03...10.

try.mw

restart

restart

NULL

C := 1.0; gK := 36.0; gNa := 120.0; gL := .3; VK := -77.0; VNa := 50.0; VL := -54.0; III := 20.0; TT1 := .3; Phi := 3^((TT1-6.3)*(1/10))

NN := 10000; dt := 0.1e-1

0.1e-1

(1)

a := .4; b := 0.2e-1; `ρρ` := 3*b*`ΨΨ1`^2+a; kk2 := 0.1e-1; kk1 := 0.1e-2; kk := 0.1e-1

alpha_n := eval(0.1e-1*Phi*(v(t)+55.0)/(1-exp(-1.0*(v(t)+55.0)/(10.0))), [v(t) = v]); beta_n := eval(.125*Phi*exp((-v(t)-65)/(80.0)), [v(t) = v]); alpha_m := eval(.1*Phi*(v(t)+40.0)/(1-exp(-1.0*(v(t)+40.0)/(10.0))), [v(t) = v]); beta_m := eval(4.0*Phi*exp((-v(t)-65.0)/(18.0)), [v(t) = v]); alpha_h := eval(0.7e-1*Phi*exp(((-1)*(v(t)+65.0))/(20.0)), [v(t) = v]); beta_h := eval(Phi/(1.0+exp((-v(t)-35.0)/(10.0))), [v(t) = v])

``

dsys1 := {dhdt = 0.3620973006e-1*exp(-0.5000000000e-1*v-3.250000000)*(1-h)-.5172818580*h/(1.0+exp(-.1000000000*v-3.500000000)), dmdt = (0.5172818580e-1*(v+40.0))*(1-m)/(1-exp(-.1000000000*v-4.000000000))-2.069127432*exp(-0.5555555556e-1*v-3.611111111)*m, dndt = (0.5172818580e-2*(v+55.0))*(1-n)/(1-exp(-.1000000000*v-5.500000000))-0.6466023225e-1*exp(-0.1250000000e-1*v-.8125000000)*n, dvdt = 3.80-36.0*n^4*(v+77.0)-120.0*m^3*h*(v-50.0)-.3*v-(0.1e-1*(0.6e-1*`ΨΨ1`^2+.4))*v, `dΨΨ1dt` = 0.1e-2*v-0.1e-1*`ΨΨ1`}

{dhdt = 0.3620973006e-1*exp(-0.5000000000e-1*v-3.250000000)*(1-h)-.5172818580*h/(1.0+exp(-.1000000000*v-3.500000000)), dmdt = 0.5172818580e-1*(v+40.0)*(1-m)/(1-exp(-.1000000000*v-4.000000000))-2.069127432*exp(-0.5555555556e-1*v-3.611111111)*m, dndt = 0.5172818580e-2*(v+55.0)*(1-n)/(1-exp(-.1000000000*v-5.500000000))-0.6466023225e-1*exp(-0.1250000000e-1*v-.8125000000)*n, dvdt = 3.80-36.0*n^4*(v+77.0)-120.0*m^3*h*(v-50.0)-.3*v-0.1e-1*(0.6e-1*`ΨΨ1`^2+.4)*v, `dΨΨ1dt` = 0.1e-2*v-0.1e-1*`ΨΨ1`}

(2)

ICS[0] := [eval(alpha_h/(alpha_h+beta_h), [v = -70]), eval(alpha_m/(alpha_m+beta_m), [v = -70]), eval(alpha_n/(alpha_n+beta_n), [v = -70]), -70, eval(kk1*v/kk2, [v = -70])]

[.7540796661, 0.2890553447e-1, .2445865494, -70, -7.000000000]

(3)

RKF45 := proc (f, y0, t0, tn, h1, { tolerance::positive := 0.1e-5 }) local k1, k2, k3, k4, k5, k6, y, t, Ynext, h_new, tol, ttt1, h; h := h1; tol := tolerance; y := [y0]; t := [t0]; while t[-1] < tn do k1 := h*f(t[-1], y[-1]); k2 := h*f(t[-1]+(1/4)*h, y[-1]+(1/4)*k1); k3 := h*f(t[-1]+(3/8)*h, y[-1]+(3/32)*k1+(9/32)*k2); k4 := h*f(t[-1]+(12/13)*h, y[-1]+(1932/2197)*k1-(7200/2197)*k2+(7296/2197)*k3); k5 := h*f(t[-1]+h, y[-1]+(439/216)*k1-8*k2+(3680/513)*k3-(845/4104)*k4); k6 := h*f(t[-1]+(1/2)*h, y[-1]-(8/27)*k1+2*k2-(3544/2565)*k3+(1859/4104)*k4-(11/40)*k5); Ynext := y[-1]+(16/135)*k1+(6656/12825)*k3+(28561/56430)*k4-(9/50)*k5+(2/55)*k6; ttt1 := abs(-(1/360)*k1+(128/4275)*k3+(2197/75240)*k4-(1/50)*k5-(2/55)*k6); if ttt1 < tol then y := [op(y), Ynext]; t := [op(t), t[-1]+h] end if; h_new := .9*h*(tol/ttt1)^(1/5); if h_new < .1*h then h := .1*h elif 4*h < h_new then h := 4*h else h := h_new end if end do; return Matrix([t, y])^%T end proc

ij1 := 1

AArkV[ij1] := eval(rhs(dsys1[4]), [h = op(1, ICS[ij1-1]), m = op(2, ICS[ij1-1]), n = op(3, ICS[ij1-1]), v = op(4, ICS[ij1-1]), `&Psi;&Psi;1` = op(5, ICS[ij1-1])])

26.49841161

(4)

res1 := evalm(RKF45(AArkV[1], -70, 0, 0.5e-1, dt))

array( 1 .. 3, 1 .. 2, [( 2, 2 ) = (-69.73501588), ( 2, 1 ) = (0.1e-1), ( 1, 1 ) = (0), ( 3, 1 ) = (0.5e-1), ( 1, 2 ) = (-70), ( 3, 2 ) = (-68.67507942)  ] )

(5)
 

NULL

Download try.mw

@Preben Alsholm

I am trying to solve ode but the code rkf45 is not working.

NULL

restart

RKF45 := proc (f, y0, t0, tn, h) local k1, k2, k3, k4, k5, k6, y, t, Ynext, h_new, tol, ttt1; tol := 0.10e-5; y := [y0]; t := [t0]; while t[-1] < tn do k1 := h*f(t[-1], y[-1]); k2 := h*f(t[-1]+(1/4)*h, y[-1]+(1/4)*k1); k3 := h*f(t[-1]+(3/8)*h, y[-1]+(3/32)*k1+(9/32)*k2); k4 := h*f(t[-1]+(12/13)*h, y[-1]+(1932/2197)*k1-(7200/2197)*k2+(7296/2197)*k3); k5 := h*f(t[-1]+h, y[-1]+(439/216)*k1-8*k2+(3680/513)*k3-(845/4104)*k4); k6 := h*f(t[-1]+(1/2)*h, y[-1]-(8/27)*k1+2*k2-(3544/2565)*k3+(1859/4104)*k4-(11/40)*k5); Ynext := y[-1]+(16/135)*k1+(6656/12825)*k3+(28561/56430)*k4-(9/50)*k5+(2/55)*k6; ttt1 := abs(-(1/360)*k1-(13696/12825)*k3-(235079/225720)*k4+(19/50)*k5-(2/55)*k6); if ttt1 < tol then y := [op(y), Ynext]; t := [op(t), t[-1]+h] end if; h_new := .84*((tol*h/ttt1)^(1/4)); if h_new < .1*h then h := .1*h elif 4*h < h_new then h := 4*h else h := h_new end if end do; return [t, y] end proc

f := proc (t, y) options operator, arrow; -2*t*y end proc; results := RKF45(f, 1, 0, 2, .1); print(results)

proc (t, y) options operator, arrow; -2*y*t end proc

 

Error, (in RKF45) illegal use of a formal parameter

 

results

(1)

NULL

Download rkf45try.mw

@Preben Alsholm 

my rk-4 maple "solution := dsolve(dsys1, numeric, method = rkf45, output = listprocedure)" have little bit different result. matching 2 to 3 decimal places. Can you tell me why? can you update my proc code to rkf45 ?

@Preben Alsholm 

Thanks a lot for your kind respose. Can you tell me for rk-4, this code is right, because I am getting different results

rk4 := proc(f, t, y, h) local k1, k2, k3, k4, ynew; k1 := f(t, y)*h; k2 := f(t + 1/2*h, y + 1/2*k1)*h; k3 := f(t + 1/2*h, y + 1/2*k2)*h; k4 := f(t + h, y + k3)*h; ynew := y + 1/6*k1 + 1/3*k2 + 1/3*k3 + 1/6*k4; return ynew; end proc

@dharr 

Thanks a lot. How can I get the value of y(t) from implicit solution using maple?

sol:=dsolve({AASnum,IC},implicit);

@dharr 
Thanks a lot for yout reply. 
yt := y(t) = RootOf(8*t - 4*ln(_Z + 1) + 2*ln(_Z^2 + 1) - 4*arctan(_Z) + 2*ln(2) + Pi)

Can we convert it normal solution?

@tomleslie 

Dear Professor;

Hope you are fine. You are absolutly right Professor. Maple builton commands are always better and I always like it. In my situation, when i increase the value of "N", number of nonlinear ODE's increased and further builton comand take a lot of computational time to evaluate the solution. But my target is reduce the computation cost. I have upload the real code. I have two generlized ODE's and further with the help of loops and discritization on different points with value of "N", i obtained system of nonlinear ODE's and further i need to solve with the help of RK-4. For better accuracy, I need to increase "N" which increse the number of nonlinear ODE's. Kindly visit my real code and help me further. I am waiting for your kind response.

Thanks 

@tomleslie 

Dear Professor;

Thanks a lot for this. I cannot use builton command beacuse system of ODE's increase as i will increase the value of "N". Therefore this command will creat heavy computational cost. Is that possible to make code not builton command? I am waiting for your kind response.

Thanks

@vv 

Thanks a lot. It helps me a lot. Can it take first ODE of each variable ?

@Carl Love 

Professor Z_0(t) is extra which i have removed and update the data and file accordingly. Z_1(t) and Z_2(t) is not extra, it contaion odes and part of the system of ODE's. System is nonlinear due this constants. Without this system become linear which can easily handle with mentioed command but i need to convert system of nonlinear ODE's to matrixcs.

@Rouben Rostamian

Yes Professor.

I need matrix formulation of nonlinear ODE's. Is that any solution? 

@Axel Vogt 

Dear Professor;

Thanks a lot for your response. Saperately it is solving but not collectively. I need to find the solution in term of other variable. Not possible to find?

@acer 

Thanks a lot Professor. I have updated the file name according to your instruction. Now it is ok. Thnaks a lot for your response.

I have uploded the file properly but i donot know why maple file download is showing error.

@Carl Love 

Thanks a lot Professor for your kind response. The coding and scheme style you used totally different and may be very hard for me. I have some question about it.

1. How you formulate M and further pi and sys. Can you please explain the steps.

2. What method you used find the error?

I am waiting for your kind response.

Thanks

1 2 Page 1 of 2