MaplePrimes Questions

We give a line (D) and a point A located at a distance AH=h from D. A constant angle of magnitude alpha pivots to its apex A and we call B and C the points where its sides cut the line D. Let O be the center of the circle circumscribed to the triangle ABC.
Demonstrate that the B and C tangents to the O circle keep a fixed direction. 
Here is my code which don't work for slopes are not equal.

restart; with(plots): with(geometry):unprotect(D):
_EnvHorizontalName := 'x':_EnvVerticalName := 'y':
line(D, y = (1/2)*x-1); point(A, 5, 5); PerpendicularLine(lp, A, D); h := distance(A, D); intersection(H, D, lp);
alpha := (1/16)*Pi;
rotation(lp1, lp, (1/6)*Pi, 'clockwise', A); rotation(lp2, lp1, (1/6)*Pi-alpha, 'clockwise', A); FindAngle(lp1, lp2); evalf(%);
intersection(B, D, lp1); intersection(C, D, lp2);
triangle(T, [A, B, C]);
circumcircle(Elc, T, 'centername' = OO);
TangentLine(tgB, B, Elc); TangentLine(tgC, C, Elc);
evalf(slope(tgB)); evalf(slope(tgC));
dr := draw([D(color = blue), lp(color = red), Elc(color = green), A, B, C, T(color = black), H, tgB, tgC], printtext = true);

display([dr], axes = none, scaling = constrained);
Fig := proc (k) local dr, Elc, B, C, lp1, lp2; global D, A, lp, H, alpha; geometry:-rotation(lp1, lp, (1/6)*Pi+k, 'clockwise', A); geometry:-rotation(lp2, lp1, (1/6)*Pi-alpha+k, 'clockwise', A); geometry:-intersection(B, D, lp1); geometry:-intersection(C, D, lp2); geometry:-triangle(T, [A, B, C]); geometry:-circumcircle(Elc, T, 'centername' = OO); geometry:-TangentLine(tgB, B, Elc); geometry:-TangentLine(tgC, C, Elc); dr := geometry:-draw([D(color = blue), lp(color = red), Elc(color = green), A, B, C, T(color = black), H, tgB, tgC], printtext = true); plots:-display([dr], axes = none, scaling = constrained) end proc;
iframes := 10;

display([seq(Fig((1/12)*Pi+i/(10*iframes)), i = 1 .. iframes)], insequence, scaling = constrained);
How to improve this code ? Thank you.

Hi,

Could anybody help me with how to solve the linear time-varying differential equation set in Maple?

A good example will works well.

I've finally decided to see what I could to do with DocumentTools.
I started with these simple lines from ?DocumentTools:-Do 

restart:
with(DocumentTools):
Do(int(%expression, x=%from::integer..%to::integer));
Error, (in DocumentTools:-GetProperty) Attempted to retrieve property of unknown component expression.

These next ones return the expected plot but an alert window 

restart:
with(DocumentTools):
Do(%Plot1=plot(x^2, x=0..1));


However the Click and Drag icon is disabled in the plot toolbar and invisible in the plot menu.

The behaviour of these commands do not depend on whether they are written in a worksheet, a section or a code edit region.

Could you detail me the very first steps do use DocumentTools features?

TIA

DT-Do.mw

Suppose we want to compute the following derivate:

x := [x__1, x__2, x__3]

f := [x__1]

Gradf := Matrix(1, 3, (i,j) -> diff(f[i], x[j]));

Gradf2 := Matrix(3, 3, (i,j) -> diff(Gradf[i], x[j]));

 

my question is how to convert Gradf from [1  0 0] to [1,0,0]?

 

Hello there, 

Would you allow me to ask this question?

What I tried in the worksheet below is to map an expression to x-axis and another expression to y-axis, while both expressions have the same input (or independent variable). However, the resulting plot still shows those two expressions as two separate curves. Would you tell me how to map or assign the expressions to each axis?


 

restart;

with(LinearAlgebra):

Digits := 6:

