Assuming in a physic system, an object move from one point to anther point. During the movement, the acceleration changes with time t. In the first t1 seconds, a=t; In the following t2 seconds, a = 0.5t. Then I wrote the code as follows:
t1 = 1; t2 = 3;
acceleration =
Piecewise[{{ t, 0 <= t < t1}, {0.5 t, t1 < t <= t1 + t2}}]
velocity = Integrate[acceleration, t]
Plot[acceleration, {t, 0, t1 + t2}]
Plot[velocity, {t, 0, t1 + t2}]
And the result looks nice:
How ever, if in another application, I want to set t1 and t2 as adjustable parameter using the following code:
t1 =.; t2 =.;
acceleration =
Piecewise[{{ t, 0 <= t < t1}, {0.5 t, t1 < t <= t1 + t2}}]
velocity = Integrate[acceleration, t]
Then set t1=1, t2=3 and plot?
t1 = 1; t2 = 3;
Plot[acceleration, {t, 0, t1 + t2},]
Plot[velocity, {t, 0, t1 + t2}]
The result is totally different:
The reason why I want to set it parameter-driven is I want to get a function like v=f[t,t1,t2] which can be used in Excel calculation.
Any one could point out why in the second part of the codes doesn't the result seem reasonable?
And who can suggest a way to realize the parameter-driven system?