Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Good day people, here just asking for your help please.

I am trying to do a taylor serie of a function but I recieved this error:

Error, (in Typesetting:-NeedsBrace) invalid input: the 1st argument to pointto is not a valid pointer handle

The aim of this is get the series to do its integration.

Thank you a lot for your responses.

maple_primes_question.mw

I need to produce some diagrams for the help pages of my package. I trying to typeset the dot product "." on a plot but keep getting a % symbol. I have tried without typesetting but makes no differance.

restart

 

 

Sdim:=proc(A,B,C,clr::string,S:=NULL)
    description"plots spread symbol";
    uses plots,plottools;
    local aa,bb,c,d,e,f,g,h,k,p1,v1,v2,vab,vac;
    vab:=Vector(B-A);
    vac:=Vector(C-A);
    aa:=(B-A)/5;
    bb:=(C-A)/5;
    p1:=plottools:-point([A,B,C],symbol=solidcircle);
    c:= plottools:-line(A+aa,A+bb);
    d:=plottools:-line(A,B);
    e:=plottools:-line(A,C);
    f:=plots:-textplot([op(1.1*(A+(aa+bb)/2)+[1.5,0]), typeset(S)]);   #print S
    g:=plots:-textplot([op(.9*A), typeset([x[1],y[1]])]);  #[x1,y1]
    h:=plots:-textplot([op(1.1*B), typeset([x[2],y[2]])]);  #x2,y2]
    k:=plots:-textplot([op(1.05*C), typeset([x[3],y[3]])]);  #x3,y3]
    v1:=plots:-textplot([op(A+(B-A)/2+[.2,-.2]), typeset(`#mover(mi("v"),mo("⇀"))`[a])]);   # vector symbol
    v2:=plots:-textplot([op(A+(C-A)/2+[-.2,.2]), typeset(`#mover(mi("v"),mo("⇀"))`[b])]);   #vector symbol
    display(p1,c,d,e,f,g,h,k,v1,v2,axes=none,scaling=constrained,caption="Spread between two vectors");    #place title under diagram
end proc

 

proc (A, B, C, clr::string, S := NULL) local aa, bb, c, d, e, f, g, h, k, p1, v1, v2, vab, vac; description "plots spread symbol"; vab := Vector(B-A); vac := Vector(C-A); aa := (1/5)*B-(1/5)*A; bb := (1/5)*C-(1/5)*A; p1 := plottools:-point([A, B, C], symbol = solidcircle); c := plottools:-line(A+aa, A+bb); d := plottools:-line(A, B); e := plottools:-line(A, C); f := plots:-textplot([op(1.1*(A+(1/2)*aa+(1/2)*bb)+[1.5, 0]), typeset(S)]); g := plots:-textplot([op(.9*A), typeset([x[1], y[1]])]); h := plots:-textplot([op(1.1*B), typeset([x[2], y[2]])]); k := plots:-textplot([op(1.05*C), typeset([x[3], y[3]])]); v1 := plots:-textplot([op((1/2)*A+(1/2)*B+[.2, -.2]), typeset(`#mover(mi("v"),mo("⇀"))`[a])]); v2 := plots:-textplot([op((1/2)*A+(1/2)*C+[-.2, .2]), typeset(`#mover(mi("v"),mo("⇀"))`[b])]); plots:-display(p1, c, d, e, f, g, h, k, v1, v2, axes = none, scaling = constrained, caption = "Spread between two vectors") end proc

(1)

Spr:=S=1-(`#mover(mi("v"),mo("⇀"))`[b-a]%.`#mover(mi("v"),mo("⇀"))`[b-a])^2/(`#mover(mi("v"),mo("⇀"))`[a]%.`#mover(mi("v"),mo("⇀"))`[a])/(`#mover(mi("v"),mo("⇀"))`[b]%.`#mover(mi("v"),mo("⇀"))`[b]);