j := I:

L__adpu := 1.66;
L__aqpu := 1.61;
L__lpu := 0.15;
R__apu := 0.003;
E__tpu := 1.0;
MVA := 555;

1.66

 

1.61

 

.15

 

0.3e-2

 

1.0

 

555

(1)

A__sat := 0.0312500:
B__sat := 6.93147:

I__tpu_compare := (P__t - j* Q__t) / E__tpu;

-(1.00000*I)*Q__t+1.00000*P__t

(2)

I__tpu_a := abs(I__tpu_compare);

abs(-(1.00000*I)*Q__t+1.00000*P__t)

(3)

Phi := arccos(P__t / (I__tpu_a * E__tpu));

arccos(1.00000*P__t/abs(-(1.00000*I)*Q__t+1.00000*P__t))

(4)

E__a__tilde := E__tpu + (R__apu + j * L__lpu) * I__tpu_compare;

1.0+(0.3e-2+.15*I)*(-(1.00000*I)*Q__t+1.00000*P__t)

(5)

psi__at := abs(E__a__tilde);

abs(1.0+(0.3e-2+.15*I)*(-(1.00000*I)*Q__t+1.00000*P__t))

(6)

psi__I := A__sat * exp(B__sat * (psi__at - 0.8));

0.312500e-1*exp(6.93147*abs(1.0+(0.3e-2+.15*I)*(-(1.00000*I)*Q__t+1.00000*P__t))-5.54518)

(7)

K__sd := psi__at / (psi__at + psi__I);

abs(1.0+(0.3e-2+.15*I)*(-(1.00000*I)*Q__t+1.00000*P__t))/(abs(1.0+(0.3e-2+.15*I)*(-(1.00000*I)*Q__t+1.00000*P__t))+0.312500e-1*exp(6.93147*abs(1.0+(0.3e-2+.15*I)*(-(1.00000*I)*Q__t+1.00000*P__t))-5.54518))

(8)

K__sq := K__sd;

abs(1.0+(0.3e-2+.15*I)*(-(1.00000*I)*Q__t+1.00000*P__t))/(abs(1.0+(0.3e-2+.15*I)*(-(1.00000*I)*Q__t+1.00000*P__t))+0.312500e-1*exp(6.93147*abs(1.0+(0.3e-2+.15*I)*(-(1.00000*I)*Q__t+1.00000*P__t))-5.54518))

(9)

X__ad := K__sd * L__adpu:

X__d := X__ad + L__lpu:

X__aq := K__sq * L__aqpu:

X__q := X__aq + L__lpu:

delta__i := arctan((X__q * I__tpu_a * cos(Phi) - R__apu * I__tpu_a * sin(Phi))/(E__tpu + R__apu * I__tpu_a * cos(Phi) + X__q * I__tpu_a * sin(Phi))):

e__q := E__tpu * cos(delta__i):

i__d := I__tpu_a * sin(delta__i + Phi):

i__q := I__tpu_a * cos(delta__i + Phi):

i__fd := (e__q + R__apu * i__q + X__d * i__d)/(X__ad):

i_armature := sqrt(i__d^2 + i__q^2):

i_armature2 := subs(P__t = 0, i_armature):

i_armature3 := subs(P__t = 0.5, i_armature):

i_armature4 := subs(P__t = 1.0, i_armature):

plotA := plot(i_armature2, Q__t = -0.6..0.6):

plotB := plot(i_armature3, Q__t = -0.6..0.6):

plotC := plot(i_armature4, Q__t = -0.6..0.6):

plots:-display([plotA, plotB, plotC]);

 

i__fd2 := subs(P__t = 0, i__fd):

i__fd3 := subs(P__t = 0.5, i__fd):

i__fd4 := subs(P__t = 1.0, i__fd):

 

plotD := plot(i__fd2, Q__t = -0.6..0.6):

plotE := plot(i__fd3, Q__t = -0.6..0.6):

plotF := plot(i__fd4, Q__t = -0.6..0.6):

