Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

How do I format the output from a Fit?

X := [seq(0.1e-1*i, i = 0 .. 12)]; Y := [0, .36, .56, .67, .73, .76, .78, .79, .79, .80, .80, .80, .80]; with(Statistics); f := Fit(a-b*exp(c*x+d), X, Y, x, initialvalues = [a = .8, b = 1, c = -50, d = -.3]); plot({f(x), [seq([X[i], Y[i]], i = 1 .. 13)]}, x = 0 .. .15, color = blue, gridlines = true, style = [line, point], size = [600, 400]);
[0., 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.10,
  0.11, 0.12]
[0, 0.36, 0.56, 0.67, 0.73, 0.76, 0.78, 0.79, 0.79, 0.80, 0.80,
  0.80, 0.80]
  HFloat(0.8011387332253399) - HFloat(1.0911958098409642) exp(
  -HFloat(60.057427500589974) x - HFloat(0.30834993559916535))

 

There are way too many decimals in the output 

The questions are in the initial documentation of Maple code below.  Again any help gratefully received.

 

 

restart:

# # # # # # # # # # # # # # # # # # # # # # # # # # # #

# Question 1: on use of op.  In the program there are two similar lists
# LC_L and LC_L2, one using square brackets; the second round.   Can I use the op operator using round brackets?
#
# Question 2: The proc maximum is not producing any output.  What is nargs referring to?

# Why?  This proc I found in the Maple 7 documentation so why
# does it not give output?
#
# Functional operators.  Use of ->

# to find coords of rotated points.  No questions here – I
# intend using this on the letter A program in a recent post of # mine
#

# # # # # # # # # # # # # # # # # # # # # # # # # # # # #

with(plots):

with(plottools):

h:=6*sqrt(3):b:=6:w:=3:

#List of coord for letter L.  Two ways of writing:

# with square or round bracket

LC_L:=[[0,0],[0,h],[w,h],[w,w],[b,w],[b,0]]:

LC_L2:=[(0,0),(0,h),(w,h),(w,w),(b,w),(b,0)]:

endfor:=nops(LC_L):

for i from 1 to endfor do

printf("LC_L   Coord %d is (%5.3f , %5.3f) \n",i, LC_L[i][1], LC_L[i][2]);

printf("LC_L2  Coord %d is (%5.3f , %5.3f)\n\n",i,op(LC_L2[i][1]), op(LC_L2[i][2]));

#op(1,op(2,w))

end do;

 

l:=[6,9,4,1]:  #this list was added in by me

maximum := proc (l)  # ()  the l was added by me

 local r, i;

          r := args[1];

          for i from 2 to nargs do

              if args[i] > r then r := args[i] end if

          end do;

          #printf("  %d\n",r);

          r

end proc:

#eval();

maximum(l);
 

Hello,

can someone help me with the following problem?

Ich want to delete rows and columns at the same time in a matrix. So this I wrote a little proc:

B:=proc(a,b)
DeleteColumn(A,a)
DeleteRow(A,b)
end proc;

The problem is, that only the last order is working. -> 

DeleteRow

Thanks
Martin


 

``Can anyone explain why 'subs' will sbstitute 'a' and 'c' but not 'b' (equations 2.3 and 2.4) in the attached document. 

 

``I have tried everything I can think of but nothing works.

 

If I cut and paste 2.3 and 2.4 to a clean document it works.  I tried coying the whole document t a clean sheet but that does not fix the problem. 

NULLNULL

NULL

Va := sqrt(2)*Vrms*sin(theta)Vmax =  RmsMS phase to neutral voltage

Vb := sqrt(2)*Vrms*sin(theta-2*Pi*(1/3))

Vc := sqrt(2)*Vrms*sin(theta+2*Pi*(1/3))

Vab := Va-Vb

Vbc := Vb-Vc

Vca := Vc-Va

NULL

com1 := rhs(simplify(solve({Vc = Va, 0 < theta and theta < Pi}, theta, allsolutions))[1]) = (1/6)*PiNULL

com2 := rhs(simplify(solve({Vb = Vc, 0 < theta and theta < Pi}, theta, allsolutions))[1]) = (1/2)*PiNULL

com3 := rhs(simplify(solve({Va = Vb, 0 < theta and theta < Pi}, theta, allsolutions))[1]) = (5/6)*PiNULL

com4 := rhs(simplify(solve({Va = Vc, Pi < theta and theta < 2*Pi}, theta, allsolutions))[1]) = (7/6)*Pi 

