Wolfram Computation Meets Knowledge

When do I use GenerateConditions and Assumptions with Integrate or Sum?

Integrate and Sum evaluations return generic solutions. These are usually correct for general cases, but may not apply for specific parameter values (see Generic and Non-Generic Cases).

For example, this summation is unbounded if x is greater than or equal to 1:

In[1]:= Sum[x^n, {n, 0, Infinity}]

Out[1]=  1 / (1 - x)  

The GenerateConditions->True option tells the function to state when the solution is valid.

Now we confirm that the result applies only for Abs[x]<1:

In[2]:= Sum[x^n, {n, 0, Infinity}, GenerateConditions -> True]

Out[2]=  ConditionalExpression[1/(1 - x), Abs[x] < 1]  

If any condition is known already, the Assumptions option can be used to tell Sum about it. This gives a simple output suitable for later use in the code. The explicit condition used here will need to be remembered when the result is used:

In[3]:= Sum[x^n, {n, 0, Infinity}, Assumptions -> {-1 < x && x < 1}]

Out[3]= 1/(1 - x)    

Assumptions can also be passed using the Assuming function or $Assumptions:

In[4]:= Integrate[1/(x + a), {x, 0, 1}]

Out[4]= ConditionalExpression[-Log[a] + Log[1 + a],
   Re[a] > 0 || Re[a] < -1 || NotElement[a, Reals]


In[5]:= Assuming[a > 0, Integrate[1/(x + a), {x, 0, 1}]]

Out[5]= Log[1 + 1/a]

In[6]:= $Assumptions = a > 0;
        Integrate[1/(x + a), {x, 0, 1}]

Out[7]= Log[1 + 1/a]

This resets $Assumptions to its default:

In[8]:= $Assumptions =. ;  

この項目は役に立ちましたか?
はい
いいえ

ご意見・ご提案がおありでしたらお書きください.

フィードバックをありがとうございました.

送信

サポートへのお問合せ

お支払い,アクティベーションに関する質問から技術的な質問まで,お気軽にお問い合せください.

販売代理店 (ライセンスをお持ちの方は、ご購入された代理店にお問い合わせください)

Hulinks

電話:03-5642-8380
Fax:03-5642-8381

soft.sales@hulinks.co.jp
Webサイト

日本電子計算株式会社

電話:03-5210-0184
Fax:03-5210-0229

math_info@cm.jip.co.jp
Webサイト

亘香通商株式会社

電話:045-320-2711
Fax:045-320-9342

sales@senko-corp.co.jp
Webサイト

株式会社シーエムディーラボ

電話:03-3408-8406
Fax:03-3408-8406

info@cmdlab.co.jp
Webサイト