Here is my error code that I get when trying to define the Lagrangian:
Python 2.7.5 (default, May 15 2013, 22:44:16) [MSC v.1500 64 bit (AMD64)]
on win32
Type "copyright", "credits" or "license()" for more information.
>>> from sympy import *
>>> x, y, l=symbols('x, y, l')
>>> A=Function('A')
>>> o = raw_input("Enter objective function:")
Enter objective function:x*y
>>> b = raw_input("Enter budget constraint: please set expression equal to
0 and enter the nonzero side:")
Enter budget constraint: please set expression equal to 0 and enter the
nonzero side:x+y-1
>>> sympify(o)
x*y
>>> sympify(b)
x + y - 1
>>> A=o-l*b
Traceback (most recent call last):
File "<pyshell#7>", line 1, in <module>
A=o-l*b
TypeError: can't multiply sequence by non-int of type 'Symbol'
>>>
On Monday, August 19, 2013 3:38:16 PM UTC-7, Philip Liang wrote:
>
> Given an objective function o and budget constraint b inputted by the
> user, I want to define the langrangian A as A=o-l*b, where l is a variable.
> How do I do this?
>
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
For more options, visit https://groups.google.com/groups/opt_out.