com5 := rhs(simplify(solve({Vb = Vc, Pi < theta and theta < 2*Pi}, theta, allsolutions))[1]) = (3/2)*Pi 

com6 := rhs(simplify(solve({Va = Vb, Pi < theta and theta < 2*Pi}, theta, allsolutions))[1]) = (11/6)*PiNULL

NULL  NULL 

NULL

NULL

NULL``

NULL

NULL

NULL

 

plot(subs(Vrms = 100, [Va, Vb, Vc, Vab, Vbc, Vca]), theta = 0 .. 3*Pi)

 

 

 

 

The  #1 diode is forward biased and switches on when Va>Vc (Va=Vc). The voltage VD will be equal to Va-Vb until diode #2 turns on when Vc< Vb. Then VD will equal Vc-Vc.

The switching angle for the diodes is given above. If phase control is used all commutation is delayed by the angle α.

NULL``

Without phase delay the average (DC) voltage applied to the laod is the average value of the 6 commutation periods over one cycle:

 

NULL

NULL

Van := sqrt(2)*Erms*sin(theta)Emax =  RmsMS phase to neutral voltage

Vbn := sqrt(2)*Erms*sin(theta-2*Pi*(1/3))

Vcn := sqrt(2)*Erms*sin(theta+2*Pi*(1/3))

NULL

   
Eq1 := Vdo = 6*(int(Van-Vbn, theta = com1 .. com2))/(2*Pi)

Vdo = 3*3^(1/2)*2^(1/2)*Erms/Pi

(1)

 

   

NULL

Eq2 := Vdc = 6*(int(Van-Vbn, theta = com1+alpha .. com2+alpha))/(2*Pi)

Vdc = 3*2^(1/2)*Erms*3^(1/2)*cos(alpha)/Pi

(2)

    

 

Commutation

The switching between diodes can not occur instantaneously because the supply circuit is inductive. Current can not change instantaneously in and inductive circuit.
The transfer of load current from the out-going phase to the incomming phase is accomplshed by a period of symultaneous conduction of the two adjacent diodes the creation of a circulating current between these two phases that resembles short circuit between the two phases.

The circulating current produces equal voltage drop with opposid polarities in each phase. In the out-going phase the drop adds to the soruce voltage and in the incomming phase the drop subtracts from the source voltage. Only the drop in the incomming phase effects the DC output voltage.

NULL

 

 

 

During commutation intervil com1 to com2 phases a and c are shorted while Id is transfered from phase c to phase a. During this time voltage Va-Vb minus the voltage drop in a phase caused by the commutation. This voltage drop is 1/2 the Vac voltage.   

`&Delta;e` := 1/2*(Van-Vcn)

(1/2)*2^(1/2)*Erms*sin(theta)-(1/2)*2^(1/2)*Erms*cos(theta+(1/6)*Pi)

(3)

and      Va=Vc at π/6

`&Delta;E__Avg` = 6*(int(`&Delta;e`, theta = (1/6)*Pi+alpha .. (1/6)*Pi+alpha+mu))/(2*Pi)

`&Delta;E__Avg` = 3*((1/2)*2^(1/2)*Erms*cos((1/6)*Pi+alpha)+(1/2)*2^(1/2)*Erms*sin((1/3)*Pi+alpha)-(1/2)*2^(1/2)*Erms*sin((1/3)*Pi+alpha+mu)-(1/2)*2^(1/2)*Erms*cos((1/6)*Pi+alpha+mu))/Pi

(4)

"(=)"

`&Delta;E__Avg` = (3/2)*Erms*2^(1/2)*(cos((1/6)*Pi+alpha)+sin((1/3)*Pi+alpha)-sin((1/3)*Pi+alpha+mu)-cos((1/6)*Pi+alpha+mu))/Pi

(5)

"(=)"

`&Delta;E__Avg` = (3/2)*2^(1/2)*Erms*3^(1/2)*cos(alpha)/Pi-(3/2)*Erms*2^(1/2)*3^(1/2)*cos(alpha)*cos(mu)/Pi+(3/2)*Erms*2^(1/2)*3^(1/2)*sin(alpha)*sin(mu)/Pi

(6)

"(=)"

`&Delta;E__Avg` = (3/2)*Erms*2^(1/2)*3^(1/2)*((-cos(mu)+1)*cos(alpha)+sin(alpha)*sin(mu))/Pi

(7)

combine(`&Delta;E__Avg` = (3/2)*Erms*2^(1/2)*3^(1/2)*((-cos(mu)+1)*cos(alpha)+sin(alpha)*sin(mu))/Pi, trig)

