On Mar 25, 9:59 pm, ancienthart <[email protected]> wrote:
> Hi guys, back again.
> It seems that I can never find what I look for in the reference documents,
> but it always becomes embarrassingly easy once someone explains it to me.
>
> I've been playing around with the displacement reaction for viscous drag
> ballistics, and have derived the following equation:
>
> final = s == t*v_t + ((v_0 - v_t)/k)*(1 - e^(-k*t)) + s_0
>
> Now one treatment suggests replacing s, s_0, v_t and v_0 with 3 dimensional
> vectors, so that you can calculate all dimensions in one go, but when I
> attempt to do the following:
>
> final.subs(s_0 == vector([0,0,0]))
>
> I get:
> TypeError: subs takes either a set of keyword arguments, a dictionary,
> or a symbolic relational expression
>
> I'm assuming that I need to define the original equation in a vector space,
> but have no idea how to do this.
> Any suggestions?
Hi Joal,
I'm not sure whether we can do vector substitution like that. I know
that Jason Grout has worked a lot on making vector stuff a lot more
natural, such as you are suggesting (differentiating all three at once
if it makes sense, for instance?). I'm not sure this is currently
possible under any syntax. It certainly wouldn't be if s is just a
variable.
Unfortunately, we don't support making two vectors == each other
symbolically.
sage: var('t1,t2,t3,v_01,v_02,v_03,v_t1,v_t2,v_t3,s_01,s_02,s_03,k')
(t1, t2, t3, v_01, v_02, v_03, v_t1, v_t2, v_t3, s_01, s_02, s_03, k)
sage: v_t=vector([v_t1,v_t2,v_t3])
sage: v_0=vector([v_01,v_02,v_03])
sage: s_0=vector([s_01,s_02,s_03])
sage: var('t')
t
sage: var('s_1,s_2,s_3')
(s_1, s_2, s_3)
sage: s = vector([s_1,s_2,s_3])
sage: s
(s_1, s_2, s_3)
sage: t*v_t+((v_0-v_t)/k)*(1-e^(-k*t))+s_0
(t*v_t1 - (e^(-k*t) - 1)*(v_01 - v_t1)/k + s_01, t*v_t2 - (e^(-k*t) -
1)*(v_02 - v_t2)/k + s_02, t*v_t3 - (e^(-k*t) - 1)*(v_03 - v_t3)/k +
s_03)
sage: s == t*v_t+((v_0-v_t)/k)*(1-e^(-k*t))+s_0
False
It just compares them. But even doing s-(the stuff) still won't allow
the syntax you have, at least not easily.
- kcrisman
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org