Kitonum

21565 Reputation

26 Badges

17 years, 137 days

MaplePrimes Activity


These are replies submitted by Kitonum

@Carl Love   Yes, you're right! I considered all my examples in classic worksheet Maple 2015. Check all in Maple 12. In fact there `+` command is significally faster than add command.

@Carl Love  You wrote  " I think that `+`(U[]) is faster than add(u, u= U)".  But the following examples with direct computation the sum of large number of terms does not confirm this conclusion.

The first 2 examples with the precomputed list:

restart;

X:=[seq(i^3, i=1..5000000)]:

t:=time():

`+`(X[]);

time()-t;

                            156250062500006250000000000

                                               9.453

restart;

X:=[seq(i^3, i=1..5000000)]:

t:=time():

add(x, x=X);

time()-t;

                             156250062500006250000000000

                                                7.797

 

In addition 2 examples without the precomputed list:

restart;

t:=time():

add(i^3, i=1..5000000);

time()-t;

                             156250062500006250000000000

                                                1.953

restart;

t:=time():

`+`(seq(i^3, i=1..5000000));

time()-t;

                             156250062500006250000000000

                                                18.032

 

@Alejandro Jakubi   In the help for  add  and  mul  of Maple 2015 is written:  

"The add(x) calling sequence is equivalent to add(i, i in x). Likewise, mul(x) is equivalent to mul(i, i in x)".

@Markiyan Hirnyk   Remove the extra spaces between  Matrix  and the left parenthesis from original code.

@Markiyan Hirnyk  Thank you for your helpful comment. It's interesting that  diff  command works elementwise for lists. For example, for  int  command this is not true.

@Harry Garst  Give your original pointplot, and the community will help you animate it.

@descartes0000 

expand((x+28651/50279)*(x^2+x*21628/50279+50279/28651));

evalf[20](%);

                            

 

 

@ghoust  Just plot  f(x)  and the region under it. The area of this region is your integral:

plot(f(x), x=0..1, color=green, filled=true);

                        

 

 

 

@Markiyan Hirnyk  You are wrong. The output of  convert(x/abs(x), piecewise);  is incorrect because

eval(x/abs(x), x = 0);

     Error, numeric exception: division by zero

@Markiyan Hirnyk 

Obviously OP made a mistake when calculating the derivative of  abs(x)  with Maple. Instead of his line should be

                              

In fact, OP has calculated the second derivative of  abs(x) rather than the first derivative. I showed how to make the check what he meant.

 

@Markiyan Hirnyk  And if instead of  6  would be  136?

@Preben Alsholm Thank you for the deficiencies noted and useful comments.

It is likely that in this case more naturally not write a separate procedure, and simply apply the algorithm to the specific example:

restart;

Eq:=diff(y(x),x)=(y(x)-x)^2;  y(0):=0;  h:=0.1;

y[0]:=y(0);

for k to 10 do

y[k]:=y[k-1]+h*eval(rhs(Eq),{x=h*(k-1), y(x)=y[k-1]});

od:

[seq([i*h, y[i]], i=0..10)];

 

@Markiyan Hirnyk  I think that for OP is required not to use ready-made solution, and write own code to the Euler method. Of course it is difficult for a beginner.

See the solution to your previous question (in the  previous thread).

@sami131   Indeed the curves intersect at about  z=11.7236908

plots[odeplot](Sol, [[z,p(z)], [z,x(z)]], z=0..11.724, color=[red,blue], thickness=2);

Sol(11.7236908);

                             

 

The default  rkf45  for initial value problems (IVP) is a Runge-Kutta Fehlberg method that produces a fifth order accurate solution.

 

First 96 97 98 99 100 101 102 Last Page 98 of 133