lemelinm

1490 Reputation

15 Badges

17 years, 322 days

 

 

--------------------------------------
Mario Lemelin
Maple 14.00 Win 7 64 bits
Maple 14.00 Ubuntu 10,04 64 bits
messagerie : mario.lemelin@cgocable.ca téléphone :  (819) 376-0987

MaplePrimes Activity


These are answers submitted by lemelinm

mario.lemelin@cgocable.ca

mario.lemelin@cgocable.ca

the only way I found is this:

> Q1 := convert(Q, listlist);

then

writedata("D://Data//Data6//My_File7.txt", Q1);

works

it seems that writedata don't like Array but only array.  But when you PLOT, you can see that the numbers are in an Array.  It look like writedata has not been update to Maple 12.  Just a idea!
 

mario.lemelin@cgocable.ca

> fprintf("D:/Data/Data6/My_File8.txt", "%f", Q);

                                     227

but My_File8.txt is empty

mario.lemelin@cgocable.ca

> sol := dsolve({de, init}, theta(t), numeric, output = listprocedure);

                  [                                                      
       sol := [t = proc(t)  ...  end;, theta(t) = proc(t)  ...  end;,
                  [                                                      

          d                                             ]
         --- theta(t) = proc(t)  ...  end;]
          dt                                            ]
> sol[1];

                           t = proc(t)  ...  end;
> sol[1](1);

                                  t(1) = 1.
> sol[2](1);

                     theta(t)(1) = 0.801776527153333696
> sol[3](1);

                  / d          \                         
                  |--- theta(t)|(1) = -1.10434128995332803
                  \ dt         /                         

sol[i] give a procedure, you have to evaluate it at the point that interest you while

> sol(1);

              [                                               
              [t(1) = 1., theta(t)(1) = 0.801776527153333696, 
              [                                               

                / d          \                          ]
                |--- theta(t)|(1) = -1.10434128995332803]
                \ dt         /                          ]

> map(rhs, sol(1));

              [1., 0.801776527153333696, -1.10434128995332803]

 

the "range option" in dsolve/numeric is interesting, I encourage you to look the help pages for that subjet.

 

Hope it help you a little bit.

mario.lemelin@cgocable.ca

mario.lemelin@cgocable.ca

p.12 of the advanced programming guide

 

if  (evalf@f)()/10^Digits; is replace by (evalf@eval(f))/10^Digits;
then

seq(U(),i=1..5) can be done.  I don't know if I am right but it seem that since rand is a procedure, by assignation. f is it too.  So you have to do a full assignation (that's what it is said p.16).  In the firts case, U() give a number but in the second case, U() is a procedure that can be use in seq. 

That subtil difference make a great difference in the way to use U.  That's what I don't understand.

 On another subject :

> assume(b > 0);
> x := b+1;
                                 x := b~ + 1
> subs('b~' = c, x);
                                    b~ + 1
> subs(b~ = c, x);
                                    c + 1
> x := subs(c = b, %);

x := b~ + 1

of course, the last command was a desperate one and I knew it wouldn't work.My question is : How to get rid of the assumption without doing restart and keeping  the assignment of x intact?
 

mario.lemelin@cgocable.ca

Let me try to do it right.

> frac(evalf(Pi, 15));

>op(%);

> L := %[1];

> Lpi := convert(L, base, 10);

>M := ListTools:-Reverse(Lpi);

>M[13];

 

mario.lemelin@cgocable.ca

> frac(evalf(Pi, 15));

                              0.14159265358979
> op(%);

                             14159265358979, -14
> L := %[1];

                             L := 14159265358979
> Lpi := convert(L, base, 10);

              Lpi := [9, 7, 9, 8, 5, 3, 5, 6, 2, 9, 5, 1, 4, 1]
> M := ListTools:-Reverse(Lpi);

               M := [1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 8, 9, 7, 9]
> M[13];

                                      7

I am sure that there is a simple way to do it in a procedure but at least you have the idea.

 

mario.lemelin@cgocable.ca

to retrieve the value in a matrix, in this case all he have to do is:

A[3,4];

maybe this is all he need to know for the moment!

 

mario.lemelin@cgocable.ca

and there is no reason to have made is so complicated.  I was guessing that by the question, he was looking to program it like the IF command in Excel.

by the way, it's A[3,4]:=0 instead of A[3:4]:=0

 

mario.lemelin@cgocable.ca

Hi,

 

For example, if you have a 4X4 Matrix

 

> A := LinearAlgebra[RandomMatrix](4);

                               [ 50  -50  -38  -98]
                               [                  ]
                               [ 10  -22  -18  -77]
                          A := [                  ]
                               [-16   45   87   57]
                               [                  ]
                               [ -9  -81   33   27]


> RemMat := proc (A::Matrix, r::integer, c::integer)
 A[r, c] := 0;
 A;
end proc;

> RemMat(A, 3, 4);

                            [ 50  -50  -38  -98]
                            [                  ]
                            [ 10  -22  -18  -77]
                            [                  ]
                            [-16   45   87    0]
                            [                  ]
                            [ -9  -81   33   27]

mario.lemelin@cgocable.ca

THis exchange is interesting.  But I ran into a problem that doesn't disappear.  Here it is:

> _EnvExplicit := true;

                            _EnvExplicit := true
> eq1 := x^3+4*x^2-5*x+5;

                                 3      2          
                         eq1 := x  + 4 x  - 5 x + 5
> sol := solve(eq1, x);

> real_solutions := remove(has, sol, I);

Error, incorrect number of extra arguments in remove


Can you help?

mario.lemelin@cgocable.ca

plots[display](p0,p1,p2)

 

it only load "display" and it work for me.

mario.lemelin@cgocable.ca

 

mario.lemelin@cgocable.ca

First 12 13 14 15 16 17 18 Page 14 of 19