Alejandro Jakubi

MaplePrimes Activity

These are answers submitted by Alejandro Jakubi

In my opinion, for this purpose, it is easier and more systematic to write code from start in text (.mpl) files. And there are many other reasons and advantages for proceeding this way.

It is happening because no preprocessing procedure for surd exists in the table `limit/mrv/PreProcessTab`. So an error is produced (internally) when looking for a procedure named `limit/preprocess/surd`, finally returning an unevaluated limit .

These are the available entries in `limit/mrv/PreProcessTab`:


[erfc], [sec], [harmonic], [factorial], [Sum], [dawson], [sum], [tan], [sin],

    [Shi], [diff], [GAMMA], [Int], [BesselY], [Si], [floor], [BesselK],

    [arccosh], [RootOf], [Ssi], [polylog], [frac], [arcsinh], [LambertW],

    [conjugate], [round], [ln], [piecewise], [tanh], [int], [sech], [Beta],

    [Ci], [csc], [FresnelS], [lnGAMMA], [arccsch], [FresnelC], [erf], [signum],

    [Re], [coth], [ceil], [exp], [Zeta], [log10], [cosh], [Im], [limit/mrv/EXP],

    [Diff], [cos], [DESol], [max], [Li], [Heaviside], [AiryBi], [trunc], [csch],

    [BesselJ], [Psi], [abs], [cot], [Ei], [csgn], [AiryAi], [erfi], [sinh],

    [arcsech], [binomial], [Dirac], [BesselI], [Chi], [min]

It looks a bit outdated...

Do you mean something like:

                        /  5       \    
                        |-----     |    
                        | \        |    
                        |  )       |    
                        | /    x[i]| + a
                        |-----     |    
                        \i = 1     /    

No, it is not restricted to polynomial inequalities:



Certainly, the examples in ?plots,inequal could be a bit more creative...

Some simplifications of the integrand and a very simple change of variable help the integration routines to keep their bearings:

J:=Int(1/(sin(theta)+cos(theta))/sqrt(sin(theta)*cos(theta)), theta=0..Pi/2):
                    |                      1
             J1 :=  |      --------------------------------- dtheta
                    |                   Pi               1/2
                   /       sin(theta + ----) sin(2 theta)
                     0                  4
J2:=PDEtools:-dchange(theta = phi-Pi/4,J1);
                           3 Pi
                         |                  1
                  J2 :=  |      ------------------------- dphi
                         |                            1/2
                        /       sin(phi) (-cos(2 phi))


In this form, the primitive function becomes expressed in terms of elementary functions:


                            2 - 4 cos(phi)
1/2 arctan(1/2 -----------------------------------------)
                                  2                  1/2
               (-2 (-1 + cos(phi))  - 4 cos(phi) + 3)
                                   2 + 4 cos(phi)
     - 1/2 arctan(1/2 ----------------------------------------)
                                        2                  1/2
                      (-2 (1 + cos(phi))  + 4 cos(phi) + 3)

So, in regards to the method FTOC, the problem here is at the indefinite integration stage: why the simple primite function is not found in the original variable (just a shift of Pi/4).

Some first steps towards discovering what this error means. A most useful tool here is a debugger as it allows you to stop at the condition generating this error message in line 21 of RegularChains:-TRDisolate_real_zeros  (see ?debugger ,  or try mdcs ), as shown here:


RegularChains:-TRDisolate_real_zeros := proc(real_point, p_list, R)
local vars, n, lower_rc, lower_cube, p, index_list, interval_list, interval_element, i, inner_real_point, k, rc, mycube, mybox;
  21     if nops(interval_list) <> nops(index_list) then
  22       error "error in TRDisolate_real_zeros in univariate case"
         end if;
end proc

And the exception is triggered as the number of operands of these two lists are different. Their evaluation yields this output (in mdcs):

(**) interval_list
[[[0, 0]], [[6231/65536, 12465/131072]], [[12471/131072, 6237/65536]],
[[105/1024, 27/256]], [[39/128, 81/256]], [[21/64, 87/256]], [[15/16, 33/32]],
[[15/16, 33/32]], [[87/64, 45/32]], [[87/64, 45/32]], [[363/256, 183/128]],
[[369/256, 93/64]], [[189/128, 1515/1024]]]

