• ベストアンサー

maximaの積分に関する質問です

maximaで積分を行っているのですが、 integrate(x,x,sqrt(y),y);と入力してその計算結果が返ってくるはずなのですが、 defint: lower limit of integration must be real; found sqrt(y) -- an error. To debug this try: debugmode(true); とエラー表示がされてこれ以上計算が進みません。どのように対処すれば うまくいくのでしょうか。

質問者が選んだベストアンサー

  • ベストアンサー
回答No.6

 maximaの記号は正負の区別がありません。 したがって、maximaの”警告”にあるように定積分の下端sqrt(y)は虚数の可能性があります。  maximaの定積分の下端、上端は実数の必要があります。 そこで sqrt(y)をsqrt(abs(y))とするか、y>0であるならば assume(y>0); として 計算すればよい。

666bluebunny
質問者

お礼

大変ありがとうございます。まだやり始めなこともあって、わかりやすくて助かりました。無事計算もできました。どうもです。

その他の回答 (5)

  • info22_
  • ベストアンサー率67% (2650/3922)
回答No.5

定積分の下限や上限に、未定義になる可能性のある文字定数(積分変数と異なる文字変数を含む)とき、同様のエラーが起こります。 未定義となる可能性がないことがないと分かっている場合は、以下のように、まず定積分を行い、それに積分の上限、下限を代入して引き算をしてやれば対処できます。 例)  fx:integrate(x,x)$  I:ev(fx,x=y)-ev(x=sqrt(y); このように定積分の上限や下限が原因で積分エラーが起こる場合は、この方法で対処できます。 やってみて下さい。

666bluebunny
質問者

お礼

ありがとうございます。さっそく行ってみます。こんなやり方もあるのかと色々参考になります。やり始めたばかりですので、わからないことだらけです。大変参考になります。

  • reiman
  • ベストアンサー率62% (102/163)
回答No.4

integrate(x,x,sqrt(abs(y)),y); とすればよいのでは? このサイトでは表示が壊れますが下の様になります (%i6) integrate(x,x,sqrt(abs(y)),y); 2 y abs(y) (%o6) -- - ------ 2 2 (%i7)

666bluebunny
質問者

お礼

なんども恐縮です。返答が遅れて申し訳ありません。一応行っていたのはサイト上に落ちている簡単なテキストに書かれたものから片っぱしに行っているので、細かい部分の補足が抜けているようです。1つの計算でもいくつもやり方があるのですね。ただ、絶対値を取るのは計算はできるとは思いますが、正しくないかもしれないと抵抗があるので、別の方法を模索します。

  • reiman
  • ベストアンサー率62% (102/163)
回答No.3

例示しているように describe(integrate); の間違いでした Examples: * Elementary indefinite and definite integrals. (%i1) integrate (sin(x)^3, x); 3 cos (x) (%o1) ------- - cos(x) 3 (%i2) integrate (x/ sqrt (b^2 - x^2), x); 2 2 (%o2) - sqrt(b - x ) (%i3) integrate (cos(x)^2 * exp(x), x, 0, %pi); %pi 3 %e 3 (%o3) ------- - - 5 5 (%i4) integrate (x^2 * exp(-x^2), x, minf, inf); sqrt(%pi) (%o4) --------- 2 * Use of `assume' and interactive query. (%i1) assume (a > 1)$ (%i2) integrate (x**a/(x+1)**(5/2), x, 0, inf); 2 a + 2 Is ------- an integer? 5 no; Is 2 a - 3 positive, negative, or zero? neg; 3 (%o2) beta(a + 1, - - a) 2 * Change of variable. There are two changes of variable in this example: one using a derivative established by `gradef', and one using the derivation `diff(r(x))' of an unspecified function `r(x)'. (%i3) gradef (q(x), sin(x**2)); (%o3) q(x) (%i4) diff (log (q (r (x))), x); d 2 (-- (r(x))) sin(r (x)) dx (%o4) ---------------------- q(r(x)) (%i5) integrate (%, x); (%o5) log(q(r(x))) * Return value contains the `'integrate' noun form. In this example, Maxima can extract one factor of the denominator of a rational function, but cannot factor the remainder or otherwise find its integral. `grind' shows the noun form `'integrate' in the result. See also `integrate_use_rootsof' for more on integrals of rational functions. (%i1) expand ((x-4) * (x^3+2*x+1)); 4 3 2 (%o1) x - 4 x + 2 x - 7 x - 4 (%i2) integrate (1/%, x); / 2 [ x + 4 x + 18 I ------------- dx ] 3 log(x - 4) / x + 2 x + 1 (%o2) ---------- - ------------------ 73 73 (%i3) grind (%); log(x-4)/73-('integrate((x^2+4*x+18)/(x^3+2*x+1),x))/73$ * Defining a function in terms of an integral. The body of a function is not evaluated when the function is defined. Thus the body of `f_1' in this example contains the noun form of `integrate'. The quote-quote operator `''' causes the integral to be evaluated, and the result becomes the body of `f_2'. (%i1) f_1 (a) := integrate (x^3, x, 1, a); 3 (%o1) f_1(a) := integrate(x , x, 1, a) (%i2) ev (f_1 (7), nouns); (%o2)

666bluebunny
質問者

お礼

ありがとうございます。さっそく頑張ってみます。

  • reiman
  • ベストアンサー率62% (102/163)
回答No.2

どういう計算をしようとしているのでしょうか? topic(integrate); を入力してみてください (%i2) describe(integrate); -- Function: integrate (<expr>, <x>) -- Function: integrate (<expr>, <x>, <a>, <b>) Attempts to symbolically compute the integral of <expr> with respect to <x>. `integrate (<expr>, <x>)' is an indefinite integral, while `integrate (<expr>, <x>, <a>, <b>)' is a definite integral, with limits of integration <a> and <b>. The limits should not contain <x>, although `integrate' does not enforce this restriction. <a> need not be less than <b>. If <b> is equal to <a>, `integrate' returns zero. See `quad_qag' and related functions for numerical approximation of definite integrals. See `residue' for computation of residues (complex integration). See `antid' for an alternative means of computing indefinite integrals. The integral (an expression free of `integrate') is returned if `integrate' succeeds. Otherwise the return value is the noun form of the integral (the quoted operator `'integrate') or an expression containing one or more noun forms. The noun form of `integrate' is displayed with an integral sign. In some circumstances it is useful to construct a noun form by hand, by quoting `integrate' with a single quote, e.g., `'integrate (<expr>, <x>)'. For example, the integral may depend on some parameters which are not yet computed. The noun may be applied to its arguments by `ev (<i>, nouns)' where <i> is the noun form of interest. `integrate' handles definite integrals separately from indefinite, and employs a range of heuristics to handle each case. Special cases of definite integrals include limits of integration equal to zero or infinity (`inf' or `minf'), trigonometric functions with limits of integration equal to zero and `%pi' or `2 %pi', rational functions, integrals related to the definitions of the `beta' and `psi' functions, and some logarithmic and trigonometric integrals. Processing rational functions may include computation of residues. If an applicable special case is not found, an attempt will be made to compute the indefinite integral and evaluate it at the limits of integration. This may include taking a limit as a limit of integration goes to infinity or negative infinity; see also `ldefint'. Special cases of indefinite integrals include trigonometric functions, exponential and logarithmic functions, and rational functions. `integrate' may also make use of a short table of elementary integrals. `integrate' may carry out a change of variable if the integrand has the form `f(g(x)) * diff(g(x), x)'. `integrate' attempts to find a subexpression `g(x)' such that the derivative of `g(x)' divides the integrand. This search may make use of derivatives defined by the `gradef' function. See also `changevar' and `antid'. If none of the preceding heuristics find the indefinite integral, the Risch algorithm is executed. The flag `risch' may be set as an `evflag', in a call to `ev' or on the command line, e.g., `ev (integrate (<expr>, <x>), risch)' or `integrate (<expr>, <x>), risch'. If `risch' is present, `integrate' calls the `risch' function without attempting heuristics first. See also `risch'. `integrate' works only with functional relations represented explicitly with the `f(x)' notation. `integrate' does not respect implicit dependencies established by the `depends' function. `integrate' may need to know some property of a parameter in the integrand. `integrate' will first consult the `assume' database, and, if the variable of interest is not there, `integrate' will ask the user. Depending on the question, suitable responses are `yes;' or `no;', or `pos;', `zero;', or `neg;'. `integrate' is not, by default, declar

noname#152422
noname#152422
回答No.1

カテ違いですな。 リファレンスマニュアルでintegrateのパラメータの並びを確認してみてください。

666bluebunny
質問者

お礼

ありがとうございます。ちと最近やり始めたもので、色々わからないので試してみます。

関連するQ&A

  • maximaで数値積分

    maximaで数値積分をしなくてはならず、「ニュートン=コートの8次多項式による求積法」を行おうと思い、読み込もうとしたところ、 (%i1)load("qq"); (%o1)Could not find `qq' using paths in file_search_maxima,file_search_lisp. -- an error. To debug this try: debugmode(true); とエラーが表示されてしまいました。 本やネットで調べましたが、よくわかりません。どうしてこのようになってしまったのでしょうか?また、解決法はありますか?教えていただきたくよろしくお願い致します。

  • maximaで積分の計算

    maximaで integrate(R*exp(-(5/(10^(-9)))*(R^2)-(1/2)*R), R, 0, inf); を実行したのですが、ずっと処理中のままです。 どこかまちがっていますか? それとも、この積分は解けないのでしょうか? ちなみに画像の上の式を計算しているつもりです。

  • Maximaで分数関数の積分がでjきない

    Maximaで関数f(x):=x/{a(x-b)+c}をintegrate(f(x),x)で積分すると、f(x)の前に積分記号が付いただけの結果が出ます。正解は、 x/a+{(ab-c)log(-ab+c+ax)}/a^2なのですが、Maximaの積分機能は弱いのでしょうか。

  • Maximaが積分を行ってくれません

    Maximaで関数f(x)をxで不定積分しました。 するとf(x)の前に積分記号が付いただけの結果が出ます。(定積分の場合も同じで記号の上下に数値があるだけです) 単純な関数だと計算してくれます。 しかし、今回用いる関数が非常に複雑(指数eの肩に対数log、対数の中身も指数の分数・・など)(必要な場合はお教えします)なのですがそのような結果が出力されました。 積分能力が低いため複雑な関数は出来ないのでしょうか?積分する際の留意点などあるのでしょうか? よろしくお願いします。

  • Mathematicaの積分について

    Mathematicaを使って定積分を求めたいのですが、以下の入力では積分値を数値で返してくれません。どうしてでしょうか?原因と解決策を教えてください。 In:Integrate[1/Exp[Sqrt[x^2 + 1^2]], {x, 0, 1}] よろしくお願いします。

  • 積分の計算

    sqrt(x+2)/xの積分のやり方について教えてください。sqrt(x+2)をtとおいて積分するらしいですがよくわかりません。計算過程まで教えていただけると助かります。

  • Maximaでグラフを描くために

    http://www1.bbiq.jp/kougaku/maxima.htmlのサイトにしたがって、file:///C:/Documents%20and%20Settings/サムソン/Local%20Settings/Temporary%20Internet20Files/Content.IE5/2TC7QXU5/maxima_plot3d_graph%5B1%5D.png (z=√(x2+y2))のグラフを描こうとしたのですが、wxMaximaでplot3d(sqrt(x^2+y^2),[x,-100,100],[y,-100,100],[grid,20,20]);と入力すると ____ Maxima encountered a Lisp error: Error in PROGN [or a callee]: Cannot create the file C:/Documents and Settings/サム・ン/maxout.gnuplot.Automatically continuing.To reenable the Lisp debugger set *debugger-hook* to nil. ____ に出てきて、出力できませんでした。 ファイル名の途中にある「サム・ン」がいけないのかと思い、コマンドプロンプトをつたって「samson」に使用者名を変更して再度試してみたのですがやっぱりダメでした。 どなたかお教え下されば幸いです。

  • maximaで定積分を漸化式と台形から解きたい

    maxima初心者です。 f(x):=%e^a*x^n*%e^(-x); a:0.5; n:20; を4つの方法で0からaまで定積分し、その誤差を比較し正しい答え(誤差が少ない?)を出す計算式をみつけるという課題が出ました。 integrate(f(x), x, 0, a); romberg(f(x), x, 0, a); で出してはみたのですが、漸化式を使った解き方と、台形から解く方法、そして何が正しいのかの見極め方がわかりません。 漸化式は資料に I[0]:%e^a-1; for n:1 thru 20 do( I[n]:n*I[n-1]-a^n); print(i[20]); というヒントがあったのですが、正直これに関しては何が何なのかさっぱりわかっていません。 そして台形に関しては (f(0)+f(0.5))*(0.5)/2;で大きなひとつの台形として計算できると思ったので、 (f(0)+f(0.5)+2*(f(0.1)+f(0.2)+f(0.3)+f(0.4))) *(0.5/5)/2; や (f(0)+f(0.5)+2*(f(0.05)+f(0.1)+f(0.15)+f(0.2)+f(0.25)+f(0.3)+f(0.35)+f(0.4)+f(0.45))) *(0.5/10)/2; と分割数を大きくしてみましたが、これだと埒があかないですよね.. どうにもこうにもいかなくなり、質問させていただきました。 せっかくの高性能を全く使いこなせていなくて情けないです。 どなたか超初心者の私にわかりやすく解説していただけないでしょうか。 よろしくお願いします。

  • exp(sqrt(x^2+y^2)の定積分

    ∫∫exp(sqrt(x^2+y^2)/(2*a^2))dxdy x:-a/2→a/2 y:-a/2→a/2 の定積分の解き方がわかりません. sqrt(x^2+y^2)=tと置換積分など行いましたが解けません. また不定積分なら,x=rcosΘ,y=rsinΘとおいて解けるのですが, 定積分だとΘの範囲をどうすればよいかわかりません. また積分範囲が円の仕様になっていませんので,Θの範囲を決めれません. よろしくお願いします.

  • 置換積分が使えない???

    こんにちは 数検の完全対策という本で準1級の勉強をしています。 1/sqrt(1+x)の積分についてなのですが、 2*sqrt(1+x)と解答だけ表記されています。 ※区分求積に関する問題の回答一部です。 youtubeの解説を見て、t=sqrt(1+x)と置換すれば上手く計算出来ると 説明されておりました。 しかし私が疑問に思っているのは、以下の置換ではムリなのかというところです。 初見で解こうとしたときに、t=1+xで置換積分を行ってみました。 結果は1/2*sqrt(1+x)と望ましい回答が得られませんでした。 これは置換の取り方の問題なのでしょうか?? すみませんが、宜しくお願い致します。