S = 1-`%.`(`#mover(mi("v"),mo("⇀"))`[b-a], `#mover(mi("v"),mo("⇀"))`[b-a])^2/(`%.`(`#mover(mi("v"),mo("⇀"))`[a], `#mover(mi("v"),mo("⇀"))`[a])*`%.`(`#mover(mi("v"),mo("⇀"))`[b], `#mover(mi("v"),mo("⇀"))`[b]))

(2)

Sdim([1,2],[5,1],[4,7],"blue",Spr);

 

 

 

Download Q_2024-02-15_Help_Spread_diagram.mw

I've got a problem where I need to find the shortest route between a list of points. Each point must only be visited once.

To solve the problem I admit that I have used ChatGPT. While the answer was very helpful, the thing is that it apparently doesn't work (yet). The problem is that the function in the package is not existing.

Here's the ChatGPT code.

Any help appreciated.

euclidean_distance := proc (p1, p2) options operator, arrow; sqrt((p1[1]-p2[1])^2+(p1[2]-p2[2])^2) end proc; points := [[0, 0], [1, 2], [3, 1], [5, 4]]; distance_matrix := Matrix([`$`([`$`(euclidean_distance(points[i], points[j]), i = 1 .. 4)], j = 1 .. 4)]); solution := Optimization:-LinearSumAssignment(distance_matrix); optimal_route := [`$`(points[i], `in`(i, solution[1]))]; total_distance := add(`$`(distance_matrix[i, solution[1][i]], `in`(i, solution[1]))); print("Optimal route:", optimal_route); print("Total distance:", total_distance)

"Total distance:", total_distance

(1)

NULL

Download TravellingSalesManChatGPT.mw

I'm running Maple 2020 on a Mac with OS 14.3.1.  Maple is not seeing current files in folders, and when it saves files, it does so with an older date.  In Settings, Maple has permission to access the Desktop, Documents, and Downloads folders, the only options that my Mac provides.

It's a bit frustrating.  Any help would be appreciated.

Are the results consistent either we use simplify(expression) or simplify(expression,size)? It seems (2) and (3) are not consistent.

restart

with(PDEtools); with(LinearAlgebra)

b := -(2*I)*exp(2*t*Im(lambda1))*(exp(I*a*x/conjugate(lambda1))*exp((2*I)*a*x/lambda1)*exp((-I*a*x)*(1/conjugate(lambda1)))*exp(I*conjugate(lambda1)*t)+exp(I*lambda1*t)*exp(I*a*x/lambda1)*exp((-I*a*x)*(1/lambda1))*exp((2*I)*a*x/conjugate(lambda1))*(abs(`ε1`)^2+abs(`ε2`)^2))*conjugate(`ε1`)*Im(lambda1)/(exp((2*I)*a*x/lambda1)*abs(`ε1`)^2*exp(-(2*I)*a*x/conjugate(lambda1))*exp(2*t*Im(lambda1))+exp(-(2*I)*a*x/lambda1)*abs(`ε1`)^2*exp((2*I)*a*x/conjugate(lambda1))*exp(2*t*Im(lambda1))+exp(I*a*x/lambda1)*exp((-I*a*x)*(1/lambda1))*exp(I*a*x/conjugate(lambda1))*exp((-I*a*x)*(1/conjugate(lambda1)))*(abs(`ε2`)^4+2*abs(`ε1`)^2*abs(`ε2`)^2+abs(`ε1`)^4+2*abs(`ε2`)^2*exp(2*t*Im(lambda1))+exp(4*t*Im(lambda1))))

