プロが教えるわが家の防犯対策術!

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);
とエラー表示がされてこれ以上計算が進みません。どのように対処すれば
うまくいくのでしょうか。

A 回答 (6件)

 maximaの記号は正負の区別がありません。


したがって、maximaの”警告”にあるように定積分の下端sqrt(y)は虚数の可能性があります。
 maximaの定積分の下端、上端は実数の必要があります。
そこで sqrt(y)をsqrt(abs(y))とするか、y>0であるならば assume(y>0); として
計算すればよい。
    • good
    • 0
この回答へのお礼

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

お礼日時:2011/08/23 22:34

定積分の下限や上限に、未定義になる可能性のある文字定数(積分変数と異なる文字変数を含む)とき、同様のエラーが起こります。


未定義となる可能性がないことがないと分かっている場合は、以下のように、まず定積分を行い、それに積分の上限、下限を代入して引き算をしてやれば対処できます。
例)
 fx:integrate(x,x)$
 I:ev(fx,x=y)-ev(x=sqrt(y);

このように定積分の上限や下限が原因で積分エラーが起こる場合は、この方法で対処できます。
やってみて下さい。
    • good
    • 0
この回答へのお礼

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

お礼日時:2011/08/23 22:44

integrate(x,x,sqrt(abs(y)),y);


とすればよいのでは?

このサイトでは表示が壊れますが下の様になります

(%i6) integrate(x,x,sqrt(abs(y)),y);
2
y abs(y)
(%o6) -- - ------
2 2
(%i7)
    • good
    • 0
この回答へのお礼

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

お礼日時:2011/08/23 22:40

例示しているように


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)
    • good
    • 0
この回答へのお礼

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

お礼日時:2011/08/23 22:28

どういう計算をしようとしているのでしょうか?


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
    • good
    • 0

カテ違いですな。



リファレンスマニュアルでintegrateのパラメータの並びを確認してみてください。
    • good
    • 0
この回答へのお礼

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

お礼日時:2011/08/19 23:08

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!