`&Delta;E__Avg` = (1/2)*(-3*3^(1/2)*2^(1/2)*Erms*cos(alpha+mu)+3*2^(1/2)*Erms*3^(1/2)*cos(alpha))/Pi

(8)

"(=)"

`&Delta;E__Avg` = -(3/2)*3^(1/2)*2^(1/2)*Erms*(cos(alpha+mu)-cos(alpha))/Pi

(9)

NULL

DC output voltage

NULL

V__D = Vdc-`&Delta;E__Avg`

V__D = Vdc-`&Delta;E__Avg`

(10)

subs([Vdc = 3*2^(1/2)*Erms*3^(1/2)*cos(alpha)/Pi, `&Delta;E__Avg` = -(3/2)*3^(1/2)*2^(1/2)*Erms*(cos(alpha+mu)-cos(alpha))/Pi], V__D = Vdc-`&Delta;E__Avg`)

 

V__D = 3*2^(1/2)*Erms*3^(1/2)*cos(alpha)/Pi+(3/2)*3^(1/2)*2^(1/2)*Erms*(cos(alpha+mu)-cos(alpha))/Pi

(11)

"(->)"

 

V__D = (3/2)*3^(1/2)*2^(1/2)*Erms*(cos(alpha)+cos(alpha+mu))/Pi

(12)

 

NULL

Equating the intigral of the voltage drop between the phase A and C  to the intigral of the voltage rise across the two phase inductances (thes intigrals represent eqivalent flux).

 

int(Van-Vcn, theta = (1/6)*Pi+alpha .. (1/6)*Pi+alpha+mu) = int(2*L*omega, theta = 0 .. Id)

2^(1/2)*Erms*cos((1/6)*Pi+alpha)+2^(1/2)*Erms*sin((1/3)*Pi+alpha)-2^(1/2)*Erms*cos((1/6)*Pi+alpha+mu)-2^(1/2)*Erms*sin((1/3)*Pi+alpha+mu) = 2*L*omega*Id

(13)

"(=)"

2^(1/2)*Erms*3^(1/2)*cos(alpha)-Erms*2^(1/2)*3^(1/2)*cos(alpha)*cos(mu)+Erms*2^(1/2)*3^(1/2)*sin(alpha)*sin(mu) = 2*L*omega*Id

(14)

"(=)"

-Erms*3^(1/2)*2^(1/2)*((cos(mu)-1)*cos(alpha)-sin(alpha)*sin(mu)) = 2*L*omega*Id

(15)

``

combine(-Erms*3^(1/2)*2^(1/2)*((cos(mu)-1)*cos(alpha)-sin(alpha)*sin(mu)) = 2*L*omega*Id, trig)

-3^(1/2)*2^(1/2)*Erms*cos(alpha+mu)+2^(1/2)*Erms*3^(1/2)*cos(alpha) = 2*L*omega*Id

(16)

"(->)"

cos(alpha+mu) = -(1/6)*(2*L*omega*Id-2^(1/2)*Erms*3^(1/2)*cos(alpha))*3^(1/2)*2^(1/2)/Erms

(17)

"(->)"

cos(alpha+mu) = -(1/3)*3^(1/2)*2^(1/2)*L*omega*Id/Erms+cos(alpha)

(18)

NULL``

``

``

NULL

subs(cos(alpha+mu) = -(1/6)*(2*L*omega*Id-2^(1/2)*Erms*3^(1/2)*cos(alpha))*3^(1/2)*2^(1/2)/Erms, V__D = (3/2)*3^(1/2)*2^(1/2)*Erms*(cos(alpha)+cos(alpha+mu))/Pi)

V__D = (3/2)*3^(1/2)*2^(1/2)*Erms*(cos(alpha)-(1/6)*(2*L*omega*Id-2^(1/2)*Erms*3^(1/2)*cos(alpha))*3^(1/2)*2^(1/2)/Erms)/Pi

(19)

"->"

V__D = 3*2^(1/2)*Erms*3^(1/2)*cos(alpha)/Pi-3*L*omega*Id/Pi

(20)

NULL

NULL

``

 

 

 

 

``

NULL

 

``

``

``

``

``

``

``

``

Line Currents

  

``

NULL

NULL

 

A phase current intervals

   

NULL

NULL

RMS Current Line

 

Using*A*Phase*current

Using*A*Phase*current

(2.1)

NULL

I__RMS = sqrt(A/Pi)

I__RMS = (A/Pi)^(1/2)

(2.2)

``