-(2*I)*exp(2*t*Im(lambda1))*(exp(I*a*x/conjugate(lambda1))*exp((2*I)*a*x/lambda1)*exp(-I*a*x/conjugate(lambda1))*exp(I*conjugate(lambda1)*t)+exp(I*lambda1*t)*exp(I*a*x/lambda1)*exp(-I*a*x/lambda1)*exp((2*I)*a*x/conjugate(lambda1))*(abs(epsilon1)^2+abs(epsilon2)^2))*conjugate(epsilon1)*Im(lambda1)/(exp((2*I)*a*x/lambda1)*abs(epsilon1)^2*exp(-(2*I)*a*x/conjugate(lambda1))*exp(2*t*Im(lambda1))+exp(-(2*I)*a*x/lambda1)*abs(epsilon1)^2*exp((2*I)*a*x/conjugate(lambda1))*exp(2*t*Im(lambda1))+exp(I*a*x/lambda1)*exp(-I*a*x/lambda1)*exp(I*a*x/conjugate(lambda1))*exp(-I*a*x/conjugate(lambda1))*(abs(epsilon2)^4+2*abs(epsilon1)^2*abs(epsilon2)^2+abs(epsilon1)^4+2*abs(epsilon2)^2*exp(2*t*Im(lambda1))+exp(4*t*Im(lambda1))))

(1)

bdif := simplify(diff(b, x)); bdifxzero := simplify(subs({x = 0}, bdif))

4*Im(lambda1)*exp(2*t*Im(lambda1))*a*conjugate(epsilon1)*(conjugate(lambda1)*abs(epsilon1)^2*(abs(epsilon1)^2+abs(epsilon2)^2)*exp((t*(I*lambda1+2*Im(lambda1))*abs(lambda1)^2+(4*I)*a*(lambda1-(1/2)*conjugate(lambda1))*x)/abs(lambda1)^2)+exp(((I*conjugate(lambda1)+2*Im(lambda1))*t*abs(lambda1)^2-(2*I)*(lambda1-2*conjugate(lambda1))*a*x)/abs(lambda1)^2)*abs(epsilon1)^2*lambda1+2*abs(epsilon1)^2*(conjugate(lambda1)-(1/2)*lambda1)*exp((I*conjugate(lambda1)^2*t+(2*I)*a*x+2*t*Im(lambda1)*conjugate(lambda1))/conjugate(lambda1))+2*abs(epsilon2)^2*lambda1*(abs(epsilon1)^2+abs(epsilon2)^2)*exp((I*t*abs(lambda1)^2+(2*I)*a*x+2*t*Im(lambda1)*conjugate(lambda1))/conjugate(lambda1))+lambda1*(abs(epsilon1)^2+abs(epsilon2)^2)*exp((I*t*abs(lambda1)^2+(2*I)*a*x+4*t*Im(lambda1)*conjugate(lambda1))/conjugate(lambda1))+2*conjugate(lambda1)*exp((I*t*abs(lambda1)^2+(2*I)*a*x+2*t*Im(lambda1)*lambda1)/lambda1)*abs(epsilon2)^2+conjugate(lambda1)*exp((I*t*abs(lambda1)^2+(2*I)*a*x+4*t*Im(lambda1)*lambda1)/lambda1)+(-abs(epsilon1)^2*(conjugate(lambda1)-2*lambda1)*exp((I*lambda1^2*t+(2*I)*a*x+2*t*Im(lambda1)*lambda1)/lambda1)+(abs(epsilon1)^2+abs(epsilon2)^2)*(lambda1*(abs(epsilon1)^2+abs(epsilon2)^2)*exp(I*(t*abs(lambda1)^2+2*a*x)/conjugate(lambda1))+conjugate(lambda1)*exp(I*(t*abs(lambda1)^2+2*a*x)/lambda1)))*(abs(epsilon1)^2+abs(epsilon2)^2))/((abs(epsilon1)^4+2*abs(epsilon1)^2*abs(epsilon2)^2+abs(epsilon2)^4+2*abs(epsilon2)^2*exp(2*t*Im(lambda1))+exp((2*t*Im(lambda1)*abs(lambda1)^2-(2*I)*(lambda1-conjugate(lambda1))*a*x)/abs(lambda1)^2)*abs(epsilon1)^2+exp((2*t*Im(lambda1)*abs(lambda1)^2+(2*I)*(lambda1-conjugate(lambda1))*a*x)/abs(lambda1)^2)*abs(epsilon1)^2+exp(4*t*Im(lambda1)))^2*abs(lambda1)^2)

 

