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

  • Home
  • SEARCH
  • 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 8810123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:03:01+00:00 2026-06-14T03:03:01+00:00

In Maxima, I’d like to numerically solve a system of differential equations in an

  • 0

In Maxima, I’d like to numerically solve a system of differential equations in an arbitrary number of variables x[1] … x[n], using the rk function. I use square brackets in the variable name so that I can index the variables in a for loop. Here is an example call to rk when n = 2:

rk([derivativeOfX[1],-2*x[1]+x[2],derivativeOfX[2],x[1]-2*x[2]], [X[1],derivativeOfX[1],X[2],derivativeOfX[2]], [1,1,2,0], [t,0,10,0.1])

Unfortunately, I get the error:

define: in definition of f_rk_4, found bad argument X[1]

If I manually replace X[1] with x1 and X[2] with x2, the error goes away:

rk([derivativeOfX1,-2*x1+x2,derivativeOfX2,x1-2*x2], [x1,derivativeOfX1,x2,derivativeOfX2], [1,1,2,0], [t,0,10,0.1]); 

It seems that rk doesn’t like the square brackets in the variable names, but I need them in order to index the variables in a for loop. What should I do?

  • 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-14T03:03:02+00:00Added an answer on June 14, 2026 at 3:03 am

    A simple solution is to have two sets of variables. In the loop you use x[1] and x[2]. Before your rk(…) expression, set x1 equal to x[1] and x2 equal to x[2]. Call rk. Then store x1 in x[1] and x2 in x[2].

    Note that you can generate variable names using concat. For example concat(‘x, 1) will produce the symbol x1.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write a general solver for a linear system in Maxima using
In Maxima there are some function accept variable arguments like diag_matrix( a1,a2,...,an), which is
alt text http://img185.imageshack.us/img185/2080/mydiagram.png Maxima.exe is a Computer Algebra System built as a native code
Can you suggest a module function from numpy/scipy that can find local maxima/minima in
I have run across several posts and articles that suggests using things like simulated
I want to use a function's derivative in an other function. How should this
Using scipy's interpolate.splprep function get a parametric spline on parameter u , but the
I want to encode a number which would be maximal 10 digits long using
Is there a way in Maxima to assign values to a list of variables?
I have an input like following. Curveplot Time Maxima of Curve Part no. 13

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.