A = rhs(A1 = -(3/16)*Erms^2*((-8*cos(mu)*sin(mu)-8*mu+16*sin(mu))*cos(alpha)^2-8*sin(alpha)*(cos(mu)-1)^2*cos(alpha)+4*cos(mu)*sin(mu)-4*mu)/(L^2*omega^2))+rhs(A2 = Idc^2*((2/3)*Pi-mu))+rhs(A3 = (1/4)*(6*(cos(mu)*sin(mu)-2*sin(mu)+mu)*cos(alpha)^2+6*sin(alpha)*(cos(mu)-1)^2*cos(alpha)-3*cos(mu)*sin(mu)+3*mu)*Erms^2/(L^2*omega^2)+Idc*((sin(mu)-mu)*cos(alpha)+sin(alpha)*(cos(mu)-1))*3^(1/2)*2^(1/2)*Erms/(L*omega)+Idc^2*mu)

A = -(3/16)*Erms^2*((-8*cos(mu)*sin(mu)-8*mu+16*sin(mu))*cos(alpha)^2-8*sin(alpha)*(cos(mu)-1)^2*cos(alpha)+4*cos(mu)*sin(mu)-4*mu)/(L^2*omega^2)+Idc^2*((2/3)*Pi-mu)+(1/4)*(6*(cos(mu)*sin(mu)-2*sin(mu)+mu)*cos(alpha)^2+6*sin(alpha)*(cos(mu)-1)^2*cos(alpha)-3*cos(mu)*sin(mu)+3*mu)*Erms^2/(L^2*omega^2)+Idc*((sin(mu)-mu)*cos(alpha)+sin(alpha)*(cos(mu)-1))*3^(1/2)*2^(1/2)*Erms/(L*omega)+Idc^2*mu

(2.3)

subs((-8*cos(mu)*sin(mu)-8*mu+16*sin(mu))*cos(alpha)^2-8*sin(alpha)*(cos(mu)-1)^2*cos(alpha)+4*cos(mu)*sin(mu)-4*mu = a, (6*(cos(mu)*sin(mu)-2*sin(mu)+mu))*cos(alpha)^2+6*sin(alpha)*(cos(mu)-1)^2*cos(alpha)-3*cos(mu)*sin(mu)+3*mu = b, (sin(mu)-mu)*cos(alpha)+sin(alpha)*(cos(mu)-1) = c, A = -(3/16)*Erms^2*((-8*cos(mu)*sin(mu)-8*mu+16*sin(mu))*cos(alpha)^2-8*sin(alpha)*(cos(mu)-1)^2*cos(alpha)+4*cos(mu)*sin(mu)-4*mu)/(L^2*omega^2)+Idc^2*((2/3)*Pi-mu)+(1/4)*(6*(cos(mu)*sin(mu)-2*sin(mu)+mu)*cos(alpha)^2+6*sin(alpha)*(cos(mu)-1)^2*cos(alpha)-3*cos(mu)*sin(mu)+3*mu)*Erms^2/(L^2*omega^2)+Idc*((sin(mu)-mu)*cos(alpha)+sin(alpha)*(cos(mu)-1))*3^(1/2)*2^(1/2)*Erms/(L*omega)+Idc^2*mu)

A = -(3/16)*Erms^2*a/(L^2*omega^2)+Idc^2*((2/3)*Pi-mu)+(1/4)*(6*(cos(mu)*sin(mu)-2*sin(mu)+mu)*cos(alpha)^2+6*sin(alpha)*(cos(mu)-1)^2*cos(alpha)-3*cos(mu)*sin(mu)+3*mu)*Erms^2/(L^2*omega^2)+Idc*c*3^(1/2)*2^(1/2)*Erms/(L*omega)+Idc^2*mu

(2.4)

``

``

``

``

``

``

``

``

``

``

``

``


 

Download subs_failed.mw

Maple easily solves multi-points problems for an ODE, if the equation can be integrated analytically.

For example, the following 3-points problem  is solvable:

dsolve([diff(y(x), x$3)+diff(y(x), x$2)+y(x)=1, y(0)=0, y(1)=0, y(2)=1], [y(x)]);

But a similar problem cannot be solved numerically.

For example,

dsolve([diff(y(x), x$3)+diff(y(x), x$2)+y(x)=1, y(0)=0, y(1)=0, y(2)=1], [y(x)], type = numeric, 'output' = Array([seq(k/5, k=0..5)]));

generates: Error, (in dsolve/numeric/process_input) boundary conditions specified at too many points: {0, 1, 2}, can only solve two-point boundary value problems

I need to solve a certain number of multi-points problems for ODE systems numerically. Maybe, for this there are some workaround?

