Carl Love

Carl Love

28055 Reputation

25 Badges

12 years, 358 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are answers submitted by Carl Love

convert(expand(u^3+u^2-1), exp);

There are numerous problems in your code. First, the inverse tangent function is arctan, not atan. Second, you cannot make an assignment inside a return statement (or any other statement). Unlike C, in Maple an assignment is not an expression that can be part of another expression. Third, what's the point of having a loop if you're always going to return on the first iteration?

Correct these and then maybe we can discuss the rest.

I was able to get a result by substantially reducing the requested accuracy. I had to increase abserr, but not relerr. So, I'm a bit skeptical about this result. I changed your theta to T to save typing.

restart:
ODE:=
     (1+T(x))*diff(T(x),x) + x*diff(T(x),x)^2 +
     x*(1+T(x))*diff(T(x),x$2) - T(x)^3-diff(T(x), x)
     = 0
;

BCs:= T(1)=1, D(T)(0) = 0:

Sol:= dsolve(
     {ODE, BCs}, numeric, method= bvp[middefer],
     maxmesh= 2^15, abserr= .58e-1
):
plots:-odeplot(Sol, [x,T(x)], x= 0..1);

subs is a low-level command that can only be used to substitute for subexpressions that appear as nodes on the tree that represents the expression. So using subs requires some (small) amount of knowledge of how expressions are stored. For example, in the expression x+y+z, the nodes are x+y+z, x, y, and z; x+y is not a node. You can see the tree representing an expression by using ToInert(expression). Unfortunately, the representation is not graphical.

algsubs is a high-level command that can be used to substitute for more-complicated subexpressions. The syntax is the same as subs. In your case, that would be

algsubs(cosh(k*h)/sinh(k*h)= 1/tanh(k*h), td);

If tangent lines are perpendicular, then their corresponding radii are perpendicular.  Given three points A, B, C, then AB is perpendicular to BC iff (A[2]-B[2])*(C[2]-B[2]) = (B[1]-A[1])*(C[1]-B[1]).

I also vastly simplified the rest of your code, mostly by using isolve to get the integer points on the circle.

restart:

with(geometry):

(Mx,My):= (-1,-5):  R:= 5:

point(M,Mx,My):

eqS:= (x-Mx)^2 + (y-My)^2 = R^2:

 

Find the points with integer coordinates on the circle and remove any with either coordinate the same as the center.

L:= remove(pt-> pt[1]=Mx or pt[2]=My, map2(eval, [x,y], [isolve({eqS})]));

[[-5, -8], [-5, -2], [-4, -9], [-4, -1], [2, -9], [2, -1], [3, -8], [3, -2]]

For each such point, get the equation of the tangent line.

circle(S, eqS, [x,y]):

k:= [seq](sort(Equation(TangentLine(P, S, point(A, pt[])), [x,y])), pt in L):

 

Pair each line with its point of tangency.

Lk:= zip(`[]`, L, k);

[[[-5, -8], -4*x-3*y-44 = 0], [[-5, -2], -4*x+3*y-14 = 0], [[-4, -9], -3*x-4*y-48 = 0], [[-4, -1], -3*x+4*y-8 = 0], [[2, -9], 3*x-4*y-42 = 0], [[2, -1], 3*x+4*y-2 = 0], [[3, -8], 4*x-3*y-36 = 0], [[3, -2], 4*x+3*y-6 = 0]]

 

Form all pairs of the tangent lines, and remove any pair where the lines are perpendicular. If tangent lines are perpendicular, then theircorresponding radii are perpendicular.  Given three points A, B, C, then AB is perpendicular to BC iff (A[2]-B[2])*(C[2]-B[2]) = (B[1]-A[1])*(C[1]-B[1]).

PLk:= remove(
     #Perpendicularity criterion:
     P-> (P[1,1,2]-My)*(P[2,1,2]-My) = (Mx-P[1,1,1])*(P[2,1,1]-Mx),
     combinat:-choose(Lk,2)
);

 

