On Tue, Jan 15, 2013 at 7:32 PM, Eric Kangas <[email protected]> wrote:
> Hi,
>
>      I am using sage 5.6 on cantor 0.3. I am working on trying to find the
> eigenvalues, and vectors for a damped harmonic oscillator. I am using the
> form using the undamped angular frequency of the oscillator, and damping
> ratio.
>
> code:
> 'define in variables'
>
> c,k,l,m,x,y,u,v,xdot,ydot,udot,vdot =
> var('c,k,l,m,x,y,u,v,xdot,ydot,udot,vdot', domain = RR)
>
> I = var('I', domain = QQ)
>
>
> 'undamped angular frequency'
>
> s = c/(2*sqrt(m*k))
>
>
> 'damping ratio'
>
> wo=sqrt(k/m)
>
>
> 'first ode equations for the damping oscillator'
>
> xdot = u;
>
> ydot = v;
>
> -udot = 2*s*wo*u+(wo^2)*x;
>
> -vdot = 2*s*wo*v+(wo^2)*y;
>


sage: 'define in variables'
'define in variables'
sage: c,k,l,m,x,y,u,v,xdot,ydot,udot,vdot =
var('c,k,l,m,x,y,u,v,xdot,ydot,udot,vdot', domain = RR)
sage: I = var('I', domain = QQ)
sage:
sage: 'undamped angular frequency'
'undamped angular frequency'
sage: s = c/(2*sqrt(m*k))
sage:
sage: 'damping ratio'
'damping ratio'
sage: wo=sqrt(k/m)
sage:
sage: 'first ode equations for the damping oscillator'
'first ode equations for the damping oscillator'
sage: xdot = u;
sage: ydot = v;
sage: -udot == 2*s*wo*u+(wo^2)*x;
sage: -vdot == 2*s*wo*v+(wo^2)*y;

worked for me. Did you know that you do not need semi-colons in Python?
That is maple notation and GAP notation. Also, in Python, =
is an assignment operator. == is used if you want to write down an equation,
eg

sage: eqn = 1==2
sage: bool(eqn)
False


>
> I get an error at this point:
>
> ------------------------------------------------------------
> File "<ipython console>", line 1
> SyntaxError: can't assign to operator (<ipython console>, line 1)
> ------------------------------------------------------------
> File "<ipython console>", line 1
> SyntaxError: can't assign to operator (<ipython console>, line 1)
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> Visit this group at http://groups.google.com/group/sage-support?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
Visit this group at http://groups.google.com/group/sage-support?hl=en.


Reply via email to