## Empty or null values in matrices...

How do I insert an empty or null value into a matrix imported from a csv file?  The imported data assumes the value is zero.

## replacing pattern in expression...

For display only purposes, to get the Latex looking better, I replace the constant of integrations Maple using which is _C1, _C2., etc... to c[1],c[2],.....

This is something I do at the very end of computation, just before I get the Latex of the expression.

The way I do this now, is not good. .And I am asking if there is a better way to do this replacement. In Mathematica, I can do this using a patterm where I tell it to replace  C?  by c[?] where ? means anything.

Is it possible to do something like this in Maple? Here is an example

sol:=dsolve(diff(x(t),t$3) = x(t));  This gives solution as And just before ask for the Latex of this, I change it to This is done using a function. Please see worksheet below. The problem with the current solution is that I do not know how many _C there are, so I assumed 10 as worst case, which works for my case. But I prefer a more general solution, may be using pattern in the subs command?  > restart;  > replace_all_C:=proc(expr::anything) local n,N,c; local new_expr; local max_count :=10; #worst case, since do not know how many new_expr:=expr; for n from 1 to max_count do N:=convert(n,string); new_expr:=subs( :-parse(cat("_C",N))=:-parse(cat("c[",N,"]")),new_expr); od: return new_expr; end proc:  > sol:=dsolve(diff(x(t),t$3) = x(t)); tmp:=replace_all_C(sol)

 >

And now I get the latex of tmp in the above, instead of sol which looks better.

## Plotting f(x) as a function of x logistic map...

Can anyone help with plotting the logistic map as a function in Maple

Logistic map x_(n+1)=f(x_n); f(x_n)=r*X(1-x) with the following values:

r=2.0; x(1)=0.3 f=r.*x.*(1-x)

## w-plane Maple mapping does not agree with comforma...

I created some simple maple 9 code to do some z->w mappings long time ago, on my web page:

https://ingalidakis.com/math/ComplexMaps.html

Upon revising my webpage, I've stumbled upon a page for comformal mappings, by David Bau:

http://davidbau.com/conformal/#exp(z)

Here's the current version of my code in Maple 18:

rrestart;
NULL;
with(plots);
xMax := 1;
yMax := 1;
N := 10;
step := abs(xMax)/N;
GL := proc (x, y) options operator, arrow; x+I*y end proc;
f := sin;
G := {};
for k from -N+1 to N+1 do

G := union(G, {complexplot(f(GL(x, (k-1)*step)), x = -xMax .. xMax, color = brown)});

G := union(G, {complexplot(f(GL((k-1)*step, y)), y = -yMax .. yMax, color = brown)})

end do;
display(G, scaling = constrained);

The code is pretty simple: I am simply scanning the 1x1 unit square complex grid and create a complex plot of it on the w-plane, by passing it through whatever function is at: f:=x.

Does anyone have any idea why the grid lines on the w-plane do not agree with Bau's grid lines mapping of the w-plane? To try it for exp for example, input "exp(z)" in Bau's home page.

The difference is quite noticeable, especially on exp and log, where the orientation of the w-grid on the left and right half-planes, seem to be opposite of what my code displays.

The reason may be Mathematical, but from what I see from the description on Bau's page, there's no difference on the identity function, so I am clueless.

## XMLTools / FirstChild...

Any idea why the result of the FirstChild function of the attached file is

_XML_Text("\n  ")

Test.zip

I also miss a more complete example on Maple Help for writing, reading and processing xml files.

## optimization of function...

restart;

W := proc ()

global rf;

rf := add(xx[ii]^2-nn, ii = 1 .. nn);

return rf ;

end proc;

Optimization:-Minimize(W(), nn = 1 .. 5, seq(xx[ii] = 1 .. 10, ii = 1 .. nn));

Error, (in W) unable to execute add

## Old problem with an ellipse...

A triangle ABC with fixed B and C vertex is considered in the plane, A being variable so that b+c remains constant and equal to a given length L.
We call P, T, T' the points of contact of the exinscrit circle in the angle B with the sides BC, AB and AC respectively.
Show that P is fixed and is one of the vertex of the ellipse described by point A. What are the locus of T and T'? How to animate the drawing when A move ? Thank you.

## Maple Points on a Plot...

Hello! Sorry if this question was already asked, I just can't find my answer and I don't really know how to form the question since I'm new to using Maple. My question is: How can I find a point on a plot I did in Maple? When I use the cursor position(from when I click Probe info) I can never align it right enough for me to not get a decimal answer. For instance, I can't figure out the y-value for when x=2 because the closest I can get to 2 is like 2.1 which isn't exact enough for me.

