gulliet

241 Reputation

6 Badges

16 years, 238 days

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by gulliet

You should try your procedure with a fresh kernel (open a new session or evaluate restart). On my system (Maple 12.02 64-bit Intel Mac OS X Leopard 10.5.6) the procedure you posted works just fine (I have just copy and past it from the web browser). (Note that as written, if one wants the natural numbers below, say, 10, one must evaluate natural(9).)
> natural := proc (n) 
local i, s; 
s := 0; 
for i to n do 
if irem(i, 3) = 0 or irem(i, 5) = 0 then s := s+i end if 
end do; 
return s 
end proc;

                        natural := proc(n)  ...  end;
> natural(9);

                                     23
> natural(10);

                                     33

Regards, -- Jean-Marc
Please, could you post your system of equations (and possibly the command(s) you used to solve the smaller one)? No offense here, but the description you give of your problem is too vague (much too general) to allow readers of this forum to provide useful tips and specific strategies. For instance, is the system dense or sparse, symbolic or numeric, integer, real or complex valued? All of these strongly influences the answers that could be provided. Regards, -- Jean-Marc
> simplify((diff(gamma(x), x))*gamma1(x)+gamma(x)*(diff(gamma1(x), x)), gamma);
             / d          \                      / d           \
             |--- gamma(x)| gamma1(x) + gamma(x) |--- gamma1(x)|
             \ dx         /                      \ dx          /

I do not know about version 8, but in version 12 using lowercase gamma might conflict with some built-in constants. See help("gamma")
gamma      Euler's constant = limit(sum(1/i,i=1..n) - ln(n),             
           n=infinity). evalf(gamma) is approximately 0.5772156649...    
gamma(n)   a series of constants such that gamma(n)  =                   
           limit(sum(ln(k)^n/k, k=1..m) - ln(m)^(n+1)/(n+1),             
           m=infinity). gamma(0) = gamma, Euler's constant.              

Regards, --Jean-Marc
Open a Terminal window (located in /Applications/Utilities/Terminal.app). At the prompt (command line), type "java -version" (w/o the quotes). 97_Picture 5.png Also, the following Apple FAQ, Java Frequently Asked Questions, might be worth reading: Regards, -- Jean-marc
I believe that the following formula is faster than the original implementation (though I have not done a thorough test).
restart; with(LinearAlgebra); with(ArrayTools);
N := RandomMatrix(5, 1); 
M := RandomMatrix(5, 1); 
MN := map(proc (x) options operator, arrow; x^2 end proc, M-N); sqrt(AddAlongDimension(MN, 1)/ArrayNumElems(N)); 
evalf(%);

                                3      (1/2)
                                - 10810     
                                5           
                                 62.38268988

Norm(M-N, 2)/sqrt(Dimension(N)[1]); 
evalf(%);

                             3     (1/2)  (1/2)
                             - 2162      5     
                             5                 
                                 62.38268988
Regards, -- Jean-Marc
More details might be needed to answer correctly your question. Could you post a short sample of your code (or an example that produces the same result)? And also some details on the configuration your are using. On my system Maple 12.02 64-bit Intel Mac OS X Leopard 10.5.6, the following modification of values do not display any dialogue box: at best some informations about the structure of the matrix, informations that can be suppressed by ending the input command with a colon character. 97_Picture 3.png Regards, -- Jean-Marc
Also, you could write your own function as follows (first an example using the pallete, then an example coding the procedure directly. See ?proc for more info.)
> M := proc (P, r, n) options operator, arrow; (1/12)*P*r/(1-(1+(1/12)*r)^(-n)) end proc;

                                              P r          
                  M := (P, r, n) -> -----------------------
                                       /              (-n)\
                                       |    /    1   \    |
                                    12 |1 - |1 + -- r|    |
                                       \    \    12  /    /
> M(15000, 0.7e-1, 36);

                                 463.1564768

> M(21000, .19, 48);

                                 627.9024913

> M := proc (P, r, n);
description "Compute the montly payment for a car loan.";
(1/12)*P*r/(1-(1+(1/12)*r)^(-n));
end proc;
> M(21000, 0.45e-1, 48);
                                 478.8732078

Regards, -- Jean-Marc
The finance package is now a package (Maple 12.02) Try
> restart;
> help("finance");
> with(finance);
[amortization, annuity, blackscholes, cashflows, effectiverate, 
futurevalue, growingannuity, growingperpetuity, levelcoupon, 
perpetuity, presentvalue, yieldtomaturity]
Regards, -- Jean-Marc
Try to set _EnvAllSolutions to true before evaluating the integral (see the section titled Returning the Entire Set of Solutions in help("int/details").)
_EnvAllSolutions := true;
Regards, --Jean-Marc

You could take the right-hand side of the expression returned by dsolve. For instance,

ode := diff(y(x), x, x) = 2*y(x)+1; 
ics := y(0) = 1, (D(y))(0) = 0; 
plot(rhs(dsolve({ics, ode})), x = 1 .. 5)

 Regards, --Jean-Marc