plots:-display([plotD, plotE, plotF]);

 

plot([i__fd2, i_armature2, Q__t = -0.6..0.6]); #failed, two expressions are plotted seperately.

 

 

 


Best Regards, 

In Kwon Park 

Download Q20210416.mw

What is the reason for the warning?

restart;
f := (x, y, z) -> 1 - x^4 + ln(x^4) + z^4 - y^4 - y^4*(ln(z^4) - ln(y^4));


with(Optimization);
Minimize(f(x, y, z), {x^2 + y^2 - z^2 - 1 = 0, 0 <= x - 1, 0 <= y - x, 0 <= z - y});
Warning, no iterations performed as initial point satisfies first-order conditions
                 [0., [x = 1., y = 1., z = 1.]]

Suppose we have a state vector x=[x_1,y_1,theta_1,x_2,y_2,theta_2] and a vector field f=[cos(theta_1),sin(theta_1),0,0,0,0]

How we can define a vector field with 6 dimentions?

with(VectorCalculus);
f := VectorField([cos(theta__1),sin(theta__1),0,0,0,0],'cartesian ??? '[x__1,y__1,z__1,x__2,y__2,z__2]);

I need to compute the Jacobian of f wrt x:

Jacobian(f, [x_1,y_1,theta_1,x_2,y_2,theta_2]

In an answer to an earlier question

https://mapleprimes.com/questions/232067-Error-Invalid-Neutral-Operator

I inadvertently used the "Insert Contents" link - AND IT WORKED

Anybody know how long this has been fixed?

Dear all

How can I plot vector using maple

Maple return the following error

Error, invalid neutral operator
plotvector.mw

Thank you

In trying to create a plot that shades the region between two concentric circles, I decided to try using the Picture procedure found here: https://www.mapleprimes.com/posts/145922-Perimeter-Area-And-Visualization-Of-A-Plane-Figure-

This is as far as I got.


 

"Picture := proc (L, C, N::posint := 100, Boundary::list := [linestyle = 1])    local i, var, var1, var2, e, e1, e2, P, Q, h;    global Border;    for i to nops(L) do    if type(L[i], listlist(algebraic)) then P[i] := op(L[i]) else    var := lhs(L[i, 2]); var1 := lhs(rhs(L[i, 2])); var2 := rhs(rhs(L[i, 2])); h := (var2-var1)/N;    if type(L[i, 1], algebraic) then e := L[i, 1];    if nops(L[i]) = 3 then P[i] := seq(subs(var = var1+h*i, [e*cos(var), e*sin(var)]), i = 0 .. N) else    P[i] := seq([var1+h*i, subs(var = var1+h*i, e)], i = 0 .. N) end if else    e1 := L[i, 1, 1]; e2 := L[i, 1, 2]; P[i] := seq(subs(var = var1+h*i, [e1, e2]), i = 0 .. N) end if end if    end do;    Q := [seq(P[i], i = 1 .. nops(L))];    Border := plottools[curve]([op(Q), Q[1]], op(Boundary));    [plottools[polygon](Q, C), Border];    end proc:"

L := [[3, t = 0 .. 2*Pi, polar], [2, t = 0 .. 2*Pi, polar]]; plots[display](Picture(L, color = yellow, [color = brown, thickness = 3]), scaling = constrained, view = [-4 .. 4, -4 .. 4])

 

NULL


Clearly, this is not what I want. I am probably missing something simple here. How can I get only the region between the two circles to be shaded?

Download shading_annular_regions.mw

 

 

 

Hello friends
PLEASE HELP 

I have the following issue 

I want to make one plot with specific values of argument 

here is an example of 2d plot ,


what i want is to plot the same graph only with specific values of x for example x =-pi..pi/2  , -pi/4..pi/4  and so on 

but this has to be in one plot , could please tell me the options how I can manage this problem .  

 

At the end its a 3Dplot , x is a function of y and t  

so actually i want to make 3d plot in a different ares of y and t 

something like this plot3d(u ,x=-1..1,t=-1..1 , x=2..3 , t=2..3 .... ) 
or maybe in opposite way ,to restrict some values of x and t 

( idea is that function is periodic but I dont want to get crazy high values of the function, especially where functuon goes to infinity  ) 

PLEASE HELP 

thank you very much in advance 

Hi

 

Can anyone please help me Ive been stuck on this program for ages and cant see what I'm doing wrong?

Here is the code:

restart;
randomize();
npaths := 10;
nsteps := 1;
S0 := 100.0;
K := 100;
T := 0.25;
r := 0.05;
sig := 0.15;
lambda := 0.1;
a := -0.9;
nu := 0.45;
m := exp(a + (0.5*nu)*nu);
mu := r - (m - 1.0)*lambda;
dt := T/nsteps;
with(Statistics);
N := RandomVariable(Poisson(lambda*dt));
Z := RandomVariable(Normal(0, 1));
                           1059210787

                            K := 100

                           T := 0.25

                           r := 0.05

                          sig := 0.15

                         

Xsum:=0.0: #`Initialise sum of payoffs over all paths` Asum:= 0.0:   for i from 1 to npaths do    S[0]:=S0 : #` initialise`   lnS:=ln(S[0]):    Stot := 0.0:    for i from 1 to nsteps do  N1:=Sample(N,1)[1]: #` sample number from poisson distribution`  Z1:=Sample(Z,1)[1]: #` sample number from normal distribution`   dlnS:=r*dt+(mu-r)*dt-0.5*sig^(2)*dt+N1*ln(m)-0.5*nu^(2)*N1+sqrt(sig^(2)*dt+nu^(2)*N1) *Z1: #` Joshi 15.12`   lnS:=lnS+dlnS:  #print(cal,N1*ln(m)-0.5*nu^(2)*N1);  S[i]:=exp(lnS):  Stot:= Stot + S[i]:     end do:    #`European Call Option (Parrott)`  X1:=max(0.0,K-S[nsteps]):  Xsum:=Xsum+X1:    #`Asian Call Option`  Save := Stot/(nsteps):  A1 :=max(0.0, K-Save):  Asum := Asum + A1:     if(k mod 10 = 0) then print (k, Euro Call,X1, Asian  Call, A1)end if:   if (k=1) then Sp1:=copy(S) end if:   if (k=2) then Sp2:=copy(S) end if:   if (k=3) then Sp3:=copy(S) end if:     end do:    #`Euro Call`  X0:=exp(-r*T)*(  Xsum)/(npaths);   print("Euro call price at t=0",X0, "actual",3.1490);       #`Asian Call`  A0:=exp(-r*T)*(  Asum)/(npaths);   print("Asian call price at t=0",X0, "actual", A0);   #`Plot of three sample paths: to generate decent looking paths, set npaths=3, and nsteps=1000 above and rerun`    data1:=[seq([ i*dt,Sp1[i]],i=0..nsteps)]:  data2:=[seq([ i*dt,Sp2[i]],i=0..nsteps)]:  data3:=[seq([ i*dt,Sp3[i]],i=0..nsteps)]:  plot([data1,data2,data3]);               ;

 

The errors i get are unterminated loop and parse.

 

Thank you
 

Hello friends,

I'm trying to get the exact result from the following operation:

I'm getting:

for i=0,

for i=1,

for i=2,

I want to get:

for i=0, 1

for i=1, -1/2 + sqrt(3)/2 i

for i=2, -1/2 - sqrt(3)/2 i

Thanks for the light.

Maple has issues integrating products of Bessel functions over an infinite range, and in fact, this extends to trig functions. The integrals in the attached should return as delta functions but don't. 

Spherical_Bessel_identity.mw

Is there like https://oeis.org/   Library available in maple for enumerate in for loop?

i would like to like shift 9 times and create 100 mapping for each sequence 

First 415 416 417 418 419 420 421 Last Page 417 of 2427