length of equation using matlab

9 visualizzazioni (ultimi 30 giorni)
rsch tosh
rsch tosh il 14 Mar 2012
Can anyone please help me with this
y=x^3/25-3*x^2/625-2*x/15625;
I want to find the length of this equation using matlab. Thanks

Risposte (2)

Walter Roberson
Walter Roberson il 14 Mar 2012
There are multiple ways of expressing the same equation, so what does it mean to take the "length" of the equation?
Take your pick:
y = x*(625*x^2-75*x-2)/15625
y = x*(x*(x/25-3/625)-2/15625)
y = x^3/25-3*x^2/625-2*x/15625
`=`(y, `+`(`*`(Fraction(1,25),`^`(x,3)), `*`(Fraction(-3,625), `^`(x,2)), `*`(Fraction(-2,15625),x)))
Perhaps what you are looking for is:
length('y=x^3/25-3*x^2/625-2*x/15625')
  1 Commento
rsch tosh
rsch tosh il 14 Mar 2012
Thanks for the reply. But What I am looking for is length of the arc, that is created by this equation. mathematically it is given by integral of squareroot of (1+(dy/dx)^2). The integral is between 0 to x.
I want a matlab code that can do it.
Thanks a lot.

Accedi per commentare.


Walter Roberson
Walter Roberson il 14 Mar 2012
Well, if you are sure, then let x1 be the upper limit of integration, then define
EllipticE = @(z,k) feval(symengine, ellipticE, z, k);
EllipticF = @(z, k) feval(symengine, ellipticF, z, k);
and the integral is
(1/1609325600097658950 + 125/64373024003906358 * i) * ((-6 * (46875 + 15 *
i + i * (15 - 46875 * i) ^ (1/2) * (15 + 46875 * i) ^ (1/2)) * (75 * x1 - 3 +
(15 + 46875 * i) ^ (1/2)) / (-75 * x1 + 3 + (15 - 46875 * i) ^ (1/2))) ^
(1/2) * (-((15 + 46875 * i) ^ (1/2) - (15 - 46875 * i) ^ (1/2)) * (75 *
x1 - 3 + (15 - 46875 * i) ^ (1/2)) / (-75 * x1 + 3 + (15 - 46875 * i) ^
(1/2))) ^ (1/2) * ((((-2/5859375 + 2/1875 * i) + (2/234375 - 2/75 * i) *
x1) * (15 + 46875 * i) ^ (1/2) + 48828133/5859375 + 1/625 * i + (1/3125
+ i) * x1 ^2 + (-2/78125 - 2/25 * i) * x1) * (15 - 46875 * i) ^ (1/2) +
(16276039/1953125 + 13/1875 * i + (-1/3125 + i) * x1 ^2 + (2/78125 - 2/25 *
i) * x1) * (15 + 46875 * i) ^ (1/2) + 19531252/390625 - 19531252/15625 *
x1) * 244140629 ^ (1/2) * ((15 - 46875 * i) ^ (1/2) * (-75 * x1 + 3 +
(15 + 46875 * i) ^ (1/2)) / (-75 * x1 + 3 + (15 - 46875 * i) ^ (1/2))) ^
(1/2) * EllipticF(125 * 2 ^ (1/2) * 3 ^ (1/2) * (i * (75 * x1 - 3 + (15 -
46875 * i) ^ (1/2)) / (75 * x1 - 3 - (15 - 46875 * i) ^ (1/2))) ^ (1/2) /
(30 + 30 * 2 ^ (1/2) * 4882813 ^ (1/2)) ^ (1/2), 1/3125 * i + (1/46875 *
i) * (15 - 46875 * i) ^ (1/2) * (15 + 46875 * i) ^ (1/2)) - 2/5 * (-6 *
(46875 + 15 * i + i * (15 - 46875 * i) ^ (1/2) * (15 + 46875 * i) ^ (1/2)) *
(75 * x1 - 3 + (15 + 46875 * i) ^ (1/2)) / (-75 * x1 + 3 + (15 - 46875 *
i) ^ (1/2))) ^ (1/2) * (-((15 + 46875 * i) ^ (1/2) - (15 - 46875 * i) ^
(1/2)) * (75 * x1 - 3 + (15 - 46875 * i) ^ (1/2)) / (-75 * x1 + 3 + (15 -
46875 * i) ^ (1/2))) ^ (1/2) * (((-1/1171875 + 1/46875 * x1) * (15 + 46875
* i) ^ (1/2) - 1/15625 * x1 + 4/1171875 - 1/150 * i + 1/1250 * x1 ^2) *
(15 - 46875 * i) ^ (1/2) + (-1/1250 * x1 ^2 + 1/15625 * x1 - 4/1171875 +
1/150 * i)) * (15 + 46875 * i) ^ (1/2) + 1/78125 - 1/25 * i + (-1/ 3125 +
i) * x1) * 244140629 ^ (1/2) * ((15 - 46875 * i) ^ (1/2) * (-75 * x1 + 3 +
(15 + 46875 * i) ^ (1/2)) / (-75 * x1 + 3 + (15 - 46875 * i) ^ (1/2)))
^ (1/2) * EllipticE(125 * 2 ^ (1/2) * 3 ^ (1/2) * (i * (75 * x1 - 3 +
(15 - 46875 * i) ^ (1/2)) / (75 * x1 - 3 - (15 - 46875 * i) ^ (1/2))) ^
(1/2) / (30 + 30 * 2 ^ (1/ 2) * 4882813 ^ (1/2)) ^ (1/2), 1/ 3125 * i +
((1/46875) * i) * (15 - 46875 * i) ^ (1/2) * (15 + 46875 * i) ^ (1/2)) - 2 *
(((-8/15625 + i) + 2/15625 * (15 + 46875 * i) ^ (1/2)) * (15 - 46875 * i) ^
(1/2) + (-6/3125 + 6 * i) + (8/15625 - i) * (15 + 46875 * i) ^ (1/2)) *
((15 - 46875 * i) ^ (1/2) * (-3 + (15 + 46875 * i) ^ (1/2)) / (((15 +
46875 * i) ^ (1/2) - (15 - 46875 * i) ^ (1/2)) * (3 + (15 - 46875 * i) ^
(1/2)))) ^ (1/2) * ((15 - 46875 * i) ^ (1/2) * (3 + (15 + 46875 * i) ^
(1/2)) / (3 + (15 - 46875 * i) ^ (1/2))) ^ (1/2) * (3515625 * x1 ^4 -
562500 * x1 ^3 + 15000 * x1 ^2 + 600 * x1 + 244140629) ^ (1/2) * ((-(15 +
46875 * i) ^ (1/2) + (15 - 46875 * i) ^ (1/2)) * (-3 + (15 - 46875 * i) ^
(1/2)) / (3 + (15 - 46875 * i) ^ (1/2))) ^ (1/2) * EllipticE(((3 * (15 +
46875 * i) ^ (1/2) - (15 + 46875 * i) ^ (1/2) * (15 - 46875 * i) ^ (1/2) -
3 * (15 - 46875 * i) ^ (1/2) + 15 - 46875 * i) / (3 * (15 + 46875 * i) ^
(1/2) + (15 + 46875 * i) ^ (1/2) * (15 - 46875 * i) ^ (1/2) + 3 * (15 -
46875 * i) ^ (1/2) + 15 - 46875 * i)) ^ (1/2), ((15 + 46875 * i) ^ (1/2) +
(15 - 46875 * i) ^ (1/2)) / ((15 + 46875 * i) ^ (1/2) - (15 - 46875 * i)
^ (1/2))) - 4/5 * ((15 - 46875 * i) ^ (1/2) * (-3 + (15 + 46875 * i) ^
(1/2)) / (((15 + 46875 * i) ^ (1/2) - (15 - 46875 * i) ^ (1/2)) * (3 +
(15 - 46875 * i) ^ (1/2)))) ^ (1/2) * ((15 - 46875 * i) ^ (1/2) * (3 +
(15 + 46875 * i) ^ (1/2)) / (3 + (15 - 46875 * i) ^ (1/2))) ^ (1/2) *
((48828133 / 6250 + (3 / 2) * i + (-1 / 3125 + i) * (15 + 46875 * i) ^
(1/2)) * (15 - 46875 * i) ^ (1/2) + 29296878 / 625 + (48828117 / 6250 +
(13 / 2) * i) * (15 + 46875 * i) ^ (1/2)) * (3515625 * x1^4 - 562500 *
x1^3 + 15000 * x1^2 + 600 * x1 + 244140629) ^ (1/2) * ((-(15 + 46875 * i)
^ (1/2) + (15 - 46875 * i) ^ (1/2)) * (-3 + (15 - 46875 * i) ^ (1/2)) /
(3 + (15 - 46875 * i) ^ (1/2))) ^ (1/2) * EllipticF(((3 * (15 + 46875 *
i) ^ (1/2) - (15 + 46875 * i) ^ (1/2) * (15 - 46875 * i) ^ (1/2) - 3 *
(15 - 46875 * i) ^ (1/2) + 15 - 46875 * i) / (3 * (15 + 46875 * i) ^
(1/2) + (15 + 46875 * i) ^ (1/2) * (15 - 46875 * i) ^ (1/2) + 3 * (15 -
46875 * i) ^ (1/2) + 15 - 46875 * i)) ^ (1/2), ((15 + 46875 * i) ^ (1/2)
+ (15 - 46875 * i) ^ (1/2)) / ((15 + 46875 * i) ^ (1/2) - (15 - 46875 *
i) ^ (1/2))) + ((3 / 3125) * (15 - 46875 * i) ^ (1/2) * (x1 - 1/25) *
(858306898828125 * x1^4 - 137329103812500 * x1^3 + 3662109435000 * x1 ^2 +
146484377400 * x1 + 59604646728515641) ^ (1/2) + (-292968762/3125 - 18 * i) +
(732421947/78125 + 6 * i) * (15 - 46875 * i) ^ (1/2)) * (3515625 * x1^4 -
562500 * x1^3 + 15000 * x1^2 + 600 * x1 + 244140629) ^ (1/2) + 11250 *
(1/75 * (-3/25 * x1^2 + 6/625 * x1 + 2/15625 + i) * (x1 - 1/25) * (15 -
46875 * i) ^ (1/2) + 48828127/5859375 + 1/625 * i + (-1/3125 + i) * x1^2 +
(2/78125 - (2/25) * i) * x1) * 244140629 ^ (1/2)) * (15 - 46875 * i) ^
(1/2) * 244140629 ^ (1/2) / (3515625 * x1 ^4 - 562500 * x1 ^3 + 15000 *
x1 ^2 + 600 * x1 + 244140629) ^ (1/2)
Or in more readable form but likely slightly less accurate form,
t1 = sqrt((15+46875*i));
t2 = sqrt((15-46875*i));
t3 = t2 * t1;
t5 = 75 * x1;
t8 = -t5 + 3 + t2;
t9 = 0.1e1 / t8;
t12 = sqrt(-6 * t9 * (t5 - 3 + t1) * ((46875+15*i) + (i) * t3));
t13 = t1 - t2;
t14 = t5 - 3 + t2;
t17 = sqrt(-t9 * t14 * t13);
t18 = t17 * t12;
t22 = x1 ^ 2;
t27 = (-0.1e1 / 0.3125e4+1*i) * t22;
t28 = (0.2e1 / 0.78125e5-0.2e1 / 0.25e2*i) * x1;
t34 = sqrt(0.244140629e9);
t38 = sqrt(t9 * (-t5 + 3 + t1) * t2);
t39 = t38 * t34;
t40 = sqrt(0.2e1);
t41 = sqrt(0.4882813e7);
t47 = sqrt(0.3e1);
t50 = sqrt((-1*i) / t8 * t14);
t53 = (0.25e2 / 0.6e1) * t50 * t47 * t40 * sqrt(0.30e2) * ((0.1e1 + t41 * t40) ^ (-0.1e1 / 0.2e1));
t56 = (0.1e1 / 0.3125e4*i) + (0.1e1 / 0.46875e5*i) * t1 * t2;
t57 = EllipticF(t53, t56);
t63 = x1 / 0.15625e5;
t64 = t22 / 0.1250e4;
t72 = EllipticE(t53, t56);
t83 = 0.1e1 / t13;
t85 = 0.1e1 / (3 + t2);
t88 = sqrt(t85 * t83 * t2 * (-3 + t1));
t93 = sqrt(t85 * (3 + t1) * t2);
t95 = t22 ^ 2;
t97 = t22 * x1;
t102 = sqrt((3515625 * t95 - 562500 * t97 + 15000 * t22 + 600 * x1 + 244140629));
t106 = sqrt(-t85 * (-3 + t2) * t13);
t107 = t106 * t102;
t108 = 3 * t1;
t109 = 3 * t2;
t114 = sqrt(0.1e1 / (t108 + t3 + t109 + (15-46875*i)) * (t108 - t3 - t109 + (15-46875*i)));
t116 = t83 * (t1 + t2);
t117 = EllipticE(t114, t116);
t128 = EllipticF(t114, t116);
t132 = x1 - 0.1e1 / 0.25e2;
t139 = sqrt((858306898828125 * t95 - 137329103812500 * t97 + 3662109435000 * t22 + 146484377400 * x1 + 59604646728515641));
t159 = (0.1e1 / 0.1609325600097658950e19+0.125e3 / 0.64373024003906358e17*i) * t34 * t2 / t102 * (t57 * t39 * (t2 * (t1 * ((-0.2e1 / 0.5859375e7+0.2e1 / 0.1875e4*i) + (0.2e1 / 0.234375e6-0.2e1 / 0.75e2*i) * x1) + (0.48828133e8 / 0.5859375e7+0.1e1 / 0.625e3*i) + (0.1e1 / 0.3125e4+1*i) * t22 + (-0.2e1 / 0.78125e5-0.2e1 / 0.25e2*i) * x1) + t1 * ((0.16276039e8 / 0.1953125e7+0.13e2 / 0.1875e4*i) + t27 + t28) + (0.19531252e8 / 0.390625e6) - (0.19531252e8 / 0.15625e5 * x1)) * t18 - (0.2e1 / 0.5e1) * t72 * t39 * (t2 * (t1 * (-0.1e1 / 0.1171875e7 + x1 / 0.46875e5) - t63 + (0.4e1 / 0.1171875e7-0.1e1 / 0.150e3*i) + t64) + t1 * (-t64 + t63 + (-0.4e1 / 0.1171875e7+0.1e1 / 0.150e3*i)) + (0.1e1 / 0.78125e5-0.1e1 / 0.25e2*i) + (-0.1e1 / 0.3125e4+1*i) * x1) * t18 - 2 * t117 * t107 * t93 * t88 * (t2 * ((-0.8e1 / 0.15625e5+1*i) + (0.2e1 / 0.15625e5) * t1) + (-0.6e1 / 0.3125e4+6*i) + (0.8e1 / 0.15625e5-i) * t1) - (0.4e1 / 0.5e1) * t128 * t107 * (t2 * ((0.48828133e8 / 0.6250e4+0.3e1 / 0.2e1*i) + (-0.1e1 / 0.3125e4+1*i) * t1) + (0.29296878e8 / 0.625e3) + (0.48828117e8 / 0.6250e4+0.13e2 / 0.2e1*i) * t1) * t93 * t88 + t102 * ((0.3e1 / 0.3125e4) * t139 * t132 * t2 + (-0.292968762e9 / 0.3125e4-18*i) + (0.732421947e9 / 0.78125e5+6*i) * t2) + 11250 * t34 * (t2 * t132 * (-(0.3e1 / 0.25e2 * t22) + (0.6e1 / 0.625e3 * x1) + (0.2e1 / 0.15625e5+1*i)) / 75 + (0.48828127e8 / 0.5859375e7+0.1e1 / 0.625e3*i) + t27 + t28));

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by