Question: How to get rid of 1.0 in numerical and symbolic calculation

Hi,

This might be a very silly question but it is troubling me a little bit and that's why I need to post it. During the combination of symbolic and numerical comutation this '1.0' is appearing as a coefficient for the variables whose coeffecient is just '1'. It's quite annoying as sometimes if I have to collect coefficient of a variable for an example exp(I*omega*t) then I have to write exp(1.I*omega*t), so chances of making mistake is higher. Please find the attached worksheet for this. In eq(4), you can easily see that for x[3](t) and x[1](t) this '1.0' appears in front of the variables.

I really appreciate  if someone can help me out of this.

With Regards

Sunitquestion.mw
 

restart

with(LinearAlgebra):

par := {a = 2.5, alpha = 2, k_r = .5, k_rc = .2, k_rq = .2, kappa = 0.1e-2, mu_k = .35, mu_s = .44, omega = .766620580157922, sigma_0 = 110, sigma_1 = 1.37, sigma_2 = 0.823e-1, x_s3 = -1.04003626422324936017819852700633621040584050594846801927800, zeta = 0.904504977553123318334601762827181333680096702957228781770315e-1}:

f := proc (v_r) options operator, arrow; mu_k+(mu_s-mu_k)*exp(-a*v_r) end proc:

NULL

g_exp1 := taylor(1/f(v_rv+x21), x21 = 0, 4):

for k to 4 do g_coeff[k] := taylor(subs(v_r = v_rv, coeff(g_exp1, x21, k-1)), epsilon = 0, 3) end do:

g0 := eval(subs(par, coeff(g_coeff[1], epsilon, 0))):

g1 := eval(subs(par, coeff(g_coeff[2], epsilon, 0))):

g2 := eval(subs(par, coeff(g_coeff[3], epsilon, 0))):

g3 := eval(subs(par, coeff(g_coeff[4], epsilon, 0))):

NULL

``

eq[1] := subs(par, diff(x[1](t), t)-x[2](t)):

eq[2] := subs(par, diff(x[2](t), t)+2*zeta*x[2](t)+x[1](t)+k_r*(x[1](t)-x[3](t))+2*kappa*(x[2](t)-x[4](t))+k_rq*(x[1](t)-x[3](t))^2+k_rc*(x[1](t)-x[3](t))^3)

diff(x[2](t), t)+.1829009955*x[2](t)+1.5*x[1](t)-.5*x[3](t)-0.2e-2*x[4](t)+.2*(x[1](t)-x[3](t))^2+.2*(x[1](t)-x[3](t))^3

(1)

eq[3] := subs(par, diff(x[3](t), t)-x[4](t))

diff(x[3](t), t)-x[4](t)

(2)

eq[4] := subs(par, diff(x[4](t), t)+2*kappa*alpha*(x[4](t)-x[2](t))+k_r*alpha*(x[3](t)-x[1](t))-k_rq*alpha*(x[3](t)-x[1](t))^2+k_rc*alpha*(x[3](t)-x[1](t))^3+alpha*(sigma_0*x[5](t)+sigma_1*v_r*(1-sigma_0*x[5](t)*(g_0+g_1*x[4](t)+g_2*x[4](t)^2+g_3*x[4](t)^3))+sigma_2*v_r))

diff(x[4](t), t)+0.4e-2*x[4](t)-0.4e-2*x[2](t)+1.0*x[3](t)-1.0*x[1](t)-.4*(x[3](t)-x[1](t))^2+.4*(x[3](t)-x[1](t))^3+220*x[5](t)+2.74*v_r*(1-110*x[5](t)*(g_0+g_1*x[4](t)+g_2*x[4](t)^2+g_3*x[4](t)^3))+.1646*v_r

(3)

eq[5] := subs(par, diff(x[5](t), t)-v_r*(1-sigma_0*x[5](t)*(g_0+g_1*x[4](t)+g_2*x[4](t)^2+g_3*x[4](t)^3)))

diff(x[5](t), t)-v_r*(1-110*x[5](t)*(g_0+g_1*x[4](t)+g_2*x[4](t)^2+g_3*x[4](t)^3))

(4)

``


 

Download question.mw

 

Please Wait...