Hi
I have the serious problem with time consuming integrations!
Is there a way to calculate the integrations in less possible time?

restart;

m := 40:

L := 5:

E :=70*(1-(y+0.5)^2)+380*(y+0.5)^2:

beta := Pi^2/L^2:

phi := add(a[n]*y^n, n = 0 .. m):

Eq := diff(phi, y$2)+(diff(E, y))*(diff(phi, y))/E+((diff(E, y$2))/E-((diff(E, y))/E)^2)*phi-2*beta*(1.3)*(phi-1):

st := [seq(coeftayl(Eq, y = 0, j), j = 0 .. m-2)]:

for k to m-1 do

a[m-k+1] := solve(st[m-k], a[m-k+1])

end do:

phi := subs(solve({eval(phi, y = -sqrt(-z^2+1)), eval(phi, y = sqrt(-z^2+1))}, {a[0], a[1]}), phi):

# One of the following integrations must be computed:

# Cartesian

int(int(E*phi, z = -sqrt(-y^2+1) .. sqrt(-y^2+1)), y = -1 .. 1);

# Polar

int(int(subs(z = r*cos(t), y = r*sin(t), E*phi*r), r = 0 .. 1), t = 0 .. 2Pi);

_____________________________________________________________________________

Moreover, I had the same problem before:

https://www.mapleprimes.com/questions/223886-Time-Consuming-Integration



I am using MAPLE for quantum computation.
It appears to me that the Physics[Expand] and Physics[Symplify] functions do not operate as I expected on
Kets with multiple quantum numbers. The functions no not consider the non commutative nature of tensor
products of Kets. (neither of bras incidently). It would be very useful if thos could be adjusted in some way.

Thank you for your help

LL

restart;

with(Physics):

Setup(mathematicalnotation=true,
      noncommutativecolor=black,
      quantumoperators=q,
      noncommutativeprefix={q,psi,beta});

[mathematicalnotation = true, noncommutativecolor = black, noncommutativeprefix = {beta, psi, q}, quantumoperators = {q}]

(1)

Ket(psi):=Ket(q,-1)*Ket(q,1)*Ket(q,-1);
Ket(psi):=Ket(q,-1,1,-1);
'q[1].Ket(psi)'=q[1].Ket(psi);
'q[2].Ket(psi)'=q[2].Ket(psi);
'q[3].Ket(psi)'=q[3].Ket(psi);

Physics:-`*`(Physics:-Ket(q, -1), Physics:-Ket(q, 1), Physics:-Ket(q, -1))

 

Physics:-Ket(q, -1, 1, -1)

 

Physics:-`.`(q[1], Physics:-Ket(psi)) = -Physics:-Ket(q, -1, 1, -1)

 

Physics:-`.`(q[2], Physics:-Ket(psi)) = Physics:-Ket(q, -1, 1, -1)

 

Physics:-`.`(q[3], Physics:-Ket(psi)) = -Physics:-Ket(q, -1, 1, -1)

(2)

Ket(beta,-1,-1):=(1/2)*(sqrt(2)*(Ket(q,-1)*Ket(q,-1)));
Ket(beta,-1,-1):=(1/2)*(sqrt(2)*(Ket(q,-1,-1)));

(1/2)*2^(1/2)*Physics:-`*`(Physics:-Ket(q, -1), Physics:-Ket(q, -1))

 

(1/2)*2^(1/2)*Physics:-Ket(q, -1, -1)

(3)

Ket(Prod):='Ket(psi)'*'Ket(beta,-1,-1)';

Physics:-`*`(Physics:-Ket(psi), Physics:-Ket(beta, -1, -1))

(4)

Ket(Prod):=Ket(psi)*Ket(beta,-1,-1);
'Expand(Ket(Prod))'=Expand(Ket(Prod));
'Expand(Ket(Prod))'<>'(Ket(Prod))';

'Simplify(Ket(Prod))'=Simplify(Ket(Prod));
'Simplify(Ket(Prod))'<>'(Ket(Prod))'

(1/2)*2^(1/2)*Physics:-`*`(Physics:-Ket(q, -1, 1, -1), Physics:-Ket(q, -1, -1))

 

Physics:-Expand(Physics:-Ket(Prod)) = (1/2)*2^(1/2)*Physics:-`*`(Physics:-Ket(q, -1, -1), Physics:-Ket(q, -1, 1, -1))

 

Physics:-Expand(Physics:-Ket(Prod)) <> Physics:-Ket(Prod)

 

