Here it is..  I'm totally new to this, so feel free to comment on my
code in general.

F, F_3, F_1, l, M = var('F, F_3, F_1, l, M')
a, a_1, mu, a_4, theta = var('a, a_1, mu, a_4, theta')

eqn1 = F_3 * l / 2 + M - F_1 * l / 2 == 0

eqn2 = F_1 == F * (a / a_1) * (1 - (mu * a_4) / (a*(sin(theta) + mu *
cos(theta))))

eqn3 = F_3 == (F * a - F_1 * (a_1 + mu * a_4)) / (mu * a_4)

sln = solve([eqn1, eqn2, eqn3], [M, F_1, F_3])
sln = simplify(sln[0])

#Function Moment_____________________________
def Moment(sln, mu_):

        eqns = [sln[0], mu == mu_, a == 255, a_1 == 155, a_4 == 200, theta ==
pi/9, l == 100, F == 650000]
        vars = [M, mu, a, a_1, a_4, theta, l, F]
        sln = solve(eqns, vars, solution_dict = True)
        sln = simplify(sln[0])
        return sln[M].n(10)

#End Function Moment________________________

print Moment(sln, 0.01)

plot(Moment(sln, mu), mu, 0, 0.1)

#End

/Peter

On Feb 21, 4:11 pm, David Joyner <wdjoy...@gmail.com> wrote:
> Can you take the function you are trying to plot,
> reduce it to the simplest expression which will
> reproduce the same error and post it? Can you
> also include the OS and version of Sage?
>
> On Sat, Feb 21, 2009 at 10:02 AM, hpon <peter.norli...@gmail.com> wrote:
>
> > It doesn't work with the function I'm using.  Although, "print Moment
> > (sln, mu)", where mu is the variable, yields a real numeric result in
> > what appears to be the entire range of mu.
>
> > This is the plot command: plot(Moment(sln, mu), mu, 0, 1)
>
> > The error message points at the return statement of the Moment-
> > function: return sln[M].n(4)
>
> > Later on the error message points at some internal approximation
> > command trying to return a complex result.
>
> > I have no idea of how to interpret this.  Appreciate all suggestions.
>
> > /Peter
>
> > On Feb 21, 3:29 pm, David Joyner <wdjoy...@gmail.com> wrote:
> >> This is one way:
>
> >> sage: x,y = var("x,y")
> >> sage: f = x^2+y^2
> >> sage: plot(f(x,3),x,-1,1)
>
> >> On Sat, Feb 21, 2009 at 9:22 AM, hpon <peter.norli...@gmail.com> wrote:
>
> >> > Hello,
>
> >> > I have created a function F = F(x, const).  I would like to create a
> >> > 2D-plot of F in some range of x.  What should the syntax look like?
>
> >> > Regards,
> >> > Peter
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to