12*Im(lambda1)*exp(2*t*Im(lambda1))*((2/3)*abs(epsilon2)^2*lambda1*(abs(epsilon1)^2+abs(epsilon2)^2)*exp(t*(I*abs(lambda1)^2+2*Im(lambda1)*conjugate(lambda1))/conjugate(lambda1))+(1/3)*lambda1*(abs(epsilon1)^2+abs(epsilon2)^2)*exp(t*(I*abs(lambda1)^2+4*Im(lambda1)*conjugate(lambda1))/conjugate(lambda1))+(2/3)*conjugate(lambda1)*exp(t*(I*abs(lambda1)^2+2*lambda1*Im(lambda1))/lambda1)*abs(epsilon2)^2+(1/3)*conjugate(lambda1)*exp(t*(I*abs(lambda1)^2+4*lambda1*Im(lambda1))/lambda1)+(1/3)*lambda1*(abs(epsilon1)^2+abs(epsilon2)^2)^3*exp(I*abs(lambda1)^2*t/conjugate(lambda1))+(1/3)*conjugate(lambda1)*(abs(epsilon1)^2+abs(epsilon2)^2)^2*exp(I*abs(lambda1)^2*t/lambda1)+((-I*Im(lambda1)+(1/3)*lambda1+(1/3)*Re(lambda1))*exp((I*conjugate(lambda1)+2*Im(lambda1))*t)+(I*Im(lambda1)+(1/3)*conjugate(lambda1)+(1/3)*Re(lambda1))*(abs(epsilon1)^2+abs(epsilon2)^2)*exp(t*(I*lambda1+2*Im(lambda1))))*abs(epsilon1)^2)*a*conjugate(epsilon1)/(abs(lambda1)^2*((2*abs(epsilon2)^2+2*abs(epsilon1)^2)*exp(2*t*Im(lambda1))+abs(epsilon2)^4+2*abs(epsilon1)^2*abs(epsilon2)^2+abs(epsilon1)^4+exp(4*t*Im(lambda1)))^2)

(2)

bdif1 := simplify(diff(b, x), size); bdif1xzero := simplify(subs({x = 0}, bdif1), size)

4*Im(lambda1)*(2*exp(I*a*x/lambda1)*exp(I*conjugate(lambda1)*t)*(exp(I*a*x/conjugate(lambda1)))^2*exp(-I*a*x/lambda1)*((1/2)*abs(epsilon1)^4+abs(epsilon1)^2*abs(epsilon2)^2+(1/2)*abs(epsilon2)^4+abs(epsilon2)^2*exp(2*t*Im(lambda1))+(1/2)*exp(4*t*Im(lambda1)))*exp((2*I)*a*x/lambda1)*conjugate(lambda1)*(exp(-I*a*x/conjugate(lambda1)))^2+2*exp(I*a*x/conjugate(lambda1))*(((exp(I*a*x/lambda1))^2*lambda1*exp(I*lambda1*t)*((1/2)*abs(epsilon1)^4+abs(epsilon1)^2*abs(epsilon2)^2+(1/2)*abs(epsilon2)^4+abs(epsilon2)^2*exp(2*t*Im(lambda1))+(1/2)*exp(4*t*Im(lambda1)))*(abs(epsilon1)^2+abs(epsilon2)^2)*(exp(-I*a*x/lambda1))^2+exp(-(2*I)*a*x/lambda1)*exp((2*I)*a*x/lambda1)*exp(2*t*Im(lambda1))*exp(I*conjugate(lambda1)*t)*abs(epsilon1)^2*(conjugate(lambda1)-(1/2)*lambda1))*exp((2*I)*a*x/conjugate(lambda1))+(1/2)*(exp((2*I)*a*x/lambda1))^2*exp(2*t*Im(lambda1))*exp(I*conjugate(lambda1)*t)*exp(-(2*I)*a*x/conjugate(lambda1))*lambda1*abs(epsilon1)^2)*exp(-I*a*x/conjugate(lambda1))+exp(I*a*x/lambda1)*abs(epsilon1)^2*exp(I*lambda1*t)*exp(-I*a*x/lambda1)*exp((2*I)*a*x/conjugate(lambda1))*(conjugate(lambda1)*exp(-(2*I)*a*x/lambda1)*exp((2*I)*a*x/conjugate(lambda1))-exp((2*I)*a*x/lambda1)*exp(-(2*I)*a*x/conjugate(lambda1))*(conjugate(lambda1)-2*lambda1))*exp(2*t*Im(lambda1))*(abs(epsilon1)^2+abs(epsilon2)^2))*conjugate(epsilon1)*a*exp(2*t*Im(lambda1))/((2*exp(I*a*x/lambda1)*exp(I*a*x/conjugate(lambda1))*exp(-I*a*x/lambda1)*((1/2)*abs(epsilon1)^4+abs(epsilon1)^2*abs(epsilon2)^2+(1/2)*abs(epsilon2)^4+abs(epsilon2)^2*exp(2*t*Im(lambda1))+(1/2)*exp(4*t*Im(lambda1)))*exp(-I*a*x/conjugate(lambda1))+exp(2*t*Im(lambda1))*abs(epsilon1)^2*(exp(-(2*I)*a*x/lambda1)*exp((2*I)*a*x/conjugate(lambda1))+exp((2*I)*a*x/lambda1)*exp(-(2*I)*a*x/conjugate(lambda1))))^2*lambda1*conjugate(lambda1))

 