Physics:-Simplify(Physics:-Ket(Prod)) = (1/2)*2^(1/2)*Physics:-`*`(Physics:-Ket(q, -1, -1), Physics:-Ket(q, -1, 1, -1))

 

Physics:-Simplify(Physics:-Ket(Prod)) <> Physics:-Ket(Prod)

(5)

q[1]*q[2]-q[2]*q[1]<>0;
q[1]*q[3]-q[3]*q[1]<>0;
q[2]*q[3]-q[3]*q[2]<>0;

Physics:-`*`(q[1], q[2])-Physics:-`*`(q[2], q[1]) <> 0

 

Physics:-`*`(q[1], q[3])-Physics:-`*`(q[3], q[1]) <> 0

 

Physics:-`*`(q[2], q[3])-Physics:-`*`(q[3], q[2]) <> 0

(6)

 


 

Download Expand_Simplify-of-Kets.mw


 

 

The initial conditions are U[13.75]=0.7787 and U'[13.75]=0.344037

Hello together,

I´m a new member and I used in Maple 2017 the function "is prime" for the largest known Mersenne prime (277,232,917 − 1) with the command "isprime (277,232,917 − 1)" to test how much time the programm needs that it returns "true".

1.) Has anybody experiences with the function "is prime" in relation with such a large Mersenne prime ( 277,232,917 − 1) or similar Mersenne primes like ( 257,885,161 − 1), ( 274,207,281 − 1), etc... ? How many days it takes to get the confirmation in my case ?

My processor: Intel i5-4590 CPU @ 3.30 GHz

System type: 64 Bit  

I started the function isprime(277,232,917 − 1) before 5 days. The programm is still evaluating, next to "evaluating" the point changes his colors (black and white) continuous, so I think the programm is still working, but the memory stopped at 2440.33 M and the time stopped at 12326.65 s

2.) Has anybody an idea why Maple has stopped to count the time and the memory in this case ? 

 

I hope that somebody can answer my 2 questions....thx... 

Good morning sirs,

I have been trying to compute this problem to its given me the error message "Error, invalid input: rhs received {f[0](eta) = -(1/50)*eta^2+(1/5)*eta+1/5, theta[0](eta) = -eta+5}, which is not valid for its 1st argument, expr".

The problem is attach below.

Please, anyone with useful informations should help.

Thanks

HPM_4.mw

Some of these seem to be difficult to explain ...

 

restart;

Digits:=3;

3

(1)

u:=1.23456;

1.23456

(2)

A := [1.23456, 1.23456+0, 1.23456+x+0, 1.23456+(x+0)];
B := [u,       u+0,       u+x+0,       u+(x+0)];

[1.23456, 1.23, 1.23+x, 1.23456+x]

 

[1.23456, 1.23456, 1.23456+x, 1.23456+x]

(3)

lprint(A); lprint(B);

[1.23456, 1.23, 1.23+x, 1.23456+x]

[1.23456, 1.23456, 1.23456+x, 1.23456+x]

 

is(A[1]=A[2]),    is(A[3]=A[4]);

true, true

(4)

evalb(A[1]=A[2]), evalb(A[3]=A[4]);

true, false

(5)

is(A=B);
is~(A=~B);

false

 

[true, true, true, true]

(6)

evalb(A=B);
evalb~(A=~B);

false

 

[true, true, false, true]

(7)

 

Download Difficult-to-explain.mw

I am interested and intrigued by optical illusions, such as that entitled 'Drawing A Hole in Line Paper

 - 3D Trick Art' by artist Jonathan Stephen Harris. Check out this YouTube video  to appreciate the following. Not being good at art, I tried to replicate this illusion using Maple..  The program below is merely a start towards this goal.  I have a procedure which draws the outline of the letter A.  Different letters have different peculiarities: I chose the letter A since it is relatively easy in that it does not have curves.  It does have a triangular region, so I created a separate procedure for that.  The whole letter A can be rotated through an angle phi.   Also I have drawn a grid of parallelograms for use as the lines drawn on the paper - but this I think has bugs. .

     The method I have used is rather long and messy, just using coordinate geometry, for the vertex points of the A, then rotating them through an angle phi.   Also in the program is a grid of parallelograms, for use in drawing the lines across the page.  That's as far as I've got.  Major problems I foresee is seeing/calculating where these lines meet the outline of the letter A, where vertical lines would be drawn.  Also, the artist draws in shading - how can that be done in Maple?  My attempt at the task has brought up some issues that there must be a simpler, better method of doing this.  eg first put the coords in a vector, and use matrix multiplication to calculate the new coords.  My method is long and error prone. 

   I'd appreciate some feedback about any attempts similar to this.  In my program I tried to fill the color of the polygon which was the boundary of the A, but it filled in the base trapezoidal region as well.  On top of that I failed to color the small triangular region a different color.  As always, any help or suggestions would be gratefully received. 

