## 8779 Reputation

11 years, 314 days

## MaplePrimes Activity

### These are answers submitted by nm

worksheet below generates this pdf

THis is latex generated

\documentclass[12pt,a4paper]{article}
\usepackage[letterpaper,margin=1.2in]{geometry}
\usepackage{enumitem}
\begin{document}
\begin{enumerate}[label=\arabic*)]
\item $A(-12; 2; -1)$,\quad $B(-11; 1; -5)$ \quad $C(-10; -2; 3)$, \quad $(P) :10 x +6 y +z +109 = 0$
\item $A(-12; 2; -1)$,\quad $B(-11; 1; -5)$ \quad $C(-10; 6; 3)$, \quad $(P) :2 x -2 y +z +29 = 0$
\item $A(-12; 2; -1)$,\quad $B(-11; 1; -5)$ \quad $C(-9; 5; -7)$, \quad $(P) :3 x -y +z +39 = 0$
\end{enumerate}
\end{document}

 > restart;

 > mylist := [[[-12, 2, -1], [-11, 1, -5], [-10, -2, 3], 10*x + 6*y + z + 109 = 0], [[-12, 2, -1], [-11, 1, -5], [-10, 6, 3], 2*x - 2*y + z + 29 = 0], [[-12, 2, -1], [-11, 1, -5], [-9, 5, -7], 3*x - y + z + 39 = 0]]

 > currentdir("C:/tmp"); #CHANGE TO WHERE YOU WANT TO SAVE LATEX FILE

 > latex:-Settings(useimaginaryunit=i,           usecolor = false,           powersoftrigonometricfunctions= mixed, ## computernotation,           leavespaceafterfunctionname = true,           cacheresults = false,           spaceaftersqrt = true,           usetypesettingcurrentsettings=true,           linelength=1000000       );

 > do_my_list:=proc(L::list,file_name::string)    local file_id;    local s::string,item;    local toX:= e->latex(e,'output'='string'):    local my_format:=proc(e)::string;       local s::string;       s:=toX(e);       s:=StringTools:-Substitute(s,"[","(");       s:=StringTools:-Substitute(s,"]",")");       s:=StringTools:-SubstituteAll(s,",",";");    end proc:    try        file_id := fopen(file_name,WRITE);    catch:        error StringTools:-FormatMessage(lastexception[2..-1]);    end try;      s:=cat("\\documentclass[12pt,a4paper]{article}\n",    "\\usepackage[letterpaper,margin=1.2in]{geometry}\n",    "\\usepackage{enumitem}\n",    "\\begin{document}\n",    "\\begin{enumerate}[label=\\arabic*)]\n"):    fprintf(file_id,"%s",s);    for item in L do       s:=cat("\\item $A",my_format(item[1]),"$,\\quad $B", my_format(item[2]),"$ \\quad $C",my_format(item[3]), "$, \\quad $(P) :",toX(item[4]),"$\n");       fprintf(file_id,"%s",s);    od;    s:="\\end{enumerate}\n\\end{document}\n";    fprintf(file_id,"%s",s);    fclose(file_id);     end proc:
 > file_name:=cat(currentdir(),"/HW.tex"); do_my_list(mylist,file_name);
 >

I am no expert on this. I find that using pattern matching in CAS to be more natural than using structured types to do this sort of thing. It also does not help that Maple documentation of its most important thing, which is structured typing, has so few examples to learn from. May be if Maple help had extensive examples, doing this sort of thing will not be like black magic any more to new users.

But here is an attempt. I am sure there is better way to do this in Maple.

 > f := -4*sin(x) + 2*exp(y^2) + 5 - 5*cos(x^3)*sin(y^2) + 5*sinh(x^2); # I want to extract terms with sin, sinh, and exp in this expression type_1:=''*'({anything,Or('specfunc(sin)','specfunc(sinh)','specfunc(exp)')})': indets(f,type_1)

 > #I want to get terms having sin(x) and sin(y^2), type_2:=*(And(anything,Or('specfunc(identical(y^2),sin)','specfunc(identical(x),sin)'))); select(hastype,f,type_2);

 > # for terms including sinh(x^3), I want to get Void output. type_3:='specfunc(identical(x^3),sinh)'; indets(f,type_3);

look at evalc

expr:= exp(alpha[i]*I*t);
evalc(expr)


one way

sol := (-v + sqrt(-4*a^2*R^2 + v^2))/(2*a*omega*L);
expand(sol);
map(X->if( hastype(X,'anything'^(1/2)),sqrt(X^2),X),%)


Another using pattern matching

sol := (-v + sqrt(-4*a^2*R^2 + v^2))/(2*a*omega*L);
f:=proc(x)
local a,b,c,la;
if patmatch(x,b::nonunit(anything)*sqrt(a::nonunit(anything)),'la') then
assign(la);
RETURN(sqrt(a*b^2));
else
RETURN(x);
fi;
end proc;
map(X->f(X),expand(sol));


note that in all the above,  sqrt(a)/b is same as sqrt(a/b^2) assuming b>0

## select...

may be there is better way, but try

r:=[[5,7],[],[1,3],[],[5,4]];
select(X->nops(X)>0,r)


Yes, this happens, but the important thing is that the corresponding order with the correct eigenvalue do not change.

i.e the way to read the outout is that the first eigenvalue goes with the first column, the second eigenvalue goes with the second column and so on.

So it does not matter if the eigenvector columns change positions, as long the the corresponding eigenvalues change in same way

btw, if you for some reason need to have same order of eigenvectors each time, you could always sort the eigenvector matrix columns using the numerical values of the corresponding eigenvalues as key for sorting. Something like

 > LI:=LinearAlgebra; M:=Matrix([[0,1],[1,0]]);

 > a,b:=LI:-Eigenvectors(M): b[.., sort(a,output=permutation)]

 > a,b:=LI:-Eigenvectors(M): b[.., sort(a,output=permutation)]

 > a,b:=LI:-Eigenvectors(M): b[.., sort(a,output=permutation)]

 > a,b:=LI:-Eigenvectors(M): b[.., sort(a,output=permutation)]

 > a,b:=LI:-Eigenvectors(M): b[.., sort(a,output=permutation)]

 > a,b:=LI:-Eigenvectors(M): b[.., sort(a,output=permutation)]

Maple 2024

I have feeling there is a better or more direct way to do this but could not find it so far. But here is an attempt

Opps. Fix to make true matrix

R:=Vector[row]([1,2,3]);
C:=Vector([d,e,f]);
convert(convert(map(X->X*C,R),listlist),Matrix);
whattype(%);
LinearAlgebra:-Dimension(%%);


You should really post plain text code. One can't copy code from image. But you can try

sol:=signum(-sigma+q)^2;
simplify(sol) assuming real;


You should really post plain text code next time or at least worksheet.

I tried this in Maple 2024 and Mathematica 14. Both give solution that validate.  Here is Maple's

ode1:= diff(c(T),T)=-2*c(T)*(1+beta__c*c(T)^2/p__c(T)^2);
ode2:= diff(p__c(T),T)=2*(1+beta__c*c(T)^2/p__c(T)^2)*p__c(T);
sol:=[dsolve([ode1,ode2],[c(T),p__c(T)],'explicit')]


 > interface(version);

 > restart;

 > ode1:= diff(c(T),T)=-2*c(T)*(1+beta__c*c(T)^2/p__c(T)^2); ode2:= diff(p__c(T),T)=2*(1+beta__c*c(T)^2/p__c(T)^2)*p__c(T); sol:=[dsolve([ode1,ode2],[c(T),p__c(T)],'explicit')]

 > map(X->odetest(X,[ode1,ode2]),sol)

 >

Here is Mathematica code I tried.

ClearAll["Global*"]
ode1 = c'[T] == -2*c[T]*(1 + \[Beta]*c[T]^2/pc[T]^2);
ode2 = pc'[T] == 2*(1 + \[Beta]*c[T]^2/pc[T]^2)*pc[T];
sol = DSolve[{ode1, ode2}, {c, pc}, T]

Solution also verifies OK

Since both solutions from Maple and Mathematica verfiy OK, then both are correct even though they look different.

set has no implied ordering. So need to use list.  Here is one way out of many

X:=[x12, x1, x3, x15, x2, x9];

f:=proc(a,b)::truefalse;
:-parse(String(a)[2..]) < :-parse(String(b)[2..]) ;
end proc:

sort(X,f);


may be

n:=294912:
d:=8:
eq:=d^m=n/2:
floor(solve(eq,m)):
n/(d^%);


9

This assume n is even

You can easily modify it for odd

Need to tell is x is not negative

simplify(g(f(x))) assuming x>=0

x

This is a guess. When expression is product, such as a*b internally it is   a^1*b^1  so  when you do subs 1=2 you get a^2*b^2. It replaced the exponents by 2.

same for division. You can see this from

subs(1=2,a*b^9)


a^2*b^9

And

dismantle(a*b)


PROD(5)
NAME(4): a
INTPOS(2): 1  ------->
NAME(4): b
INTPOS(2): 1  ----->

Compare to

dismantle(a*b^9)


PROD(5)
NAME(4): a
INTPOS(2): 1   --->
NAME(4): b
INTPOS(2): 9   ---->

So internally for a  PROD   , each term has hidden exponent of by default unless overriden.

For SUM, the same thing. There is a hidden or implied  1. You can see this from

dismantle( a + b);


SUM(5)
NAME(4): a
INTPOS(2): 1 --->
NAME(4): b
INTPOS(2): 1  --->

Compare to

dismantle( a + 9*b);


SUM(5)
NAME(4): a
INTPOS(2): 1  ------->
NAME(4): b
INTPOS(2): 9  ------->1

So when you do

subs(1=2,a+b)


It is as if  you typed

subs(1=2, 1*a+ 1*b)

And that is why you get

2*a + 2*b

It is by design. This is called "infinite scroll"

Google search also introduced this not long ago on its search result. It is terrible feature and Maplesoft seems to copy this.

Many web sites seem to imitate this now.

I much prefer the old way. One page at a time, and click next page to see the next page of result.

I could not find a way to turn it off from google search result.

For Maple's page above, you'd have to ask Maplesoft if they can turn off Infinite Scroll as it is part of the page design and they are the ones who add the javascript in the page to control this.

Outside users has no control as far as I can see on how to prevent Infinite Scroll

So what you see as repositions arbitrarily. is actually a side effect of this automatic scrolling. If not done right, it looks like what you describe and I've seen this in many other sites.

It also makes one lose track of what they were looking on the page when this happens.

The web is a big mess and Maplesoft is just following the trend.

e:=(10*(5+sqrt(41)))/(sqrt(70+10*sqrt(41))*sqrt(130+10*sqrt(41)));
`