2*Im(lambda1)*exp(0)*conjugate(epsilon1)*exp(2*t*Im(lambda1))*a*(conjugate(lambda1)*exp(I*conjugate(lambda1)*t)+exp(I*lambda1*t)*lambda1*(abs(epsilon1)^2+abs(epsilon2)^2))/((((exp(0))^2*abs(epsilon2)^2+abs(epsilon1)^2)*exp(2*t*Im(lambda1))+(1/2)*(exp(0))^2*(exp(4*t*Im(lambda1))+(abs(epsilon1)^2+abs(epsilon2)^2)^2))*lambda1*conjugate(lambda1))

(3)

NULL

Download simplisize.mw

I want to use the resuls that I obtained  in MATLAB in my maple Program

something like this 

variables in scope: top scope

  Attr   Name        Size                     Bytes  Class
  ====   ====        ====                     =====  =====
         Rnx         1x3801                   30408  double

   1.6495e-02
   5.1389e-01
   1.0114e+00
   1.5091e+00
   2.0070e+00
   2.5049e+00
   3.0031e+00
   3.5013e+00
   3.9997e+00
   4.4982e+00
   4.9969e+00
   5.4956e+00
   5.9945e+00
   6.4935e+00
   6.9926e+00
   7.4919e+00
   7.9912e+00
   8.4906e+00
   8.9901e+00
   9.4898e+00
   9.9895e+00
   1.0489e+01
   1.0989e+01
   1.1489e+01
   1.1989e+01
   1.2489e+01
   1.2989e+01
   1.3490e+01
   1.3990e+01
   1.4490e+01

is there a way to set conjugate=true  to false as a default for BilinearForm?  This would be used inside a package.

restart;
with(LinearAlgebra);

v := <x, y>;
BilinearForm(v, v);
BilinearForm(v, v, conjugate = false);

 

I am trying to define a function f(x1+tau,x2)= (x1+tau)*a+x2*b. I need this to be able to take derivations w.r.t. the sum (x1+tau) and to only tau as well. Is there a way to do this?

I am presently working on bivariate functions defined this way

C := (u, v) -> (phi@@(-1))(phi(u)+phi(v));

phi is a function of specific expression named the "generator". Both u and v are assumed to be in the closed interval [0,1].

Here is an example:

restart
phi := u -> (u^(-theta)-1)/theta:
C := (u, v) -> (phi@@(-1))(phi(u)+phi(v)):
C(u, v)
                       / (-theta)        (-theta)    \
                      | u         - 1   v         - 1|
           @@(phi, -1)| ------------- + -------------|
                       \    theta           theta    /

This definition of C is correct providing that  theta in [-1, +infinity) \ {0}.
As you can see, the display of C(u, v) contains the inverse function phi@@(-1) which Maple doesn't seem to know what to do with.