Take the right-hand side of the solution returned by dsolve. For instance,
ode := diff(y(x), x, x) = 2*y(x)+1; 
ics := y(0) = 1, (D(y))(0) = 0; 
plot(rhs(dsolve({ics, ode})), x = 1 .. 5)
97_Picture 4.png Regards, --Jean-Marc
Ii seems that what you should use is the add() command rather than sum (since sum attempts to compute a closed-form symbolic formula). The online help for sum reads: To add a finite sequence of values, rather than compute a formula, use the add command. For example, add(k, k=0..9) returns 45. Although the sum command can often be used to compute explicit sums, it is strongly recommended that the add command be used in programs if an explicit sum is needed, in particular, when summing over all elements of a list, Array, Matrix, or similar data structure. For instance,
> restart;
> f := proc (i) if 0 < i then return i else return -i end if end proc;
> add(f(t), t = -2 .. 2);

                                      6
Regards, --Jean-Marc
Beware that, here, you are asking Maple to do the whole computation --included all the intermediate steps -- with a limited precision of m digits and not to round to m digits a higher precision result.
> m := proc (x, y) options operator, arrow; 126*cos(a)^2*(cos(x)-sin(x)*cos(y+b+c)*tan(a))-42 end proc;
print(`output redirected...`); # input placeholder
                            2                                             
   m := (x, y) -> 126 cos(a)  (cos(x) - sin(x) cos(y + b + c) tan(a)) - 42
> g := proc (x) options operator, arrow; (1/180)*x*Pi end proc; a := g(58); b := g(-45); c := g(100);
print(`output redirected...`); # input placeholder
                                        1      
                             g := x -> --- x Pi
                                       180     
                                      29   
                                 a := -- Pi
                                      90   
                                        1   
                                 b := - - Pi
                                        4   
                                       5   
                                  c := - Pi
                                       9   
> n := eval(m(0, 0)); evalf[4](n); evalf[5](n);
print(`output redirected...`); # input placeholder
                                             2     
                                      /29   \      
                          n := 126 cos|-- Pi|  - 42
                                      \90   /      
                                    -6.58
                                   -6.619
> seq(evalf[i](n), i = 1 .. 10);
print(`output redirected...`); # input placeholder
 -20., -6., -6.6, -6.62, -6.619, -6.6173, -6.61739, -6.617386, -6.6173816, 

   -6.61738222
> seq(evalf[i](Pi), i = 1 .. 10);
print(`output redirected...`); # input placeholder
  3., 3.1, 3.14, 3.142, 3.1416, 3.14159, 3.141593, 3.1415927, 3.14159265, 

    3.141592654
> seq(evalf[i](29*Pi*(1/90)), i = 1 .. 10);
print(`output redirected...`); # input placeholder
 0.9, 0.99, 1.01, 1.012, 1.0123, 1.01229, 1.012291, 1.0122910, 1.01229096, 

   1.012290966
> seq(evalf[i](126*cos(29*Pi*(1/90))^2), i = 1 .. 10);
print(`output redirected...`); # input placeholder
  20., 36., 35.4, 35.38, 35.383, 35.3826, 35.38263, 35.382617, 35.3826177, 

    35.38261778


Regards, -- Jean-Marc
On my system (64-bit Intel Mac OS X Leopard 10.5.6 Maple 12.02), the files jopenmaple.jar and externalcall.jar are both located in /Library/Frameworks/Maple.framework/Versions/12/java (Note that the path is from the root directory) HTH, -- Jean-Marc
Assuming I have correctly understood what you are looking for, the following expression should do it: a, b := Y(0.01)[2 .. 3][] We take the second and third elements of the list returned by Y(.01), remove the brackets, and assign the resulting sequence to a and b.
> restart; con := y(0) = 1, (D(y))(0) = -1; 
   ode := diff(y(x), x, x) = -y(x); 
   Y := dsolve({con, ode}, numeric, y(x)); 
   a, b := Y(0.1e-1)[2 .. 3][];
                                          d                             
    a, b := y(x) = 0.989950166993563863, --- y(x) = -1.00994983384860393
                                          dx                            
> Y(0.1e-1);
  [                                        d                             ]
  [x = 0.01, y(x) = 0.989950166993563863, --- y(x) = -1.00994983384860393]
  [                                        dx                            ]
> Y(0.1e-1)[2 .. 3];
       [                              d                             ]
       [y(x) = 0.989950166993563863, --- y(x) = -1.00994983384860393]
       [                              dx                            ]
> Y(0.1e-1)[2 .. 3][];
                                      d                             
        y(x) = 0.989950166993563863, --- y(x) = -1.00994983384860393
                                      dx                            
> a, b := Y(0.1e-1)[2 .. 3][];
                                          d                             
    a, b := y(x) = 0.989950166993563863, --- y(x) = -1.00994983384860393
                                          dx                            
> a, b;
                                      d                             
        y(x) = 0.989950166993563863, --- y(x) = -1.00994983384860393
                                      dx                            
> 

Hope this helps, -- Jean-Marc
5 6 7 8 9 10 Page 7 of 10