1 | initial version |
Given the fact that you have numerical parameters, i guess you want to obtain a numerical answer, not a symbolic one (which would not be very meaningful). So, instead of defining ISlice
as a symbolic formula, you can make it a classical Python function, and use numerical_integral
as follows:
sage: ISlice = lambda a,b : numerical_integral(ILine(x,a,b),0,2*rRopeMeters)
sage: ISlice(3,4)
(0.0039653374286522155, 3.5934168930166043e-07)
So, unless Sage is wrong somewhere, the numerical value of ISlice(3,4) is 0.0039653374286522155, with a precision of 3.6e-07.
Note: actually, you should do the same for the other functions, so that you do not have to use symbolic variable, nor symbolic functions:
sage: dSpringStretchedFully=10.625
....: dSpringUnstretchedLength=7.875
....: dArmatureInches=8
....: dSpringAnchor=4.75
....: thetaArmatureDefault=95
....: dSpringPitch=dSpringUnstretchedLength/sin(thetaArmatureDefault*pi/180)*sin(pi/180*(180-thetaArmatureDefault-(180/pi*arcsin(dSpringAnchor*sin(thetaArmatureDefault*pi/180)/dSpringUnstretchedLength))))
....: fSpringPoundsPerInch=65.69
....: kNewtonsPerPound=4.44822
....: kMetersPerInch=0.0254
....: fSpringNewtonsPerInch=fSpringPoundsPerInch*kNewtonsPerPound
....: dArmatureMeters=dArmatureInches*kMetersPerInch
....: dHalfRopeInches=dArmatureInches*cos(pi/180*(thetaArmatureDefault-90))
....: dHalfRopeMeters=dHalfRopeInches*kMetersPerInch
....: fSpringNewtonsPerMeter=fSpringNewtonsPerInch/kMetersPerInch
....: fSpringMinimumLoad=0
....: kSpringDirection=1
....: rRopeInches=0.5
....: rRopeMeters=rRopeInches*kMetersPerInch
....: thetaPointToAxis = lambda x,thetaArmatureToRope :thetaArmatureToRope-(180/pi*arctan((x-rRopeMeters)/dArmatureMeters))
....: dPointFromFarAxis = lambda x, dHalfRope : ((dHalfRope^2)+(x-rRopeMeters)^2)^(1/2)
....: dPointFromNearAxis = lambda x, dHalfRope,thetaArmatureToRope : ((dArmatureMeters^2)+((dPointFromFarAxis(x,dHalfRope))^2)-2*dPointFromFarAxis(x,dHalfRope)*dArmatureMeters*cos(pi/180*thetaPointToAxis(x,thetaArmatureToRope)))^(1/2)
....: IMultiplier = lambda x : 2*(((rRopeMeters^2)-(x-rRopeMeters)^2)^(1/2))
....: ILine = lambda x,dHalfRope,thetaArmatureToRope : ((dPointFromNearAxis(x,dHalfRope, thetaArmatureToRope))^2)*IMultiplier(x)
....: ISlice = lambda dHalfRope,thetaArmatureToRope : numerical_integral(ILine(x,dHalfRope,thetaArmatureToRope),0,2*rRopeMeters)
....: ISlice(3,4)
....:
(0.0039653374286522155, 3.5934168930166043e-07)