.   

restart:

printlevel:=0:

with(plots):

with(plottools):

# nrows= Number of rows ncols is one more than nrows

nrows:=8:ncols:=9:

x0:=0:y0:=0:theta:=Pi/12:psi:=Pi/3:
#Width, w, and length, l, of sides of the parallelograms/polygons c[i,j]

w:=2:l:=3:

 

for i from 0 to nrows do

  for j from 0 to ncols do

#c[i,j] := rectangle([i+1,j], [i,j+1], color=red):

c[i,j] := polygon([[x0,y0],[x0+i*w*cos(psi),y0+i*w*sin(psi)],[x0+i*w*cos(psi)+j*l*cos(theta),y0+i*w*sin(psi)+j*l*sin(theta)], [x0+j*l*cos(theta),y0+j*l*sin(theta)]], filled=true,color=red):

 

  end do:

end do:

plots[display](seq(seq(c[i,j], j=0..ncols),i=0..nrows), scaling=constrained);

#t1:=textplot([2,3,`David`]):

#for i from 0 to nrows do

#  for j from 0 to ncols do

   #c[i,j] := rectangle([j+1,i], [j,i+1], color=white):

#  end do;

#end do;

#pl1:=plots[display](seq(seq(c[j,i], i=0..ncols),j=0..nrows), scaling=constrained):

pl1:=plots[display](seq(seq(c[i,j], i=0..ncols),j=0..nrows), scaling=constrained):

 

plots[display](pl1);

 

# To draw the letter A

# Using proc poly_out:  also to put in initial coords (x0,y0) of lower left foot of A, then rotate the letter A through an angle of phi

#thet:=Pi/3:phi:=Pi/2:

# thet is angle the left "diagonal" makes with the horizontal.

# l is the length of the diagonals - ie the left and right hand sloping sides of the letter A

# w is width of the feet of the letter A.  (Both equal width)

# topl is the "top length" of the horizontal top part of the letter A.

# (x0, y0) are the coords of the bottom left point of the letter A.

# phi is the anti-clockwise angle of rotation about (0,0)

 

poly_out:=proc(thet,l,w, topl, x0, y0, phi)

local outA, outAr,trig, trigr,D,E,F,G, corr, eps:

#l:=10:thet:=Pi/3:w:=4:

#topl:=3:

eps:=3*w/4:corr:=.3*w:

trig:=polygon([[x0+(2*l*cos(thet)+topl)/2, y0+l*sin(thet)-eps],[x0+w+(l/3+corr*w)*cos(thet), y0+(l/3+corr*w)*sin(thet)],[x0+2*l*cos(thet)+topl-w-(l/3+corr*w)*cos(thet), y0+(l/3+corr*w)*sin(thet)]]):

 