What I would like is to get rid of  phi@@(-1) and get 

C(u, v);
        (-1+u^(-theta)+v^(-theta))^(-1/theta)

The only way I found to get this is to do that:

restart
phi := u -> (u^(-theta)-1)/theta:
(phi@@(-1)) := u -> solve(phi(x)=u, x): # explicit definition of (phi@@(-1))
C := (u, v) -> simplify((phi@@(-1))(phi(u)+phi(v))) assuming theta >= -1, theta <> 0:
C(u, v);
                                         /    1  \
                                         |- -----|
                                         \  theta/
             /      (-theta)    (-theta)\         
             \-1 + u         + v        /         

As you see I have been forced to tell Maple what the inverse function of phi was.
Is there another way do get this result without writting the bold red line?

Maple knows several inverse functions (trigonometric functions for instance), but how does it know that?
As Maple does not seem to use a (f@@(-1)) := u -> solve(f(x)=u, x) like definition, does it uses a correspondence table between functions and their inverse?
If it is so can we augment it?

Thanks in advance.

PS: the ultimate goal is to do something like this Download CAC.mw  for different generators.

For the moment I have defined my own table generator <--> inverse function  as I did above with the bold red line: this works but it is not very elegant.

Hi,
I have a problem and I haven't been able to solve it yet. I want to solve an ordinary diffrential equation similar to
                                                                                                   (dphi/dxi)^2+2*V(phi)=0
and plot phi versus xi for a the following conditions:
1) V(phi)=dphi/dxi=0 at (phi=0,phi_m) and
2) dV(phi)/dphi=0 at phi=phi_m and 
3) d^2V(phi)/dphi^2=0 at both phi=0 and phi=phi_m.
How can I do this by Maple?(see the attached file)
w1.mw

I tried

interface(warnlevel=0); infolevel[all]:=0;prinlevel:=0;kernelopts('printlevel'=0);

to suppress the warnings I get from this code

restart;
f:=z^3;
z_map:=proc(f,re,im) 
  if((re>0) and (im>0) and (im<1-re))then
    eval(f,z=re+I*im);
  else
    NULL;
  end if;
end proc;
p_re:=plots:-display(seq(plot([Re('z_map(f,re,im)'),Im('z_map(f,re,im)'),im=0..1]),re=0..10,0.1)):
p_im:=plots:-display(seq(plot([Re('z_map(f,re,im)'),Im('z_map(f,re,im)'),re=0..1]),im=0..10,0.1),color=green):
plots:-display(p_re,p_im,scaling=constrained)

The reason for the warnings is clear. The input lines are too long to be plotted. However, the resulting plot is exactly what I intended. Programatically truncating the lines would make the warning disappear, but it would make the code much more complicated.

What else can be done to suppress this kind of warning.

For Mathematica  math software app,there is a plugin to use in chatGPT pro ( paid subscription ) and maybe this can be done for Maple too ? 

Haven't used the plugin for Mathematica yet, am curious about it.
Let me have the AI look at the Riemann Hypothesis :)  
Have a few books on it, but can't get through that math with all those special functions.


Why does the execution of procedure J2 in the attached file fire an error?
it looked to me as if I had built it the same way as J1.
 

restart:

# Basically I want do do something like that,

J1 := proc()
  local z:
  z := proc(u) fsolve(sqrt(x)=u, x) end proc:
  evalf(Int(''z''(u), u=0..1))
end proc:

J1();
  

.3333333333

(1)

# but when z is more complex finction of two arguments.
#
# Unfortunately a direct transposition of what worked above no longer works.

J2 := proc()
  local z:
   z := proc(q1, q2)
     exp(
       2*(
         fsolve(1/2+(1/2)*erf((1/2)*x*sqrt(2)) = q1, x)
         *
         fsolve(1/2+(1/2)*erf((1/2)*x*sqrt(2)) = q2, x)
       )
       -
       fsolve(1/2+(1/2)*erf((1/2)*x*sqrt(2)) = sqrt(q1), x)^2
       -
       fsolve(1/2+(1/2)*erf((1/2)*x*sqrt(2)) = sqrt(q2), x)^2
    )
  end proc:
  evalf(Int(''z''(q1, q2), q1=0..1, q2=0..1))