## Making a function using the diff operator...

This is a very basic question and apologize for not being able to figure it out myself.     I would like to define a function that I can evaluate with a complicated argument.    For example for a simple function, the following works well

f:=x->x^2+x^3;

This allows me to plot f(x) or f(exp(-r)), etc.

However the following syntax does not work in the same way.

g:=x->diff(f(x),x);

I can plot g(x) correctly, but g(exp(-r))  cannot be plotted or evaluated.    The error message is

Error, (in g) invalid input: diff received exp(-r), which is not valid for its 2nd argument

## error in solving equations and plotting...

Hi guys,

an error appeared in solving a set of equations and plotting the solution, I dont know how to handle it!!

Best

problem.mw

## can any one solve this?...

 >
 > restart:
 >
 (1)
 > eq11 := (10-9*lambda1)*n*diff(f(eta),eta,eta,eta)*(-diff(f(eta),eta,eta))^(n-1)-m*diff(f(eta),eta)^2+M^2*diff(f(eta),eta)+(m*(2*n-1)+1)/(n+1)*f(eta)*diff(f(eta),eta,eta)=0;
 (2)
 > eq21 := (10-9*lambda1)*n*diff(theta(eta),eta,eta)*(-diff(theta(eta),eta))^(n-1)+(m*(2*n-1)+1)/(n+1)*f(eta)*diff(theta(eta),eta)-m*diff(f(eta), eta)*theta(eta)=0;
 (3)
 > bc21:= f(0)=0, D(f)(0)=1+alpha*(D@@2)(f)(0), D(f)(N)=0, theta(0)=1+b*D(theta)(0), theta(N)=0;
 (4)
 >
 > n:=1.2: b:=0: M:=0: alpha:=0:
 > N:=6:
 >
 > m:=0.8:
 > A11:=dsolve({eq11,eq21,bc21},numeric,continuation=lambda1,maxmesh=15000, output=array([seq( i, i=0..N,0.01 )])):
 > m:=1.2:
 > A12:=dsolve({eq11,eq21,bc21},numeric,continuation=lambda1,maxmesh=15000, output=array([seq( i, i=0..N,0.01 )])):
 > m:=2:
 > A13:=dsolve({eq11,eq21,bc21},numeric,continuation=lambda1,maxmesh=15000, output=array([seq( i, i=0..N,0.01 )])):
 >
 >
 > with(plots):
 > p1:=odeplot(A11, [[eta,f(eta),color=red,linestyle=2]],0..N): p2:=odeplot(A12, [[eta,f(eta),color=blue,linestyle=2]],0..N): p3:=odeplot(A13, [[eta,f(eta),color=green,linestyle=2]],0..N):
 >
 > display({p1,p2,p3}, axes=boxed,  title=velerature Profiles:);
 >
 >
 > for j from 1 to 100*(N-1) do eta[j]:=A11[2,1][j,1] end do:
 > for j from 1 to 100*(N-1) do vel1[j]:=A11[2,1][j,2] end do:
 > for j from 1 to 100*(N-1) do vel2[j]:=A12[2,1][j,2] end do:
 > for j from 1 to 100*(N-1) do vel3[j]:=A13[2,1][j,2] end do:
 >
 > with(LinearAlgebra): E1:= <|||>;
 (5)
 >
 > #ExportMatrix("F:/D/Drive D/Local/Rashad/Paper 9/vel1.txt", E1, format = rectangular):
 >

 > with(plots):
 > p1:=odeplot(A11, [[eta,theta(eta), color=red,linestyle=2]],0..N): p2:=odeplot(A12, [[eta,theta(eta), color=blue,linestyle=2]],0..N): p3:=odeplot(A13, [[eta,theta(eta), color=green,linestyle=2]],0..N):
 >
 > display({p1,p2,p3}, axes=boxed,  title=temperature Profiles:);
 >
 >

 > for j from 1 to 100*(N-1) do eta[j]:=A11[2,1][j,1] end do:
 > for j from 1 to 100*(N-1) do temp1[j]:=A11[2,1][j,5] end do:
 > for j from 1 to 100*(N-1) do temp2[j]:=A12[2,1][j,5] end do:
 > for j from 1 to 100*(N-1) do temp3[j]:=A13[2,1][j,5] end do:
 >
 > with(LinearAlgebra): E2:= <|||>;
 (6)
 > #ExportMatrix("F:/D/Drive D/Local/Rashad/Paper 9/temp1.txt", E2, format = rectangular):
 >
 >

## Finding all Eigenvectors for real and repeated ei...

