Carl Love

Carl Love

28100 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@nm I agree: Legend placement in Maple is horrible. Note also that the title is somewhat centered over the plot/legend pair rather than over the plot itself. One should be able to put the legend in the plot (inside the axes box).

What makes you "sure" that there is a "special case" solution to this? Have you actually ever seen a Maple plot with a correctly placed stacked legend?

@nm 

Use the legendstyle option:

display(
     [p1,p2], axes= boxed,
     title=`step and impulse reponses`,
     legendstyle= [location= right]
);

Do you mean that you want to extract the coefficients of h[1,1,1] and h[2,1,1]? Note that each one's coefficient will contain the other.

@Joe Riel 

Since the OP said that this was a linear algebra homework problem, I suspect that there is an algorithm (other than brute search) to solve it. I doubt that solving a system of quadratic equations was the intended way.

Clearly msolve has some severe limitations/bugs when solving this problem. However, I've been able to tweak it so that it gives the answer.

 

restart:

n:= 5:

M:= <2,0;0,3>:
P:= <a,b;c,d>:

Eqs:= convert(P^%T.M.P - <1,0;0,1>, set)[];

2*a*b+3*c*d, 2*a^2+3*c^2-1, 2*b^2+3*d^2-1

Note that there are only three equations.

nops({Eqs});

3

We add a fourth equation of the form a = constant for all n possible values of the constant. There is no special reason to choose a for this; any variable will do.

Sol:= {seq(msolve({Eqs, a=k}, n), k= 0..n-1)};

{a = 0, d = 0, {a = 1, d = 2}, {a = 1, d = 3}, {a = 4, d = 2}, {a = 4, d = 3}, {a = 2, b = 2, c = 1, d = 4}, {a = 2, b = 2, c = 4, d = 1}, {a = 2, b = 3, c = 1, d = 1}, {a = 2, b = 3, c = 4, d = 4}, {a = 3, b = 2, c = 1, d = 1}, {a = 3, b = 2, c = 4, d = 4}, {a = 3, b = 3, c = 1, d = 4}, {a = 3, b = 3, c = 4, d = 1}}

We consider to be garbage any solution which does not specify a value for all four variables.

'P' in map2(eval, P, select(S-> nops(S)=4, Sol));

`in`(P, {Matrix(2, 2, {(1, 1) = 2, (1, 2) = 2, (2, 1) = 1, (2, 2) = 4}), Matrix(2, 2, {(1, 1) = 2, (1, 2) = 2, (2, 1) = 4, (2, 2) = 1}), Matrix(2, 2, {(1, 1) = 2, (1, 2) = 3, (2, 1) = 1, (2, 2) = 1}), Matrix(2, 2, {(1, 1) = 2, (1, 2) = 3, (2, 1) = 4, (2, 2) = 4}), Matrix(2, 2, {(1, 1) = 3, (1, 2) = 2, (2, 1) = 1, (2, 2) = 1}), Matrix(2, 2, {(1, 1) = 3, (1, 2) = 2, (2, 1) = 4, (2, 2) = 4}), Matrix(2, 2, {(1, 1) = 3, (1, 2) = 3, (2, 1) = 1, (2, 2) = 4}), Matrix(2, 2, {(1, 1) = 3, (1, 2) = 3, (2, 1) = 4, (2, 2) = 1})})

 

``

 

Download matrix_mod_5.mw

@sajjad 

No, it is not a limitation of Maple. It is mathematically impossible to get any better answer.

@sajjad 

You'll not get any answers better than those containing RootOf. It's mathematically impossible.

@k20057 5 

Are you using the new code that I wrote, the one named RandomPartitions?! That code will not output [0, 0, 0, 0, 8, 0]. All the partitions are sorted in increasing order.

Please post your code or attach a worksheet.

@as5987 

You are failing to understand the most basic things that I am telling you, and I am getting frustrated. Perhaps you need someone who knows both English and your native language to interpret my responses for you.

WHY ARE YOU EXPLICITLY SELECTING THE SECOND POINT RETURNED BY solve WHEN YOU WANT THE FIRST POINT?!?! THE CODE Sol[2,1] AND Sol[2,2] EXPLICITLY SELECTS THE SECOND POINT.

 

restart:

#Procedure to compute the distance between 2 points.
dist:= proc(Pt1,Pt2)
option inline;
     evalf(sqrt(`+`(((Pt1 -~ Pt2)^~2)[])))
end proc:


#Procedure to select from a list of points (in equation form) that one
#which is closest to a given point (the origin by default).
Closest:= proc(

     Sol::list(list(name=numeric)),

     {To::list(numeric):= [0,0],

      XY::list(name):= ['x', 'y']

})

local

     Min:= infinity, ptMin, pt, d;

     for pt in Sol do

          d:= dist(eval(XY, pt), To);

          if d < Min then Min:= d; ptMin:= pt end if

     end do;   

     ptMin

end proc:  

 

CirEq1:= (x-1)^2+(y-1/.3)^2 = (1/.3)^2:

CirEq2:= (x-.4/(1+.4))^2+y^2 = 1/(1+.4)^2:

Sol:= solve({CirEq||(1..2)}, [x,y]);

[[x = -.365853658536586, y = .292682926829267], [x = 1.00000000000000, y = -0.166666666666667e-14]]

#DON'T SELECT THE SECOND POINT! Select the point closest to the origin.
Pt:= eval([x,y], Closest(Sol));

[-.365853658536586, .292682926829267]

DocumentTools:-Do(sc= dist(Pt, [0,0])):

cir1:= plottools:-circle([0,0], sc):

Point2:= plottools:-disk(Pt, 0.2e-1, color= red):

plots:-display([cir1, Point2], gridlines= false);

 

``

 

Download circles.mw

@Kitonum 

I was aware that you could pass the appropriate field extension to factor. But I didn't mention it because I know of no way to get Maple to say that that is the right extension to use. Do you know a way?

@descartes0000 

It's a good question. You can do a partial-fraction decomposition with complex linear (i.e., first degree) factors the same way that you do it with real linear factors. For example (x^2 + 1) factors as (x-I)*(x+I). The decompostion of 2/(x^2+1) is

convert(2/((x+I)*(x-I)), parfrac);

However, you never need to use a complex factorization when integrating a real rational function. This is because any real polynomial can be factored into real factors of degree at most two, even if all the roots of the polynomial are complex. However the coefficients may be irrational. One gets these factors in Maple by including the real argument to factor. For example,

factor(x^4+1, real);

Since the integral of any real rational function with denominator degree 2 is known, this is enough integrate any real rational function.

 

@k20057 5 

Ah. If you want to see both then do this:

n:= 5:
S:= 'R()' $ n;
map(lhs=rhs/n, Statistics:-Tally(op~([S])));

An aside: This has nothing to do with your error message. Your model is linear, and you'll likely get better results using LinearFit. The v^2 does not make it nonlinear. The significant thing is that your model is a linear function of the parameters a, b, and c; the type of function that it is with respect to v is irrelevant.

What makes you think that there are more roots than the seven reported by RootFinding:-Analytic? The 3d plots that I have made lead me to believe that those are the only seven roots.

@as5987 

If you say Sol[2,1] and Sol[2,2] then you are explicitly selecting the second point! If you want the first point, then use Sol[1,1] and Sol[1,2]. But why don't you use my selection procedure?

First 533 534 535 536 537 538 539 Last Page 535 of 709