[[[[-5, -8], -4*x-3*y-44 = 0], [[-5, -2], -4*x+3*y-14 = 0]], [[[-5, -8], -4*x-3*y-44 = 0], [[-4, -9], -3*x-4*y-48 = 0]], [[[-5, -8], -4*x-3*y-44 = 0], [[2, -1], 3*x+4*y-2 = 0]], [[[-5, -8], -4*x-3*y-44 = 0], [[3, -8], 4*x-3*y-36 = 0]], [[[-5, -8], -4*x-3*y-44 = 0], [[3, -2], 4*x+3*y-6 = 0]], [[[-5, -2], -4*x+3*y-14 = 0], [[-4, -1], -3*x+4*y-8 = 0]], [[[-5, -2], -4*x+3*y-14 = 0], [[2, -9], 3*x-4*y-42 = 0]], [[[-5, -2], -4*x+3*y-14 = 0], [[3, -8], 4*x-3*y-36 = 0]], [[[-5, -2], -4*x+3*y-14 = 0], [[3, -2], 4*x+3*y-6 = 0]], [[[-4, -9], -3*x-4*y-48 = 0], [[-4, -1], -3*x+4*y-8 = 0]], [[[-4, -9], -3*x-4*y-48 = 0], [[2, -9], 3*x-4*y-42 = 0]], [[[-4, -9], -3*x-4*y-48 = 0], [[2, -1], 3*x+4*y-2 = 0]], [[[-4, -9], -3*x-4*y-48 = 0], [[3, -2], 4*x+3*y-6 = 0]], [[[-4, -1], -3*x+4*y-8 = 0], [[2, -9], 3*x-4*y-42 = 0]], [[[-4, -1], -3*x+4*y-8 = 0], [[2, -1], 3*x+4*y-2 = 0]], [[[-4, -1], -3*x+4*y-8 = 0], [[3, -8], 4*x-3*y-36 = 0]], [[[2, -9], 3*x-4*y-42 = 0], [[2, -1], 3*x+4*y-2 = 0]], [[[2, -9], 3*x-4*y-42 = 0], [[3, -8], 4*x-3*y-36 = 0]], [[[2, -1], 3*x+4*y-2 = 0], [[3, -2], 4*x+3*y-6 = 0]], [[[3, -8], 4*x-3*y-36 = 0], [[3, -2], 4*x+3*y-6 = 0]]]

 

For each such pair of lines, find the point of intersection.

map(P-> [P[1,2], P[2,2], solve([P[1,2],P[2,2]], [x,y])[]], PLk);

[[-4*x-3*y-44 = 0, -4*x+3*y-14 = 0, [x = -29/4, y = -5]], [-4*x-3*y-44 = 0, -3*x-4*y-48 = 0, [x = -32/7, y = -60/7]], [-4*x-3*y-44 = 0, 3*x+4*y-2 = 0, [x = -26, y = 20]], [-4*x-3*y-44 = 0, 4*x-3*y-36 = 0, [x = -1, y = -40/3]], [-4*x-3*y-44 = 0, 4*x+3*y-6 = 0], [-4*x+3*y-14 = 0, -3*x+4*y-8 = 0, [x = -32/7, y = -10/7]], [-4*x+3*y-14 = 0, 3*x-4*y-42 = 0, [x = -26, y = -30]], [-4*x+3*y-14 = 0, 4*x-3*y-36 = 0], [-4*x+3*y-14 = 0, 4*x+3*y-6 = 0, [x = -1, y = 10/3]], [-3*x-4*y-48 = 0, -3*x+4*y-8 = 0, [x = -28/3, y = -5]], [-3*x-4*y-48 = 0, 3*x-4*y-42 = 0, [x = -1, y = -45/4]], [-3*x-4*y-48 = 0, 3*x+4*y-2 = 0], [-3*x-4*y-48 = 0, 4*x+3*y-6 = 0, [x = 24, y = -30]], [-3*x+4*y-8 = 0, 3*x-4*y-42 = 0], [-3*x+4*y-8 = 0, 3*x+4*y-2 = 0, [x = -1, y = 5/4]], [-3*x+4*y-8 = 0, 4*x-3*y-36 = 0, [x = 24, y = 20]], [3*x-4*y-42 = 0, 3*x+4*y-2 = 0, [x = 22/3, y = -5]], [3*x-4*y-42 = 0, 4*x-3*y-36 = 0, [x = 18/7, y = -60/7]], [3*x+4*y-2 = 0, 4*x+3*y-6 = 0, [x = 18/7, y = -10/7]], [4*x-3*y-36 = 0, 4*x+3*y-6 = 0, [x = 21/4, y = -5]]]


Download Nonperpendicular.mw

Let the expression be expr. Then do

op(indets(expr, specfunc(anything, RootOf))[1]);

Yes, it is easy with plotsetup(window). See help pages ?plot,device and ?plotsetup .

Your question is barely readable. In the future, enter your matrix into Maple and then cut-and-paste the matrix into your post.

I hope that you can draw your conclusions from the following worksheet. If not, ask for more help.


restart:

A:= < k+3, 2, k-4, 3;
      0,   2,  -9, 5;
      0,   0, k^2+k-2, k-1 >;  

A := Matrix(3, 4, {(1, 1) = k+3, (1, 2) = 2, (1, 3) = k-4, (1, 4) = 3, (2, 1) = 0, (2, 2) = 2, (2, 3) = -9, (2, 4) = 5, (3, 1) = 0, (3, 2) = 0, (3, 3) = k^2+k-2, (3, 4) = k-1})

(1)

