I think the Type Error is coming from your use of the round function.
If I run: -

H, p, Pole1, Pole2, Pole3, Ts, z, f = var("H p Pole1 Pole2 Pole3 Ts z
f")
p = (2/Ts)*(z-1)/(z+1)
z = exp(I*2*pi*Ts*f)

r=2*2*pi
Pole1=r*exp(I*2*pi/3)
Pole2=-r
Pole3=r*exp(-I*2*pi/3)
Ts=0.1

H = lambda p: (p^3)/((p-Pole1)*(p-Pole2)*(p-Pole3))

H(4).abs();

I get

64/(64*pi^3 + 128*pi^2 + 128*pi + 64)

and if I run: -

type(H(4).abs())

I get

<class 'sage.calculus.calculus.SymbolicComposition'>

so it looks like you need to coerce this to a real then a float :-

>From 
>http://sage.math.washington.edu/home/mhansen/sage-epydoc/sage.calculus.calculus.SymbolicComposition-class.html

round(H(4).abs().real(), 5)

to get 0.01723

I am very new to Sage but I must say I am very much liking it :)

On Dec 9, 7:52 pm, Sand Wraith <[EMAIL PROTECTED]> wrote:
> this
> round(H.substitute(f=4).abs(),4)
> give same error again...
> then this:
> round(RDF(H.substitute(f=4).abs()),4)
> takes so much time, can't wait...
>
> On Dec 9, 10:42 pm, Sand Wraith <[EMAIL PROTECTED]> wrote:
>
> > you mean for f? this:
>
> > round(H.substitute(f=1),4)
>
> > gives type error again :-(
>
> > On Dec 9, 9:51 pm, Tim Lahey <[EMAIL PROTECTED]> wrote:
>
> > > On Dec 9, 2008, at 1:46 PM, Sand Wraith wrote:
>
> > > > thank you! ))
>
> > > > but I need to use my values, now just variables (Ts,Pole1 etc)
>
> > > > I was trying this:
>
> > > > r=2*2*pi
> > > > Pole1=r*exp(I*2*pi/3)
> > > > Pole2=-r
> > > > Pole3=r*exp(-I*2*pi/3)
> > > > Ts=0.1
>
> > > > z = exp(I*2*pi*Ts*f)
> > > > p = (2/Ts)*(z-1)/(z+1)
> > > > H = (p^3)/((p-Pole1)*(p-Pole2)*(p-Pole3))
> > > > show(H)
>
> > > > show() works fine, but if i want to use H function now:
>
> > > > round(H(4).abs(),5)
>
> > > > a have got "Type error" message :-\
>
> > > H as you've defined it isn't a function, it's an expression. Check
> > > the type so H(4) doesn't mean anything. You could try subs and
> > > substitute for p (I assume that's what you want evaluated at 4.
>
> > > Cheers,
>
> > > Tim.
>
> > > ---
> > > Tim Lahey
> > > PhD Candidate, Systems Design Engineering
> > > University of Waterloohttp://www.linkedin.com/in/timlahey
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to