end proc:

J2();

Error, (in evalf/int) q1 is in the equation, and is not solved for

 

 

 

Download integration_issue.mw

Can you help me fix this issue?

Thanks in advance

Hi,

How can I get y=x in output (4) when  g is equal to f?

restart

f := x -> F(x)

proc (x) options operator, arrow; F(x) end proc

(1)

((f@@(-1))@f)(x);

x

(2)

# Let us assume that y is defined this way

y := ((f@@(-1))@g)(x);

(f@@(-1))(g(x))

(3)

# When g is identical to f I would like to get y=x

'y' = eval(y, g=f);
'y' = eval(y, g = (x -> f(x)))

y = (f@@(-1))(F(x))

 

y = (f@@(-1))(F(x))

(4)

 

Download inverse_f.mw

Thanks in advance

This is something I use a fair bit. I have procedures with alternative spelling options for the colours Red Green and Blue.
Have shown a single example copied from  an overloaded procedure. It there a nicer way of handling this than what I am doing?
There is a section in help under "Procedure Parameter Declarations" on "Indexed Keyword Parameters"  but I don't see how to use it here. These procedures are used inside a package.

restart

 

GeomClr:="Blue";  # can be "Blue", "blue", "B", "b"  or;
                  #        "Green", "green", "G", "g"  or;
                  #        "Red2, "red", "R", "r";

Prntmsg:="y" ; #  or anything that is not"y"

 

"Blue"

 

"y"

(1)

spread:=proc(p0::{satisfies(s -> type(s, [algebraic $ 2])),'Vector[row]'(2, algebraic)},
              p1::{satisfies(s -> type(s, [algebraic $ 2])),'Vector[row]'(2, algebraic)},
              clr::`string`:= GeomClr,
              prnt::`string`:=Prntmsg)
           option overload;
           uses LinearAlgebra;
           #print(clr,p0,p1);
           if clr="b" or clr="B" or clr="blue" or clr="Blue" then
              if prnt="y" then
                print("Spread 2 [x,y] Points/Vectors wrt origin Blue");
              end if;
               return 1 - BilinearForm(p0, p1, conjugate = false)^2/(BilinearForm(p0, p0, conjugate = false)*BilinearForm(p1, p1, conjugate = false));
           elif clr="g" or clr="G" or clr="green" or clr="Green" then
              if prnt="y" then
               print( "Spread 2 [x,y] Points/Vectors wrt origin Green");
              end if;
               return -1/4*(p0[1]*p1[2] - p0[2]*p1[1])^2/(p0[1]*p0[2]*p1[1]*p1[2]);
           elif clr="r" or clr="R" or clr="red" or clr="Red" then
              if prnt="y" then
               print( "Spread 2 [x,y] Points/Vectors wrt origin Red");
               end if;
               return -(p0[1]*p1[2] - p0[2]*p1[1])^2/((p0[1]^2 - p0[2]^2)*(p1[1]^2 - p1[2]^2));
          end if;
          end proc:

sb:=spread(<3|2>,<4|-5>);

"Spread 2 [x,y] Points/Vectors wrt origin Blue"

 

529/533

(2)

sg:=spread(<3|2>,<4|-5>,"g");

"Spread 2 [x,y] Points/Vectors wrt origin Green"

 

529/480

(3)

sr:=spread(<3|2>,<4|-5>,"r");

"Spread 2 [x,y] Points/Vectors wrt origin Red"

 

529/45

(4)

1/sb+1/sr+1/sg

2

(5)

sr:=spread(<3|2>,<4|-5>,"r","n");

529/45

(6)

 


 

Download Q_2024-02-09_Alternative_Spelling_in_Proc.mw

First 11 12 13 14 15 16 17 Last Page 13 of 2097