Carl Love

Carl Love

28095 Reputation

25 Badges

13 years, 100 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are answers submitted by Carl Love

There are three differences between map and LinearAlgebra:-Map (henceforth, simply Map): in-place operation, the treatmeat of immutable entries, and the options that can be passed in square brackets.

In-place operation: Map(f, A) changes A. But map(f, A)---like the vast majority of Maple commands---does not change its arguments. It makes a copy of A and changes that. So, your example that purports to show that sometimes map and Map operate the same is incorrect.

restart:
with(LinearAlgebra):
A:= <2>:
B:= Map(x-> x^2, A);

A[1];

               4

B:= map(x-> x^2, A);

A[1];

            4

The treatment of immutable entries: This is what is shown correctly by your second example. If certain entries cannot be changed, then Map does not change them; map does change them, but in the copy of course. In your example, the lower triangle and the diagonal cannot be changed because the Matrix is declared to be unit lower triangular.

Options: Both Map and map have options that can be passed in square brackets next to the command. These options are different, as described on the respective help pages.

 

Rather than saying that print produces no output, I'd say that the output of print is NULL and that it produces printed results as a side effect.

Also, the structures in your first example (in the original Question) are properly called lists, not arrays.

L:= [1,1,1,2,3,3,4]:
[ListTools:-SearchAll(1,L)];

[ListTools:-SearchAll(2,L)];

                              [4]

seq(myfun(V1[[1..k-1,k+1..-1]]), k= 1..numelems(V1));

If you need it in a for loop, then

for k to numelems(V1) do
     myfun(V1[[1..k-1,k+1..-1]])
end do:

There is very useful version of solve called eliminate which returns the partial solutions (i.e., certain variables eliminated from the equations) and the residual equations. Here, I re-solve those residual equations. For educational purposes, I recommend that you look at the results of eliminate below.

eqs:= {3*a+4*b = 3*x, 5*a+7*b = 7*x}:
vars:= {a,b}: newvars:= {z||(1..nops(vars))}:
Subs:= newvars =~ vars/~x:
subs(Subs, solve(eliminate(eqs union Subs, vars)[2], newvars));

A table is easier. Change the line

m:= (T, x1+x2);

to

m[T]:= [T, x1+x2];

That will make m a table. When you want to use the table, type

convert(m, list)

For example,

plot(convert(m, list));

I find no mistakes, just explainable differences between the plots.

The first difference is the grid spacing. The analytic plot is using the default 25x25 grid. The numeric plot is using the grid that you chose for the finite element method, which is 11x11. You can reduce the grid on the analytic plot by including the option grid= [11,11] in the plot3d command.

The other difference is the scaling on the x and y axes. In the analytic plot, these are of course the x= 0..1 and y= 0..1 which are the true scaling of the problem. But the numeric plot is generated with the matrixplot command, which by default uses the row and column numbers of the matrix for the independent-axes labelling. The matrix data contains only the z values; the scaling for the other axes cannot be deduced from it. The axes on the matrixplot can be rescaled by adding the option

axis[1,2]= [tickmarks= [1=0, 2=``, 3=.2, 4=``, 5=.4, 6=``, 7=.6, 8=``, 9=.8, 10=``, 11=1]]

Making both of those changes, I get these plots:

No. If you try it, you'll get an error message saying that the method can only be used on linear ODEs.

dsolve({diff(y(x),x) = y(x)^2, y(0)=1}, {y(x)}, method= laplace);

Error, (in dsolve/inttrans/solveit) transform method can only be applied to linear ODE

Try this:

sort(add(a||k*x^k, k= 0..N), x, ascending);

No explicit print command is required.

Let me know how that works for your situation.

While it is not exactly changing the font, permanently changing your zoom factor is easier than permanently changing your default font size, and it may just as well be a solution for your vision issue. Go to the Tools menu and open the Options dialog. Go to the Interface tab. The third item is "Default zoom". Set it at 125% and then click Apply Globally at the bottom of the dialog.

If an expression needs to be fully evaluated before becoming the body of a function, then use unapply to create the function, like this:

a:= 3*x+5:
f:= unapply(a, x);

f(1);
                                        8

Mehdi,

You need to put your points into a list rather than a set to preserve their order. Just change your last line to

plot([seq([t,w[t]],t=0..0.3,h)]);

How about this? I reduced the points and frames just to avoid having to upload a huge file.

plots:-animate(
    plots:-polarplot,
    [2-2*sin(theta), theta= 0..T, filled, numpoints= 50],
    T= 0..2*Pi, frames= 50, paraminfo= false
);

First, download the OrthogonalExpansions package from the Maple Applications Center. Then


restart:

x^2 = OrthogonalExpansions:-FourierSeries(x^2, x= -Pi..Pi, infinity);

x^2 = (1/3)*Pi^2+Sum(4*(-1)^i*cos(i*x)/i^2, i = 1 .. infinity)

eval(%, x= Pi);

Pi^2 = (1/3)*Pi^2+Sum(4*(-1)^i*cos(i*Pi)/i^2, i = 1 .. infinity)

simplify(%) assuming i::posint;

Pi^2 = (1/3)*Pi^2+Sum(4/i^2, i = 1 .. infinity)

expand(%);

Pi^2 = (1/3)*Pi^2+4*(Sum(1/i^2, i = 1 .. infinity))

solve(%, indets(%, specfunc(anything, Sum)))[];

Sum(1/i^2, i = 1 .. infinity) = (1/6)*Pi^2

 


Download Fourier_Euler.mw

Frames:= 25:
plots:-animate(
     plots:-odeplot,
     [
          Trajectoire,
          [seq([x||k(t), y||k(t), t], k in [$1..9, A])],
          t= TempsInitial..T, numpoints= 10000
     ],
     T= TempsInitial+(TempsFinal-TempsInitial)/Frames .. TempsFinal,
     frames= Frames, axes= boxed, scaling= constrained
);

 

First 311 312 313 314 315 316 317 Last Page 313 of 395