mmcdara

6408 Reputation

17 Badges

8 years, 17 days

MaplePrimes Activity


These are questions asked by mmcdara

Hi guys, 

I always thought matrices (Matrix) and 2D arrays (Array) where different objects in Maple.

In the attached file you will find a few examples of build-in functions which prove that Maple doesn't always check correctly the type of the arguments.

Beyond the questions set in the attached file, is there some tacit and unspoken rule in Maple which considers that Matrix and 2D Array have to be treated equally ?


Thanks for your answers

Matrix_or_Array.mw

Hi everybody,

I use dsolve(..., numeric, events =[...], parameters = [...], range=0..TMAX) to solve a parameterized system of 2 ODEs (unknowns x(t) and v(t)).

The solution over the whole range [0, TMAX] is constructed by assembling partial solutions over adjacent subranges of [0, TMAX].

(please look the attached file and feel free to contact me if you need more details than those given below

There exist two types of solution :

  • Type 1 : trivial solution : for all t in some range [a>=0, b<= TMAX], the solution is x(t)=0 and v(t)=0
  • Type 2 : for all t in some range [b>=0, c<= TMAX] {x(t), v(t)} is the solution of the differential system


The end of the simulation corresponds :

  • either to t=TMAX
  • either to x(t) = CMAX where CMAX is some predefined value for x(t)
     

I use events to manage the two following situations 

  • x(t) = CMAX
  • x(t) = 0 and v(t) < 0 : this is the situation which describes the transition between Type 2 solutution and Type 1 solution


The global solution is constructed by assembling partial solutions over subranges [0, b[1]], [b[1], b[2]], [b[2], b[3]] ... where type 1 solutions "live" in [b[n], b[n+1]] if n is odd and type 2 solutions in  [b[n], b[n+1]] if  n is even.
 
The assembly of the partial solutions doesn't work correctly : I identified the reason but I'm not capable to fix it.
If you look to the red instructions on yellow background you will see they do not return the same answer than the pink instructions (look to the blue outputs over the plot) . 

This is probably due to a very big mistake on my part  but I can't fix it !

Once again, if my explanations are not sufficient or if I'm not enough clear, feel free to ask me any questions you need.

Thanks in advance

 

ParametricDsolve.mw

 



 

Hi everybody,

I use the Grid package to do intensive computations.

For some reason I'm ignorant about, the test case described in the Grid[Server][StartServer] 

 help page doesn't work with Maple 2015 (neither on Mac OS X, neither on Windows 7 ; here is the mw file run on MAC Os X)

Could someone explain me why (probably something I did not read with enough attention ... some license maybe) ?
Thanks in advance

GridServer.mw

Hi,

I am a little bit surprised by the result of the operation evalf[8](f(y)) in the piece of code that follows.
I was expected the answer to be 2.4494897, not 2.4494898.

Happily the sequence
res := f(y) ; evalf[8](res)
returns the expected result 2.4494897

I suspect the difference comes from some precedence of the operators (f and evalf) but I can't figure out what really happens

Could you enlight me please ?

Thanks in advance

 

restart:

interface(version);

`Standard Worksheet Interface, Maple 2015.2, Mac OS X, December 21 2015 Build ID 1097895`

(1)

Digits;

10

(2)

f := x -> sqrt(2.0)*x;

proc (x) options operator, arrow; sqrt(2.0)*x end proc

(3)

y := sqrt(3.0):

f(y);

2.449489743

(4)

evalf[9](f(y));  # right

2.44948974

(5)

evalf[8](f(y));  # ????

2.4494898

(6)

res := f(y);
evalf[8](res);  # right

2.449489743

 

2.4494897

(7)

 

 

 

Hello everybody, 

I use Maple to obtain the solution of a reccurrence equation :
r := rsolve({u(n)=n*(u(n-1)+1), u(0)=0}, u)

Now I want to define a function s(n) wich returns the integer value of the nth term u(n).
In the attached file three different attempts to compute the numerical value of s(2) (you can replace "2" by any other positive integer) are given.

  • S := unapply(r, n);
     
  • S := unapply(convert(r, sum), n);
     
  • S := unapply(simplify(convert(r, sum)), n);


But none of them returns an integer and I'm always forced to apply some operation to "transform" the output into the desired integer.
Could you please help me to understand why it is so ?

Thanks in advance

2018.mw

 

First 38 39 40 41 42 43 Page 40 of 43