home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / utility / sm22a.zip / PROBLEM.TXT < prev    next >
Text File  |  1992-07-28  |  13KB  |  539 lines

  1.     Here are some problems that Maple and Mathematica cannot 
  2. solve, but SymbMath can do. 
  3.     The following examples came from news on the sci.math.symbolic 
  4. newsgroup in 1991, and were run in Maple V, Mathematica 2.0, or  
  5. SymbMath 2.1. 
  6.  
  7. ************************ Example 1 ******************************
  8.     Maple:
  9. > int(exp(-a * x^2), x=0..infinity);
  10.  
  11.                              infinity
  12.                                 /
  13.                                |               2
  14.                                |      exp(- a x ) dx
  15.                                |
  16.                               /
  17.                               0
  18.  
  19. # unevaluated.
  20. # Declare 'a' non-negative:
  21.  
  22. > signum(a) := 1;
  23.  
  24.                                  signum(a) := 1
  25.  
  26. # The same integral is now evaluated fully:
  27.  
  28. > int(exp(-a * x^2), x=0..infinity);
  29.  
  30.                                          1/2
  31.                                        Pi
  32.                                    1/2 -----
  33.                                          1/2
  34.                                         a
  35.  
  36.     SymbMath :
  37.     Input:
  38. inte(exp(-a*x^2), x from 0 to inf)
  39. assume(sqrt(a) > 0)
  40. inte(exp(-a*x^2), x from 0 to inf)
  41.     Output:
  42. 1/2*a^(-0.5)*sqrt(pi)*erf(inf*sgn(sqrt(a)))
  43. assumed
  44. 1/2*a^(-0.5)*sqrt(pi)
  45.  
  46. ************************** Example 2 *********************************
  47.     Maple:
  48. # Despite the fact that 'n' is declared non-negative...
  49. > signum(n) := 1;
  50.                                  signum(n) := 1
  51.  
  52. # ...this simple proper definite integral (that any freshman calculus 
  53. # student can evaluate!) is left unevaluated:
  54. > int(x^n, x=0..1);
  55.  
  56.                                      1
  57.                                      /
  58.                                     |   n
  59.                                     |  x  dx
  60.                                     |
  61.                                    /
  62.                                    0
  63.  
  64.  
  65.     SymbMath :
  66.     Input:
  67. assume(n > -1)
  68. inte(x^n, x from 0 to 1)
  69.     Output:
  70. assumed
  71. 1/(1 + n)
  72.  
  73. ************************** Example 3 *****************************
  74.     Maple:
  75. > int(x^n, x=eps..1);
  76.  
  77.                                           (n + 1)
  78.                                  1     eps
  79.                                ----- - ----------
  80.                                n + 1      n + 1
  81.  
  82. # ...but the one-sided limit...
  83.  
  84. > limit(", eps=0, right);
  85.  
  86.                                                (n + 1)
  87.                                       1     eps
  88.                           limit     ----- - ----------
  89.                           eps -> 0+ n + 1      n + 1
  90.  
  91. # ...remains unevaluated...
  92.  
  93. > simplify(");
  94.  
  95.                                                (n + 1)
  96.                                       - 1 + eps
  97.                           limit     - ----------------
  98.                           eps -> 0+         n + 1
  99.  
  100.  
  101. # ...no matter what we do!
  102.  
  103. > eval(");
  104.  
  105.                                                (n + 1)
  106.                                       - 1 + eps
  107.                           limit     - ----------------
  108.                           eps -> 0+         n + 1
  109.  
  110.     SymbMath:
  111.     Input:
  112. assume(n > -1)
  113. inte(x^n, x from eps to 1)
  114. subs(eps=0 to last)
  115.     Output:
  116. assumed
  117. 1/(1 + n) - eps^(1 + n)/(1 + n)
  118. 1/(1 + n)
  119.  
  120.  
  121. *************************** Example 4 ***************************
  122.     Maple:
  123. > 0^n;
  124.             0
  125.  
  126. # Maple flags the error only when 'n' is replaced by the constant 0:
  127.  
  128. > 0^0;
  129. Error, 0^0 is undefined
  130.  
  131.     SymbMath:
  132.     Input:
  133. assume(n > 0)
  134. 0^n
  135. 0^-n
  136. 0^0
  137.     Output:
  138. assumed
  139. 0
  140. discont
  141. undefined
  142.  
  143. **************************** Example 5 ******************************
  144.     Maple:
  145. > int(x^k, x);
  146.  
  147.                                      (k + 1)
  148.                                     x
  149.                                     --------
  150.                                       k + 1
  151.  
  152.     SymbMath:
  153.     Input:
  154. inte(x^k*d(x))
  155. subs(k=-1 to last)
  156.     Output:
  157. constant + x^(1 + k)/(1 + k)
  158. discont
  159.  
  160. **************************** Example 6 *****************************
  161.     Maple:
  162. # The following limit is left unevaluated:
  163. > limit(x^k/exp(x), x=infinity);
  164.  
  165.                                                k
  166.                                               x
  167.                               limit         ------
  168.                               x -> infinity exp(x)
  169.  
  170.  
  171. # We might ask if Maple knows this result for specific (constant) values 
  172. # of the symbolic parameter 'k'.  The answer is a QUALIFIED "yes".
  173. # Maple knows the result for 'k' equal to 10^8...
  174.  
  175. > limit(x^(10^8)/exp(x), x=infinity);
  176.  
  177.                                        0
  178.  
  179.  
  180. # ...and Maple knows the result for 'k' equal to 10^9...
  181.  
  182. > limit(x^(10^9)/exp(x), x=infinity);
  183.  
  184.                                        0
  185.  
  186. # ...BUT, Maple seems to FORGET the result when 'k' equals 10^10...
  187.  
  188. > limit(x^(10^10)/exp(x), x=infinity);
  189.  
  190.                                           10000000000       
  191.                                          x                 
  192.                            limit         ------------       
  193.                            x -> infinity    exp(x)         
  194.  
  195.     SymbMath:
  196.     Input:
  197. lim(x=inf, x^k/exp(x))
  198. lim(x=inf, x^(10^10)/exp(x))
  199. lim(x=inf, x^(10^10000)/exp(x))
  200.     Output:
  201. 0
  202. 0
  203. 0
  204.  
  205. ****************************** Example 7 ****************************
  206.     Maple:
  207. > int(x^m * exp (-b * x), x=0..infinity);
  208.  
  209.                             infinity
  210.                                /
  211.                               |       m
  212.                               |      x  exp(- b x) dx
  213.                               |
  214.                              /
  215.                              0
  216.  
  217.  
  218. # As expected, the integral remains unevaluated.  Now declare the signs 
  219. # of the symbolic parameters:
  220.  
  221. > signum(b) := 1;
  222.  
  223.                                  signum(b) := 1
  224.  
  225. > signum(m) := 1;
  226.  
  227.                                  signum(m) := 1
  228.  
  229.  
  230. # Upon attempting to compute the integral a second time...
  231.  
  232. > int(x^m * exp (-b * x), x=0..infinity);
  233.  
  234.                             infinity                        
  235.                                /                            
  236.                               |       m                     
  237.                               |      x  exp(- b x) dx       
  238.                               |                             
  239.                              /
  240.                              0                              
  241.  
  242. # ...THE INTEGRAL CONTINUES TO REMAIN UNEVALUATED, despite the fact that
  243. # the signs of the parameters 'b' and 'm' were declared PRIOR to the second
  244. # attempt at computation.
  245.  
  246.     SymbMath:
  247.     Input:
  248. inte(x^n*exp(-a*x), x from 0 to inf)
  249.     Output:
  250. inte(x^n*exp(-a*x), x, 0, inf)
  251.  
  252.  
  253. ************************ Example 8 *********************************
  254.     Mathematica:
  255. In[1]:= Integrate[1/x,{x,-1,1}]
  256. Out[1]= -Log[-1]
  257.  
  258.     Maple:
  259. has the same problem.
  260.  
  261.     SymbMath:
  262.     Input:
  263. inte(1/x, x from -1 to 1)
  264. inte(1/x, x from -1 to 2)
  265.     Output:
  266. 0
  267. ln(2)
  268.  
  269.  
  270. *************************** Example 9 *******************************
  271.     Maple:
  272. has a problem for int(tan(x), x=0..pi).
  273.  
  274.     SymbMath:
  275.     Input:
  276. inte(tan(x), x from 0 to pi)
  277.     Output:
  278. 0
  279.  
  280. **************************** Example 10 ****************************
  281.     Mathematica:
  282. cannot evaluate integral of sgn(x).
  283.  
  284.     Maple:
  285. # cannot evaluate inegral of signum(x) by int(). Help with a procedure:
  286. # Load the procedure into Maple:
  287.  
  288. > read `pvint.txt`;
  289.  
  290. pvint := proc(f,x,a,b,s)
  291.          local i1,i2,eps;
  292.              signum(eps) := 1;
  293.              i1 := int(f,x = a .. s-eps);
  294.              i2 := int(f,x = s+eps .. b);
  295.              simplify(i1+i2);
  296.              limit(",eps = 0,right)
  297.          end
  298.  
  299.  
  300. > pvint(signum(x), x, -1, 1, 0);
  301.  
  302.                           - eps                   1
  303.                             /                     /
  304.                            |                     |
  305.                limit       |    signum(x) dx +   |  signum(x) dx
  306.                eps -> 0+   |                     |
  307.                           /                     /
  308.                           -1                   eps
  309.  
  310. # Maple refuses to evaluate this P.V. integral:
  311.  
  312. > simplify(");
  313.  
  314.                           - eps                   1
  315.                             /                     /
  316.                            |                     |
  317.                limit       |    signum(x) dx +   |  signum(x) dx
  318.                eps -> 0+   |                     |
  319.                           /                     /
  320.                           -1                   eps
  321.  
  322. > eval(");
  323.  
  324.                           - eps                   1
  325.                             /                     /
  326.                            |                     |
  327.                limit       |    signum(x) dx +   |  signum(x) dx
  328.                eps -> 0+   |                     |
  329.                           /                     /
  330.                           -1                   eps
  331.  
  332.     SymbMath:
  333.     Input:
  334. inte(sgn(x), x from -1 to 1)
  335. inte(sgn(x), x from -1 to 2)
  336.     Output:
  337. 0
  338. 1
  339.  
  340. ************************* Example 11 ********************************
  341. Implicit diff. gives 1+y'[x](1+1/y[x])==0; y'[x]==-y[x]/(y[x]+1).
  342.  
  343.     Mathematica:
  344.  given this eq. as input to DSolve says that built-in 
  345.  procedure can't solve it.
  346.  
  347.      MACSYMA:
  348. (c1) depends(y,x)$
  349.  
  350. (c2) ode2(diff(y,x) = -y/(y+1),y,x);
  351.  
  352. (d2)                   - log(y) - y = x + %c
  353.  
  354. (c3) method;
  355.  
  356. (d3)                         separable
  357.  
  358.  
  359.     SymbMath:
  360. solve the differential equation by integration inte() or by dsolve().
  361.     Input:
  362. d(y)/d(x)*(1+1/y) === -1
  363. inte(last*d(x))
  364. Expand=On
  365. dsolve(d(y)/d(x) === -y/(y+1), y)
  366.     Output:
  367. (1 + 1/y)*d(y)/d(x) === -1
  368. y + ln(y*sgn(y)) === constant - x
  369. Expand = On
  370. -y - ln(y*sgn(y)) === constant + x
  371.  
  372.  
  373. ************************* Example 12 ********************************
  374.     Mathematica:
  375.                  y'[x] = y[x]^(1/2)
  376.                   y[0] = 0
  377.  
  378. DSolve could not handle it. (It rarely solves anything!!), and the 
  379. RungeKutta package only gave me the solution
  380.              
  381.                     y[x]=0
  382.  
  383. Obviously, there is another solution viz.
  384.  
  385.                    y[x] = (x/2)^2   
  386.  
  387.     SymbMath:
  388.     Input:
  389. dsolve(d(y)/d(x) === sqrt(y), y)
  390. (last/2)^2
  391.     Output:
  392. 2*sqrt(y) === constant + x
  393. y === 1/4*(constant + x)^2
  394.  
  395. ************************* Example 13 ********************************
  396.     Maple:    
  397. > sqrt(x*x);
  398.       x 
  399.  
  400.     Mathematica:
  401.  Sqrt[a^2] evaluates to Sqrt[a^2].
  402.  
  403.     SymbMath:
  404.     Input:
  405. sqrt(x^2)
  406. assume(a > 0)
  407. sqrt(a^2)
  408. assume(b <0 )
  409. sqrt(b^2)
  410.     Output:
  411. x*sgn(x)
  412. assumed
  413. a
  414. assumed
  415. -b
  416.  
  417. ********************** Example 14 **********************************
  418.     Maple and Mathematica cannot find the integrals of abs(x).
  419.  
  420.     SymbMath:
  421.     Input:
  422. inte(abs(x), x from -1 to 1)
  423. inte(abs(x)^5*d(x))
  424.     Output:
  425. 1
  426. constant + 1/6*abs(x)^6*sgn(x)
  427.  
  428. ---------------------------------------------------------------------
  429.  
  430.     The following problems are taken from Swokowski's Calculus 
  431. book.  They cause Mathematica to fail because of a singularity in 
  432. the interior of the interval of integration:
  433.  
  434.         Section 10.4 Problems 3, 12, 15, 16, 23, 29.
  435.  
  436. The comments "INTEGRAL IS DIVERGENT" and "Principal Value" come from
  437. Macsyma.  Mma gives no indication that anything is amiss.
  438.  
  439. ************************ Problem3 *********************************
  440.     Mathematica:
  441. In[4]:= Integrate[1/x^2,{x,-3,1}]
  442.  
  443.           4
  444. Out[4]= -(-)                            (* INTEGRAL IS DIVERGENT *)
  445.           3
  446.  
  447.     SymbMath:
  448.     Input:
  449. inte(1/x^2, x from -3 to 1)
  450.     Output:
  451. inf
  452.  
  453. ************************** Problem12 ***************************
  454.     Mathemtica:
  455. In[6]:= Integrate[x^(-4/3),{x,-1,1}]
  456.  
  457. Out[6]= -6                              (* INTEGRAL IS DIVERGENT *)
  458.  
  459.     SymbMath:
  460.     Input:
  461. inte(x^(-4/3), x from -1 to 1)
  462.         Output:
  463. inf
  464.  
  465. **************************** Problem15  ************************
  466.     Mathematica:
  467. In[7]:= Integrate[1/x,{x,-1,2}]
  468.  
  469. Out[7]= -Log[-1] + Log[2]
  470.  
  471.     Maple:
  472. has the same problem.
  473.     
  474.     Macsyma:
  475.     (c7) integrate(1/x,x,-1,2);
  476.     Principal Value
  477.     (d7)                                log(2)
  478.  
  479.     SymbMath:
  480.     Input:
  481. inte(1/x, x from -1 to 2)
  482.     Output:
  483. ln(2)
  484.  
  485.  
  486. ********************** Problem16 ************************************
  487.     Mathematica:
  488. In[8]:= Integrate[1/(x^2-x-2),{x,0,4}]
  489.  
  490.         -Log[-2]   Log[2]   Log[5]
  491. Out[8]= -------- + ------ - ------
  492.            3         3        3
  493.  
  494.     Macsyma:
  495.     (c8) integrate(1/(x^2-x-2),x,0,4);
  496.     Principal Value
  497.                                          log(5)
  498.     (d8)                               - ------
  499.                                            3
  500.  
  501.  
  502.     SymbMath:
  503.     Input:
  504. inte(1/(x^2-x-2), x from 0 to 4)
  505.     Output:
  506. -1/3*ln(2) + 1/3*ln(2/5)
  507.  
  508. ***************************** Problem23 **********************
  509.     Mathematica:
  510. In[10]:= Integrate[(1/x^2)Cos[1/x],{x,-1,2}]
  511.  
  512.                        1
  513. Out[10]= Sin[-1] - Sin[-]              (* INTEGRAL IS DIVERGENT *)
  514.                2
  515.  
  516.     SymbMath:
  517.     Input:
  518. y=1/x^2*cos(1/x)
  519. inte(y, x from -1 to 0-zero) + inte(y, x from 0+zero to 2)
  520.     Output:
  521. y = x^(-2)*cos(1/x)
  522. sin(-1) - sin(1/2) + 2*sin(inf)
  523.  
  524. ************************** Problem29 ********************************
  525.     Mathematica:
  526. In[12]:= Integrate[1/(x-4)^2,{x,0,Infinity}]
  527.  
  528.            1
  529. Out[12]= -(-)                          (* INTEGRAL IS DIVERGENT *)
  530.            4
  531.  
  532.     SymbMath:
  533.     Input:
  534. y=1/(x-4)^2
  535. inte(y, x from 0 to 4-zero) + inte(y, x from 4+zero to inf)
  536.     Output:
  537. y = (-4 + x)^(-2)
  538. inf
  539.