trigr:=polygon([[(x0+(2*l*cos(thet)+topl)/2)*cos(phi)-(y0+l*sin(thet)-eps)*sin(phi),(x0+(2*l*cos(#thet)+topl)/2)*sin(phi)+(y0+l*sin(thet)-eps)*cos(phi)],[(x0+w+(l/3+corr*w)*cos(thet))*cos(phi)-(y#0+(l/3+corr*w)*sin(thet))*sin(phi),(x0+w+(l/3+corr*w)*cos(thet))*sin(phi)+(y0+(l/3+corr*w)*sin(th#et))*cos(phi)],[(x0+2*l*cos(thet)+topl-w-(l/3+corr*w)*cos(thet))*cos(phi)-(y0+(l/3+corr*w)*sin(th#et))*sin(phi),(x0+2*l*cos(thet)+topl-w-(l/3+corr*w)*cos(thet))*sin(phi)+( #y0+(l/3+corr*w)*sin(thet))*cos(phi)]], color=white,filled=true):

 

outA:=polygon([[x0,y0],[x0+l*cos(thet),y0+l*sin(thet)],[x0+l*cos(thet),y0+l*sin(thet)],[x0+l*cos(thet)+topl,y0+l*sin(thet)],[x0+2*l*cos(thet)+topl,y0], [x0+2*l*cos(thet)+topl-w,y0],[x0+5*l*cos(thet)/3+topl-w,y0+l*sin(thet)/3],[x0+l*cos(thet)/3+w,y0+l*sin(thet)/3], [x0+w,y0]]):

 

outAr:=polygon([[x0*cos(phi)-y0*sin(phi),x0*sin(phi)+y0*cos(phi)],[(x0+l*cos(thet))*cos(phi)-(y0+l*sin(thet))*sin(phi),(x0+l*cos(thet))*sin(phi)+(y0+l*sin(thet))*cos(phi)],[(x0+l*cos(thet))*cos(phi)-(y0+l*sin(thet))*sin(phi),(x0+l*cos(thet))*sin(phi)+(y0+l*sin(thet))*cos(phi)],[(x0+l*cos(thet)+topl)*cos(phi)-(y0+l*sin(thet))*sin(phi),(x0+l*cos(thet)+topl)*sin(phi)+(y0+l*sin(thet))*cos(phi)],[(x0+2*l*cos(thet)+topl)*cos(phi)-y0*sin(phi),(x0+2*l*cos(thet)+topl)*sin(phi)+y0*cos(phi)], [(x0+2*l*cos(thet)+topl-w)*cos(phi)-y0*sin(phi),(x0+2*l*cos(thet)+topl-w)*sin(phi)+y0*cos(phi)],

[(x0+5*l*cos(thet)/3+topl-w)*cos(phi)-(y0+l*sin(thet)/3)*sin(phi),(x0+5*l*cos(thet)/3+topl-w)*sin(phi)+(y0+l*sin(thet)/3)*cos(phi)],

[(x0+l*cos(thet)/3+w)*cos(phi)-(y0+l*sin(thet)/3)*sin(phi),(x0+l*cos(thet)/3+w)*sin(phi)+(y0+l*sin(thet)/3)*cos(phi)], [(x0+w)*cos(phi)-y0*sin(phi),(x0+w)*sin(phi)+y0*cos(phi)]], color=grey,filled=true):

 

 

 

plots[display](outAr,trigr, axes=none, scaling=constrained);  # view=[-l..l,-l..l]);

#outA & trig removed from display – these give the `upright` #letter A

end proc:

plot1:=poly_out(Pi/3,15,3,3, 0,0, Pi/15):

plots[display](plot1, pl1);

I'm just unable to see how this could be correct, if someone can take a look it would be much appreciated.

 


 

sum((piecewise(6 = k, 1, 6 <> k, 0)-3*frac((1/3)*N)*piecewise(6 = k+1, 1, 6 <> k+1, 0))*floor((1/3)*N*3^(k-floor(ln((1/3)*N)/ln(3))-1)), k = 1 .. floor(ln((1/3)*N)/ln(3))+1)

sum((piecewise(6 = k, 1, 6 <> k, 0)-3*frac((1/3)*N)*piecewise(6 = k+1, 1, 6 <> k+1, 0))*floor((1/3)*N*3^(k-floor(ln((1/3)*N)/ln(3))-1)), k = 1 .. floor(ln((1/3)*N)/ln(3))+1)

(1)

simplify(sum((piecewise(6 = k, 1, 6 <> k, 0)-3*frac((1/3)*N)*piecewise(6 = k+1, 1, 6 <> k+1, 0))*floor((1/3)*N*3^(k-floor(ln((1/3)*N)/ln(3))-1)), k = 1 .. floor(ln((1/3)*N)/ln(3))+1))

piecewise(k = 5, -3*(floor((-ln(3)+ln(N))/ln(3))+1)*floor(27*3^(-floor((-ln(3)+ln(N))/ln(3)))*N)*frac((1/3)*N), k = 6, (floor((-ln(3)+ln(N))/ln(3))+1)*floor(81*3^(-floor((-ln(3)+ln(N))/ln(3)))*N), 0)

(2)

``


 

Download mapleHELP.mw

Dear users! I need the help in attached file. Please see and fix it. I am waiting your positive answer.

File_to_help.mw

Dear All

I need to minimize a quadratic function with constraints, but i get

Error, (in Optimization:-QPSolve) unexpected parameters


restart;
with(Optimization);
with(plots);

obj := (c0-x)^2+(c1-(2/3)*x-(1/3)*y)^2+(c2-(1/3)*x-(2/3)*y)^2+(c3-y)^2;
cnsts := 32*x+19*y = 15*c0+18*c1+15*c2+3*c3;
          Minimize(obj, cnsts);

I would like to obtain the optimal parameter ( x,Y) that satisfies the minimization problem with constraints , and the results must depend on c0,c1,c2 and c3. 

Many thanks for your help

 

 

 

First 850 851 852 853 854 855 856 Last Page 852 of 2216