maxima

Maxima block and variable

自闭症网瘾萝莉.ら 提交于 2019-12-12 03:45:38
问题 I want to display the square of numbers 1 to 5 using block command: expr : 10*i; myList (expr, iMin, iMax) := block( local(expr), print(expr), print(''expr), print( makelist(expr, i, iMin, iMax)), print( makelist(''expr, i, iMin, iMax)) )$ ai : i^2$ myList (ai,1,5); Here's what I get with this code: i^2 10*i [i^2,i^2,i^2,i^2,i^2] [10,20,30,40,50] Why the "expr" variable (with quote quote) in the myList is not the variable "ai"? 回答1: The short answer is that quote-quote is applied only at the

side-effects using declare(var,constant) in Maxima

半腔热情 提交于 2019-12-11 13:46:12
问题 In maxima, is the following behavior intended? First example: (%i1) declare(a,constant); (%o1) done (%i2) constantp(a); (%o2) true (%i3) square(a):=a^2; define: in definition of square, found bad argument a -- an error. To debug this try: debugmode(true); (%i4) load("linearalgebra.mac"); define: in definition of dotproduct, found bad argument a -- an error. To debug this try: debugmode(true); Second example: (%i1) a:5; (%o1) 5 (%i2) constantp(a); (%o2) true (%i3) square(a):=a^2; 2 (%o3)

How to order variables in Maxima?

让人想犯罪 __ 提交于 2019-12-11 12:59:02
问题 I want to give variables a specific order in an equation in Maxima. This is display purposes only. For example: (%i1) E=(h*c)/%lambda; c h (%o1) E = ------- %lambda I want the h and c variables to be in that order when displayed. I looked at ratvars() and ordergreat() but they don't appear to be relevant here. Thanks for your help. 回答1: It appears that declare(<var>, mainvar) was what I was looking for. When mainvar attribute is declared for a variable it "succeeds all other constants and

How do I use lhs and rhs to define a function?

烂漫一生 提交于 2019-12-11 12:04:14
问题 In the Maxima session below, how come f (1) is not 0? (%i1) eq: 2 * x + 1 = 3; (%o1) 2 x + 1 = 3 (%i2) f(x) := lhs(eq) - rhs(eq); (%o2) f(x) := lhs(eq) - rhs(eq) (%i3) f(1); (%o3) 2 x - 2 回答1: the process of function calling in maxima here binds x to 1 in the function definition, lhs(eq)-rhs(eq). That has no x in it, so that binding does nothing. Next, lhs(eq) is evaluated to 2*x+1. rhs(eq) is evaluated to 3. etc. Do you always want the same equation eq? perhaps you want to do define(f(x),lhs

syntax error In Maxima load and batch

◇◆丶佛笑我妖孽 提交于 2019-12-11 08:23:55
问题 I saved a file using save("/Users/iaingray/.maxima/temp.mac",[1,2]); which is in my file_search_maxima; path I then tried load(temp); and batch(temp); which both failed with stdin:1:incorrect syntax: Premature termination of input at ;. Maxima 5.30.0, imaxima(emacs) and wxMaxima, Mac OSX 10.9.1 Any suggestions? Iain 回答1: save creates a Lisp file, not a Maxima file. Give the file a name which ends with .lisp and load it via load . 来源: https://stackoverflow.com/questions/21778476/syntax-error

Maxima plotting in a loop, must shut one plot to see the next one

女生的网名这么多〃 提交于 2019-12-11 06:53:53
问题 Maxima plotting in a loop, must shut one plot to see the next one. Iam working in windows environment, but in linux will the function plotted in one view. For example this function : for d:0.1 thru 1 step 0.1 do draw2d(explicit(x^d,x,0,1)); I have also tried this: set_plot_option(['plot_format, 'gnuplot_pipes]); But this didnt solve it. Is there an option, where i can set the plotting in one view? Thank you. 回答1: You could make a list of curves in the loop and plot them all on a single graph.

Show input in Symbolic form without computation in Maxima

荒凉一梦 提交于 2019-12-11 06:07:58
问题 In Maxima when I enter for example: I can see my input in a "readable" way, in order to verify everything I have typed in is interpreted the way I want. I want to be able to at first see my input in symbolic form and after that the result of my computation. For example when I define x as 5 I want the same result as above and after that the simplified form. Is that possible? I use wxmaxima. Another simple example for illustration: When I enter 5*5 I want an output saying 5 5 and then a second

Force evaluate index expression before passing to sum()

南楼画角 提交于 2019-12-11 03:32:20
问题 I want to write an (somehow) enhanced sum function which takes a number of indices at once, but I cannot understand how to get it work. Here is what I currently have: (%i1) nsum(indexes, expr) := if indexes = [] then expr else nsum(rest(indexes), sum(expr, first(indexes),1, N)) $ (%i2) nsum([i,j], i+j), nouns; sum: index must be a symbol; found intosym(first(indexes)) #0: nsum(indexes=[k,j],expr=k+j) I think this could be fixed by forcing Maxima expand first(indexes) into a symbol before

How to assign the output of solve in maxima to a variable?

China☆狼群 提交于 2019-12-10 23:59:59
问题 I am using xmaxima to solve two simultaneous non-linear equations using the 'solve' command.The answer displayed is x=[ans1, ans2,..], y=[ans1,ans2,...], But it is'int getting stored onto the variable 'x' and 'y' . How do I assign the output to a variable so that I can use the output for further calculations. The xmaxima code is as below: A:0.500000000000000$ B:0.709506070053745$ C:0.242527534593605$ D:0.719012140107490$ E: 0.357164044380080$ F:-0.505315948652670$ G:0.181895650945204$ H: 0

In MAXIMA, how do I get entire call stack printed?

僤鯓⒐⒋嵵緔 提交于 2019-12-10 11:38:18
问题 Sorry if this is a novice question, but I couldn't find any documentation or other stackoverflow questions on this. I want to see entire stack trace of all maxima functions called in solving an expression or an equation. I tried trace, backtrace, and debugmode. Looked at different display and print functions, but none worked. Example1: (%i1) is(equal( (a+b)^2, a^2+b^2+2*a*b )); (%o1) true Example2: (%i2) trace(factor); (%o2) [factor] (%i3) trace_options(factor, info); (%o3) [info] (%i4)