Re: Re: Re: Condition/constraint problem
- To: mathgroup at smc.vnet.net
- Subject: [mg40991] Re: [mg40976] Re: [mg40938] Re: Condition/constraint problem
- From: Bobby Treat <drmajorbob+MathGroup3528 at mailblocks.com>
- Date: Sun, 27 Apr 2003 03:20:12 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
There may be a precision issue, but the original results aren't centered around the right function, as this shows very clearly: vx1[t_] := 0.0015 + 0.0012 Sin[70 t] /; t < 5 vx2[t_] := 0.0015 + 0.0012 Sin[70 t] fin1 = Dt[vx1[t], t]; fin2 = Dt[vx2[t], t] fin3 = Chop@Fit[data1, {Sin[70t], Cos[70t]}, t] Plot[fin1 - fin3, {t, 0, 2}, PlotPoints -> 100, PlotRange -> All] 0.08399999999999999*Cos[70*t] -0.04011015563218277*Cos[70*t] Mathematica has settled on the wrong derivative. Here's an attempt to get at the precision issue. data3 = {t, Derivative[ 1][vx1][t]} /. List /@ Thread[t -> SetPrecision[data1[[All, 1]], 20]]; mean = Tr@#/Length@# &; mean@Abs@(data3[[All, 2]] - data1[[All, 2]]) 0.0457237 These differences are much too large to attribute to precision problems. Finally, look at this: fin4 = Chop@Fit[data3, {1, Sin[70t], Cos[70t]}, t] 0.0125385 Cos[70 t] Mathematica has simply settled on another wrong derivative. The following answers puzzle me, as the precision of the input doesn't seem to affect the output. {fin1, fin2, fin3, fin4} /. t -> 2. {0.00793433, -0.0166163, 0.00793433, -0.00248029} {fin1, fin2, fin3, fin4} /. t -> 2.`50 {-0.0166163, -0.0166163, 0.00793433, -0.00248029} Bobby -----Original Message----- From: Andrzej Kozlowski <akoz at mimuw.edu.pl> To: mathgroup at smc.vnet.net <kuska at informatik.uni-leipzig.de>; u8514501 at cc.nctu.edu.tw Subject: [mg40991] Re: [mg40976] Re: [mg40938] Re: Condition/constraint problem This seems to be just an accuracy problem due to the very rapidly oscillating nature of the function. You need much more accurate input, and even then the answers won't be exactly the same: In[1]:= vx1[t_] := 3/2000 + (3*Sin[70*t])/2500 /; t < 5 In[2]:= vx2[t_] := 3/2000 + (3*Sin[70*t])/2500 In[3]:= Derivative[1][vx1][2.`50] Out[3]= -0.016616340216276107118073957504289560620917139256026603482\ 40545`46.5497 In[4]:= Derivative[1][vx2][2.`50] Out[4]= -0.016616340216358530300150292495099072037728048646002646485\ 71143`47.1588 Andrzej Kozlowski Yokohama, Japan http://www.mimuw.edu.pl/~akoz/ http://platon.c.u-tokyo.ac.jp/andrzej/ On Saturday, April 26, 2003, at 04:26 pm, Bobby Treat wrote: > Your explanation implies there IS no value for vx1'[t], but Mathematica > does compute one, when t is numeric. It's simply wrong. > > vx1[t_] := 0.0015 + 0.0012 Sin[70 t] /; t < 5 > vx2[t_] := 0.0015 + 0.0012 Sin[70 t] > vx1'[2.] > vx2'[2.] > > 0.00793433 > -0.0166163 > > Bobby > > -----Original Message----- > From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de> To: mathgroup at smc.vnet.net > To: mathgroup at smc.vnet.net > Subject: [mg40991] [mg40976] [mg40938] Re: Condition/constraint problem > > Hi, > > der derivative is complete right, since > Condition[] has no derivative > > Dt[vx1[t]] evaluates to vx1'[t] > > until you can tell Mathematica how to > find out > a) what the function value of vx1[t] for t>5 may be > b) to compute the derivative for t==5 > c) determine when the symbol t in vx1[t] may be >5 > > > Regards > Jens > Bamboo wrote: >> >> Dear all, >> >> I find a problem and don't know why. The input is as following. >> If a condiction(constraint) is set to the function, vx1[t], >> the derivative of vx1[t] is worng (fin1 is not equal to fin2). >> Any help welcome. >> >> vx1[t_] : = 0.0015 + 0.0012 Sin[70 t] /; t < 5 >> vx2[t_] : = 0.0015 + 0.0012 Sin[70 t] >> fin1 = Dt[vx1[t], t] >> fin2 = Dt[vx2[t], t] >> Plot[fin1, {t, 0, 2}] >> Plot[fin2, {t, 0, 2}] >> >> Thanks, >> Bamboo > > >