RE: Constant function Integrate Assumption - More

*To*: mathgroup at smc.vnet.net*Subject*: [mg47292] RE: [mg47252] Constant function Integrate Assumption - More*From*: "David Park" <djmp at earthlink.net>*Date*: Fri, 2 Apr 2004 03:31:11 -0500 (EST)*Sender*: owner-wri-mathgroup at wolfram.com

Daryl, My indirect reply to your question was posted today. Here I reply to your more recent posting. The solution to this problem is to first keep units out of the symbolic equations, and second to use the V4ExtendUnits package from my web site, which handles units in DiracDelta, UnitStep and two argument ArcTan expressions. Here is how I would do your calculation with ExtendUnits. Needs["Miscellaneous`V4ExtendUnits`"] First I install a new unit, Widget. You might install units for any item that is manufactured. In this case Widget is actually unitless, since it is a count. InstallNewUnit[Widget -> 1] Now I set up the data for your calculation. The units always go with the numbers. The units are part of the data. The units should not explicitly appear in your symbolic equations. data = {t0 -> 5 Month, baserate -> 50000 Widget/Year}; Now we define the total units function. Notice - no units! totalunits[t_] = baserate*Integrate[UnitStep[t - t0], t] If you want to calculate the total units after 8 months (doing it in steps)... totalunits[8Month] % /. data % // ToUnit[Widget] baserate (8 Month - t0) UnitStep[8 Month - t0] (150000*Month*Widget*UnitStep[3*Month])/Year 12500. Widget Or all at once... totalunits[8 Month] /. data // ToUnit[Widget] 12500. Widget Suppose you want to create a function to plot. We have to get rid of all the units and use implied units. This is done with the Deunitize function. nwidgets[t_] = Deunitize[totalunits[t Month] /. data, {t}] 0.00158549 (-13140000 + 2628000 t) UnitStep[-13140000 + 2628000 t] Plot[nwidgets[t], {t, 0, 17}, PlotRange -> All, AxesLabel -> {Months, Widgets}]; If you want a formula for the Gross number of widgets as a function of years you can use... nwidgets2[t_] = Deunitize[totalunits[t Year]/Gross /. data, {t}] 0.0000110103 (-13140000 + 31536000 t) UnitStep[-13140000 + 31536000 t] Plot[nwidgets2[t], {t, 0, 3}, PlotRange -> All, AxesLabel -> {Years, "Gross Widgets"}]; David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ From: Reece, Daryl [mailto:Daryl.Reece at goody.com] To: mathgroup at smc.vnet.net Many thanks to everyone offering solutions to my dilemma. In trying to simplify the problem, I must have slipped up and oversimplified. Specifically I want to start with Integrate[50000 Units/Year UnitStep[(t-5 Month)/Month], t] and receive 50000 Units/Year (t-5 Month) UnitStep[(t-5 Month)/Month]. I need the full answer so that the units work out correctly in the answer. I am starting with a sale rate and want to derive the total sales as a function of time. This time may then be input as Days, Months, Years.... If I perform the replace operation, as many of you suggest, this ability disappears. A lister rightly pointed out that Mathematica is confused not because it assumes that Month may be a function of t, but rather it does not know the sign of Month. Even using the assumption Month>0 does not fix the problem. Other suggestions?