[7, 3, 4, 5, 5, 4, 4, 4, 6, 4] 

So, the next step is finding why these two lists have different number of operands. Look at the conditional statement starting at line 11:

  11     if nops(p_list) = 1 then
  12       index_list := [seq(1,i = 1 .. nops(interval_list))]
  13       rc := TRDpretend_regular_chain(p,TRDempty_regular_chain(),R);
  14       for interval_element in interval_list do
  15         mycube := interval_element;
  16         mybox := TRDconvert_cad_sample_to_box([rc, mycube],R);
  17         for i to nops(p_list) do
  18           if TRDsign_poly_at_box(p_list[i],mybox,R) = 0 then
  19             index_list := [op(index_list), i];
  20             break
               end if
             end do
           end do
         end if;

Here, p_list is a parameter, and evaluates as a list with 7 operands:

(**) p_list
*beta-1, beta-1,
beta^3+9*beta^2-9*beta-1, beta]

so that the computation follows the else part. Then, some leads to follow are: 1. what happens in this part, and 2. why p_list gets this value.

It seems that there is a procedure just for producing an error message:

88, atomicweight = [value = (proc()
option `Copyright (c) 2002 Waterloo Maple Inc. All rights reserved.`;
    error "element is radioactive, most stable or best known isotope has\
     mass number 226"
end proc), uncertainty = undefined, units = 1]

Certainly, this package is quite outdated, see ?Screfs . E.g. it states that CODATA was last accessed eleven years ago...

Yes, this is a bug in singular. It does not check that a variable is dummy. See a simpler example:

                                    {x = 0}

No, sqrt(2) can be checked as a positive number. Actually, arbitrary predicates can be used, see ?satisfies . E.g.:

p := proc( s::{positive,satisfies(x->evalf(x)>0)})

                                  2, 2/3, 2

Error, invalid input: p expects its 1st argument, s, to be of type {positive,
satisfies(x -> 0 < evalf(x))}, but received -1

I find that the package MmaTranslator in Maple 13 and 16 has exactly the same procedures, modules, etc. So, except for changes that may have occured in the code of these members, it seems like there was no significant changes since this package was introduced. Meaning that, rather than improved, it may be even less useful than originally, because of the changes in both languages, as you have described. 

Besides, this translator was rather buggy as introduced, except for the simplest Mathematica constructs. It should be rechecked whether any of those bugs was fixed...

Certainly, the Mathematica language uses a lot of operators that may make its code both compact and cryptic. I find that most of these constructs have an associated function call form that frequently looks rather similar to Maple constructs.

On the other hand, compactness of the code is not necessarily correlated with its efficiency when running. That is, some more verbose Maple code may run much faster than its more compact Mathematica counterpart. Efficiency may depend on the implemented algorithms, data structures, the architecture of the system, etc. This is a matter for comparative reviews.

That kind of Mathematica code can implemented in Maple more or less straightforwardly by using transformation rules and/or procedures (in particular procedures with option overload). It may result a bit lengthier, while "ellegance" is more a subjective issue...

Preben, what kind of answer do you expect? Of course, Bryon will always answer that they have plans, as he did here and so many times in the past. So what?


OK. The system of solutions is a set of equations. And their rhs' are expressions as in my example above. So, one way to do it is using evalindets, by selecting the equations in this set, and applying the rule to their rhs only. Something as in this toy example:

                  {x1(t) = cos(omega t), x2(t) = sin(omega t)}

Note that I am not using your actual example as you have not provided the input that produces it in text form so that we could execute it, and I will not type the output expression from your picture...

For cases like the replacement of radicals as in this example, it is handy using a transformation rule like:

                                  cos(omega t)

See ?applyrule. Sadly, algsubs is somewhat limited and, in particular, it cannot handle radicals:

Error, (in algsubs) no variables appearing rationally in pattern

For these transformations on expressions you may use collect:

                       6             4      2
                   -2 x  + (-g + y) x  + z x 

                    (a + e) cn + (f + w) dn
First 17 18 19 20 21 22 23 Last Page 19 of 29