Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8222585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T14:19:49+00:00 2026-06-07T14:19:49+00:00

I have a question about Sage/Python, but I’m sure it’s a very general CS

  • 0

I have a question about Sage/Python, but I’m sure it’s a very general CS question. I have a large system of N non-linear equations in N variables. Before I pass it off to a numerical solver, I try and let Sage simplify the equations using solve. When working through a simple example, I have the following: ‘eqa’ is a list of equations to solve in the variables x0, x1, w0, w1, etc. The following works just fine from the command line:

 j(x0,x1,w0,w1,y0,y1,z0,z1) = solve(eqa, var('x0 x1 w0 w1 y0 y1 z0 z1'))

(I’m trying to define the list of equations as a ‘callable symbolic expression’ (Sage) because the numerical optimization I use works better with these rather than normal def python functions.)

In any case, when I include this in a script and try to load it, I get the error:

     j(x0,x1,w0,w1,y0,y1,z0,z1) = solve(eqa, var('x0 x1 w0 w1 y0 y1 z0 z1'))
SyntaxError: can't assign to function call

I know I must be doing something wrong at the command line and its just working by some dumb luck. Or is special care needed when defining these callable symbolic expressions in a script? Thanks for any insight you can provide. Here is a link on the difference between these types of ‘functions’

http://www.sagemath.org/doc/tutorial/tour_functions.html

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T14:19:50+00:00Added an answer on June 7, 2026 at 2:19 pm

    This way of defining functions is Sage-specific, and forbidden by standard Python syntax. My guess is that either (1) you’re trying to run your script using Python, or (2) you’re using Sage, but your filename ends with .py and so Sage is interpreting it as a Python file.

    For example:

    ~/coding$ cat test.sage 
    f(x, y) = 3*x+y
    print f(3,4)
    
    ~/coding$ sage test.sage 
    13
    ~/coding$ cp test.sage test.py
    ~/coding$ sage test.py
      File "test.py", line 1
        f(x, y) = 3*x+y
    SyntaxError: can't assign to function call
    ~/coding$ python test.py
      File "test.py", line 1
        f(x, y) = 3*x+y
    SyntaxError: can't assign to function call
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have question about interpreting strings as packed binary data in C++. In python,
I saw a lot of examples of CopyStream implementation but I have question about
I have a question about how the System class works. Lets say there is
I have question about Dictionaries in Python. here it is: I have a dict
please help me, i'm very newbie i have question about datatables (jquery plug in)
I have question about python and sqlite3. I want to drop a table from
Today I have question about Eclipse . I use this IDE very long and
I have question about clean thory in Python. When: @decorator_func def func(bla, alba): pass
I have question about normalization. Suppose I have an applications dealing with songs. First
i have question about YAJLiOS parser... I have next json data : {{ body

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.