When a real matrix have repeated eigenvalue (i.e. multiplicity >1) and the matrix is not the identity matrix, then it is called defective eigenvalue.

For example if the eigenvalue is repeated 2 times, there will be only one eigevector associated with it.

There is an algorithm to generate another (linearly independent) eigenvector from this same eigenvalue called the defective eigenvalue method.

My question is: Does Maple have support for finding such additional eigenvectors?  The standard Eigenvectors does not seem to do this. Here is an example.

restart;
A :=Matrix([[1,-2],[2,5]]);
(eigen_values, eigen_vectors) := LinearAlgebra:-Eigenvectors(A);


By hand, using the defective eigenvalue method it is possible find second eigenvector for this eigenvalue, which is linearly independent of the one returned by Maple. Such as

The method to find these additional eigenvector is described in number of places such as

https://en.wikipedia.org/wiki/Defective_matrix

And the pdf at the bottom show a more detailed example.

I can code this method by hand to find complete set of L.I. eigenvectors for this defective eigenvalue.

But before doing that, I thought to ask if Maple have buildin support for this, such as a single command to do this or some package.

I looked at help for LinearAlgebra and I am still not able to see anything, It only says this:

With an eigenvalue of multiplicity  k>1 , there may be fewer than  k linearly independent eigenvectors. In this case, the matrix is called defective.  By design, the returned matrix always has full column dimension.  Therefore, in the defective case, some of the columns that are returned are zero.  Thus, they are not eigenvectors.  With the option, output=list, only eigenvectors are returned.  For more information, see LinearAlgebra[JordanForm] and LinearAlgebra[SchurForm].

This PDF also describes using Maple, how to do it for one example

https://wps.prenhall.com/wps/media/objects/884/905485/chapt5/proj5.4/proj5-4.pdf

This PDF also describes how to do it by hand without using Maple, starting at end of page 3

http://www.math.utah.edu/~zwick/Classes/Fall2013_2280/Lectures/Lecture23_with_Examples.pdf

It is not too hard to code this method in Maple. But if Maple allready can do it, using some command, it will be better ofcourse.

## Levelsurface visualization...

To practice more in documentmode
Given  f := x^2 + y^2 + z^2 = 1
surfacelevel on level 1  and surfacelevel upon wich the point (sqrt(3), 3, -2) is located.

1) x^2 + y^2 + z^2 = 1   : what solid ( a sphere with radius 1)  and  plot
2) surfacelevel (solid sphere)   for point  (sqrt(3), 3, -2) and plot
3) Plot together

Doing this calculation solely with contextpanel..no that's not always possible as it seems by trying to plot a sphere.

## How do I show animated point on odeplot?...

restart;

with(plots);

a:=0.2; b:=0.2; c:=5.7;

ode1:=diff(x(t),t)=-y(t)-z(t);

ode2:=diff(y(t),t)=x(t)+a*y(t);

ode3:=diff(z(t),t)=b+z(t)*(x(t)-c);

ic1:=x(0)=-0.7;

ic2:=y(0)=-0.7;

ic3:=z(0)=1;

sol:=dsolve({ode1,ode2,ode3,ic1,ic2,ic3},{x(t),y(t),z(t)},numeric,method=classical[rk4],stepsize=0.10,output=listprocedure);
b:=rhs(sol[2]);

c:=rhs(sol[3]);

d:=rhs(sol[4]);

animate (pointplot3d, [ [b(t),c(t),d(t)], symbol=box, color=blue],t=15..100, background = odeplot(sol, [x(t),y(t),z(t)],t=15..100,numpoints=7000),frames=20);

UPD
And "Error, (in plots/animate) incorrect first argument" BUT if i use classic functions (sin,cos,sqrt) instead of b,c,d - all is well.

For example [sin(t),cos(t),t/10]

For example [b(t),c(t),d(t)]
Error, (in plots/animate) incorrect first argument

## small new issue with Physics:-Latex...

Using latest Physics, I found case where it is not giving the Latex.

Please see attached worksheet.  This is on windows 10, Maple 2020.1.1

 > restart;
 > interface(version);

 > Physics:-Version()

 > ode:=diff(y(t),t) = -2*arctan(y(t))/(1+y(t)^2);

 > sol:=dsolve(ode)

 > Physics:-Latex(sol)

Error, (in unknown) invalid range for string subscript

 > latex(sol)

t+\int ^{y \left( t \right) }\!{\frac {{{\it \_a}}^{2}+1}{2\,\arctan
\left( {\it \_a} \right) }}{d{\it \_a}}+{\it \_C1}=0

 >

By trial and error, I found that the error was introduced in Physics 797. Since in Physics 796 it did work.

Here is screen shot