eval(A, k=1);

Matrix(3, 4, {(1, 1) = 4, (1, 2) = 2, (1, 3) = -3, (1, 4) = 3, (2, 1) = 0, (2, 2) = 2, (2, 3) = -9, (2, 4) = 5, (3, 1) = 0, (3, 2) = 0, (3, 3) = 0, (3, 4) = 0})

(2)

solve(A[3,3] = 0, {k});

{k = 1}, {k = -2}

(3)

eval(A, k= -2);

Matrix(3, 4, {(1, 1) = 1, (1, 2) = 2, (1, 3) = -6, (1, 4) = 3, (2, 1) = 0, (2, 2) = 2, (2, 3) = -9, (2, 4) = 5, (3, 1) = 0, (3, 2) = 0, (3, 3) = 0, (3, 4) = -3})

(4)

 


Download Parametric_linear_system.mw

 

 


restart:

Notice the use of  `*` instead of implied multiplication

Sys:=
     4*x1 + 2*x2 - 7*x3 - 11*x4 = 5,

     2*x1 + 1*x2 - 2*x3 - 4*x4 = 2,

     4*x1 + 2*x2 - 10*x3 - 14*x4 = 6
:

X:= [x||(1..4)]:

A:= LinearAlgebra:-GenerateMatrix([Sys], X, augmented);

A := Matrix(3, 5, {(1, 1) = 4, (1, 2) = 2, (1, 3) = -7, (1, 4) = -11, (1, 5) = 5, (2, 1) = 2, (2, 2) = 1, (2, 3) = -2, (2, 4) = -4, (2, 5) = 2, (3, 1) = 4, (3, 2) = 2, (3, 3) = -10, (3, 4) = -14, (3, 5) = 6})

(1)

R:= LinearAlgebra:-ReducedRowEchelonForm(A);

R := Matrix(3, 5, {(1, 1) = 1, (1, 2) = 1/2, (1, 3) = 0, (1, 4) = -1, (1, 5) = 2/3, (2, 1) = 0, (2, 2) = 0, (2, 3) = 1, (2, 4) = 1, (2, 5) = -1/3, (3, 1) = 0, (3, 2) = 0, (3, 3) = 0, (3, 4) = 0, (3, 5) = 0})

(2)

Sol:= LinearAlgebra:-LinearSolve(A, free= t);

Sol := Vector(4, {(1) = t[1], (2) = -2*t[1]+4/3+2*t[4], (3) = -1/3-t[4], (4) = t[4]})

(3)

The solution space is two-dimensional. Verify the solution by plugging into the original system of equations.

eval(Sys, X =~ convert(Sol, list));

5 = 5, 2 = 2, 6 = 6

(4)

 


Download Linear_system.mw

Use command residue. For example

residue(1/z, z= 0);

     1

The problem is that you are using m in two different ways. You are using it as an index to the middle add, and you are using it as a procedure. Try this:

t:= exp(2*Pi*I/11);
Mij:= (i,j)-> M[(i mod 11)+1, (j mod 11)+1] ;  
mu:= proc(i,j)
local n,m,k;
     add(add(add(a[k]*a[m]*a[n]*t^m*Mij(i+k-m,j+n-m), n= 0..10), m= 0..10), k= 0..10)
end proc;

Your "New problem" is caused by you trying to return an expression sequence. There is no facility for the return value of a procedure produced by unapply to be an expression sequence. There are two things you can do: (1) Make the return value a list, or (2) Make the return value a list and compose the result with op to convert it back to an expression sequence.

To do (1):

f:= unapply(
      [seq(product(t[j]^'Q[j,i]',j=1..RowDimension(Q)),i=1..ColumnDimension(Q))]
    , seq(t[i],i=1..RowDimension(Q))
);

To do (2):

f:= op@unapply(
      [seq(product(t[j]^'Q[j,i]',j=1..RowDimension(Q)),i=1..ColumnDimension(Q))]
    , seq(t[i],i=1..RowDimension(Q))
);

The solve command should contain variables u and v, not %u and %v.

You can do it like this:

for i in seq(0..100, 0.2), seq(100..0, -0.2) do ... end do;

I will assume that the backslash in your expression should have been a forward slash---that it represents ordinary division. I'll plot a unit sphere in spherical coordinates. So, I am also assuming that you want x and y to range from -1 to 1.

f:= (x,y)-> (5*x^2*y^2-6*x^4)/((1-y^2)*(x^2+y^2)-y^2*(1-x^2-y^2));

plot3d(
     1, theta= 0..2*Pi, phi= 0..Pi,
     color= f(cos(theta)*sin(phi), sin(theta)*sin(phi)),
     coords= spherical, style= patchnogrid, labels= [x,y,z]
);

 

First 295 296 297 298 299 300 301 Last Page 297 of 395