MaplePrimes Questions

Dear Maple primes,

Could you, please, help me with numerical solution of an ODE?

The ODE looks like this

dz/dx = f1(x,z) + f2(z)

where f1(x,z) is some simple function of x and z (that does not create any problem), but f2(z) is given as

f2(z) = int(f3(t), t = z1..z2)

The problem appears, when the integral cannot be solved analytically.

Below is an example of the problem (here I chose the function f3(t)= tt as well as other functions, intervals and initial condition only for the sake of illustration of the problem):

restart; with(plots)

INT := Int(t^t, t = .1 .. z(x), method = _DEFAULT)

eq1 := {diff(z(x), x) = x+z(x)+INT, z(.1) = .1}

plot1 := dsolve(eq1, type = numeric, range = .1 .. 1)

odeplot(plot1)


Download z-for_primes_dsolve.mw

Thank you in advance!

Max

Hello!
I'm a beginner in Maple. My question is: is it possible to trim the surface along the intersection line in Maple? There is a problem - inclined surfaces are constructed along the contour of the triangle, they intersect. Is it possible to get a pyramid along the intersection lines?
Thank you!trimming_surfaces.mwtrimming_surfaces.mw
 

NULL

restart; with(plots), with(plottools); with(linalg)

Q1p := 45; Q1po := 75

Q2p := 110; Q2po := 84

Q3p := 63; Q3po := 120

NULL

NULL

NULL

XP := KTX1+(KTX2-KTX1)*t1

YP := KTY1+(KTY2-KTY1)*t1

NULL

NULL

x1 := subs({KTX1 = Q1p, KTX2 = Q2p, t1 = t1}, XP)

y1 := subs({KTY1 = Q1po, KTY2 = Q2po, t1 = t1}, YP)

NULL

x2 := subs({KTX1 = Q2p, KTX2 = Q3p, t1 = t2}, XP)

y2 := subs({KTY1 = Q2po, KTY2 = Q3po, t1 = t2}, YP)

``

NULL

x3 := subs({KTX1 = Q3p, KTX2 = Q1p, t1 = t3}, XP)

y3 := subs({KTY1 = Q3po, KTY2 = Q1po, t1 = t3}, YP)

NULL

za := 0

``

Kriv1 := spacecurve([x1, y1, za, t1 = 0 .. 1], color = brown, scaling = constrained, thickness = 4)

Kriv2 := spacecurve([x2, y2, za, t2 = 0 .. 1], color = green, scaling = constrained, thickness = 4)

Kriv3 := spacecurve([x3, y3, za, t3 = 0 .. 1], color = blue, scaling = constrained, thickness = 4)

NULL

display(Kriv1, Kriv2, Kriv3)

NULL

NULL

xE1 := x1-30*(diff(y1, t1))/sqrt((diff(x1, t1))^2+(diff(y1, t1))^2)

yE1 := y1+30*(diff(x1, t1))/sqrt((diff(x1, t1))^2+(diff(y1, t1))^2)

zE1 := 30

KrivE1 := spacecurve([xE1, yE1, zE1, t1 = 0 .. 1], color = blue, scaling = constrained, thickness = 4)

NULL

xP1 := simplify(xE1+l1*(x1-xE1))

yP1 := simplify(yE1+l1*(y1-yE1))

zP1 := simplify(zE1*(1-l1))

P1 := plot3d([xP1, yP1, zP1], t1 = 0 .. 1, l1 = 0 .. 1, transparency = 0)

display(KrivE1, Kriv1, P1, Kriv2, Kriv3)

``

NULL

xE2 := x2-30*(diff(y2, t2))/sqrt((diff(x2, t2))^2+(diff(y2, t2))^2)

yE2 := y2+30*(diff(x2, t2))/sqrt((diff(x2, t2))^2+(diff(y2, t2))^2)

zE2 := 30

KrivE2 := spacecurve([xE2, yE2, zE2, t2 = 0 .. 1], color = blue, scaling = constrained, thickness = 4)

NULL

xP2 := simplify(xE2+l2*(x2-xE2))

yP2 := simplify(yE2+l2*(y2-yE2))

zP2 := simplify(zE2*(1-l2))

P2 := plot3d([xP2, yP2, zP2], t2 = 0 .. 1, l2 = 0 .. 1, transparency = 0)

display(KrivE2, Kriv2, P2)

NULL

NULL

NULL

xE3 := x3-30*(diff(y3, t3))/sqrt((diff(x3, t3))^2+(diff(y3, t3))^2)

yE3 := y3+30*(diff(x3, t3))/sqrt((diff(x3, t3))^2+(diff(y3, t3))^2)

zE3 := 30

KrivE3 := spacecurve([xE3, yE3, zE3, t3 = 0 .. 1], color = blue, scaling = constrained, thickness = 4)

NULL

xP3 := simplify(xE3+l3*(x3-xE3))

yP3 := simplify(yE3+l3*(y3-yE3))

zP3 := simplify(zE3*(1-l3))

P3 := plot3d([xP3, yP3, zP3], t3 = 0 .. 1, l3 = 0 .. 1, transparency = 0)

display(KrivE3, Kriv3, P3)

NULL

NULL

NULL

L22 := solve(zP2 = zP1, l2)

L111 := solve(subs(l2 = L22, yP2 = yP1), l1)

L222 := subs(l1 = L111, L22)

T11 := solve(subs(l2 = L222, l1 = L111, xP2 = xP1), t1)

L2T := subs(t1 = T11, L222)

L1T := subs(t1 = T11, L111)

LP12 := spacecurve([XT12, YT12, ZT12, t2 = 0 .. 1], color = red, scaling = constrained, thickness = 1)

PLOT3D(CURVES([[110., 84., 0.], [108.7339864, 84.33411040, .5045906412], [107.4679728, 84.66822079, 1.009181282], [106.2019593, 85.00233119, 1.513771924], [104.9359457, 85.33644158, 2.018362565], [103.6699321, 85.67055198, 2.522953207], [102.4039185, 86.00466237, 3.027543849], [101.1379050, 86.33877277, 3.532134491], [99.87189139, 86.67288316, 4.036725133], [98.60587781, 87.00699356, 4.541315775], [97.33986423, 87.34110395, 5.045906417], [96.07385066, 87.67521435, 5.550497059], [94.80783708, 88.00932474, 6.055087701], [93.54182350, 88.34343514, 6.559678343], [92.27580993, 88.67754554, 7.064268985], [91.00979635, 89.01165593, 7.568859626], [89.74378277, 89.34576633, 8.073450268], [88.47776919, 89.67987672, 8.578040910], [87.21175562, 90.01398712, 9.082631552], [85.94574204, 90.34809751, 9.587222194], [84.67972846, 90.68220791, 10.09181284], [83.41371488, 91.01631830, 10.59640348], [82.14770131, 91.35042870, 11.10099412], [80.88168773, 91.68453909, 11.60558476], [79.61567415, 92.01864949, 12.11017540], [78.34966058, 92.35275989, 12.61476605], [77.08364700, 92.68687028, 13.11935669], [75.81763342, 93.02098068, 13.62394733], [74.55161984, 93.35509107, 14.12853797], [73.28560627, 93.68920147, 14.63312861], [72.01959269, 94.02331186, 15.13771926], [70.75357911, 94.35742226, 15.64230990], [69.48756554, 94.69153265, 16.14690054], [68.22155196, 95.02564305, 16.65149118], [66.95553838, 95.35975345, 17.15608182], [65.68952480, 95.69386384, 17.66067247], [64.42351123, 96.02797424, 18.16526311], [63.15749765, 96.36208463, 18.66985375], [61.89148407, 96.69619503, 19.17444439], [60.62547050, 97.03030542, 19.67903503], [59.35945692, 97.36441582, 20.18362567], [58.09344334, 97.69852621, 20.68821632], [56.82742976, 98.03263661, 21.19280696], [55.56141619, 98.36674700, 21.69739760], [54.29540261, 98.70085740, 22.20198824], [53.02938903, 99.03496780, 22.70657888], [51.76337545, 99.36907819, 23.21116953], [50.49736188, 99.70318859, 23.71576017], [49.23134830, 100.0372990, 24.22035081], [47.96533470, 100.3714094, 24.72494146]], COLOUR(RGB, 1.00000000, 0., 0.)), THICKNESS(1), SCALING(CONSTRAINED))

(1)

``

NULL

NULL``

L22 := solve(zP2 = zP3, l2)

L333 := solve(subs(l2 = L22, yP2 = yP3), l3)

L222 := subs(l3 = L333, L22)

T33 := solve(subs(l2 = L222, l3 = L333, xP2 = xP3), t3)

L2T := subs(t3 = T33, L222)

L3T := subs(t3 = T33, L333)

LP32 := spacecurve([XT32, YT32, ZT32, t2 = 0 .. 1], color = red, scaling = constrained, thickness = 3)

PLOT3D(CURVES([[82.69885121, 48.35683352, 44.89752824], [82.29683384, 49.81893896, 43.98125215], [81.89481646, 51.28104440, 43.06497607], [81.49279909, 52.74314984, 42.14869998], [81.09078172, 54.20525528, 41.23242389], [80.68876435, 55.66736072, 40.31614780], [80.28674698, 57.12946616, 39.39987171], [79.88472960, 58.59157160, 38.48359563], [79.48271223, 60.05367704, 37.56731954], [79.08069486, 61.51578248, 36.65104345], [78.67867749, 62.97788792, 35.73476736], [78.27666012, 64.43999336, 34.81849127], [77.87464274, 65.90209880, 33.90221519], [77.47262537, 67.36420425, 32.98593910], [77.07060800, 68.82630969, 32.06966301], [76.66859063, 70.28841513, 31.15338692], [76.26657325, 71.75052057, 30.23711083], [75.86455588, 73.21262601, 29.32083475], [75.46253851, 74.67473145, 28.40455866], [75.06052114, 76.13683689, 27.48828257], [74.65850376, 77.59894233, 26.57200648], [74.25648639, 79.06104777, 25.65573039], [73.85446902, 80.52315321, 24.73945431], [73.45245165, 81.98525865, 23.82317822], [73.05043428, 83.44736409, 22.90690213], [72.64841690, 84.90946954, 21.99062604], [72.24639953, 86.37157498, 21.07434995], [71.84438216, 87.83368042, 20.15807387], [71.44236479, 89.29578586, 19.24179778], [71.04034741, 90.75789130, 18.32552169], [70.63833004, 92.21999674, 17.40924560], [70.23631267, 93.68210218, 16.49296951], [69.83429530, 95.14420762, 15.57669343], [69.43227792, 96.60631306, 14.66041734], [69.03026055, 98.06841850, 13.74414125], [68.62824318, 99.53052394, 12.82786516], [68.22622581, 100.9926294, 11.91158907], [67.82420844, 102.4547348, 10.99531298], [67.42219106, 103.9168403, 10.07903690], [67.02017369, 105.3789457, 9.162760809], [66.61815632, 106.8410511, 8.246484721], [66.21613895, 108.3031566, 7.330208633], [65.81412157, 109.7652620, 6.413932545], [65.41210420, 111.2273675, 5.497656457], [65.01008683, 112.6894729, 4.581380368], [64.60806946, 114.1515784, 3.665104280], [64.20605209, 115.6136838, 2.748828192], [63.80403471, 117.0757892, 1.832552104], [63.40201734, 118.5378947, .9162760162], [62.99999996, 120.0000001, -0.8979507982e-7]], COLOUR(RGB, 1.00000000, 0., 0.)), THICKNESS(3), SCALING(CONSTRAINED))

(2)

NULL``

L33 := solve(zP3 = zP1, l3)

L111 := solve(subs(l3 = L33, yP3 = yP1), l1)

L333 := subs(l1 = L111, L33)

T11 := solve(subs(l3 = L333, l1 = L111, xP3 = xP1), t1)

L3T := subs(t1 = T11, L333)

L1T := subs(t1 = T11, L111)

LP13 := spacecurve([XT13, YT13, ZT13, t3 = 0 .. 1], color = red, scaling = constrained, thickness = 1)

PLOT3D(CURVES([[89.14619532, 109.5415219, 28.16031418], [88.24525256, 108.8365929, 27.58561389], [87.34430980, 108.1316638, 27.01091360], [86.44336704, 107.4267348, 26.43621331], [85.54242428, 106.7218058, 25.86151302], [84.64148151, 106.0168768, 25.28681273], [83.74053875, 105.3119478, 24.71211244], [82.83959598, 104.6070187, 24.13741215], [81.93865322, 103.9020897, 23.56271186], [81.03771046, 103.1971607, 22.98801157], [80.13676769, 102.4922317, 22.41331128], [79.23582493, 101.7873027, 21.83861099], [78.33488217, 101.0823736, 21.26391070], [77.43393941, 100.3774446, 20.68921041], [76.53299664, 99.67251561, 20.11451012], [75.63205388, 98.96758659, 19.53980983], [74.73111112, 98.26265757, 18.96510954], [73.83016835, 97.55772855, 18.39040925], [72.92922559, 96.85279953, 17.81570896], [72.02828283, 96.14787051, 17.24100866], [71.12734006, 95.44294149, 16.66630837], [70.22639730, 94.73801248, 16.09160808], [69.32545454, 94.03308346, 15.51690779], [68.42451177, 93.32815444, 14.94220750], [67.52356901, 92.62322542, 14.36750721], [66.62262625, 91.91829640, 13.79280692], [65.72168348, 91.21336738, 13.21810663], [64.82074072, 90.50843836, 12.64340634], [63.91979796, 89.80350934, 12.06870605], [63.01885519, 89.09858032, 11.49400576], [62.11791243, 88.39365131, 10.91930547], [61.21696967, 87.68872229, 10.34460518], [60.31602690, 86.98379327, 9.769904891], [59.41508414, 86.27886425, 9.195204600], [58.51414138, 85.57393523, 8.620504310], [57.61319861, 84.86900621, 8.045804020], [56.71225585, 84.16407719, 7.471103729], [55.81131309, 83.45914817, 6.896403439], [54.91037032, 82.75421915, 6.321703149], [54.00942756, 82.04929013, 5.747002858], [53.10848480, 81.34436112, 5.172302568], [52.20754204, 80.63943210, 4.597602278], [51.30659927, 79.93450308, 4.022901987], [50.40565651, 79.22957406, 3.448201697], [49.50471375, 78.52464504, 2.873501407], [48.60377098, 77.81971602, 2.298801116], [47.70282822, 77.11478700, 1.724100826], [46.80188546, 76.40985798, 1.149400536], [45.90094269, 75.70492896, .5747002453], [44.99999991, 74.99999993, -0.5632062994e-7]], COLOUR(RGB, 1.00000000, 0., 0.)), THICKNESS(1), SCALING(CONSTRAINED))

(3)

NULL

``

display(LP12, LP13, LP32, P1, P2, P3, Kriv1, Kriv2, Kriv3)

 

``

``

``

``

 

Download trimming_surfaces.mw

I really love this feature of course because it just allows you to learn so much about function properties via comparative learning processes, but I would also love to have the ability to:

1) Add elements to the list that is stored under known_functions:

FunctionAdvisor(known_functions);

 

2) Add my own categories of information such as the ones that exist like DE, branch_cuts, etc

I want to know about some algorithms used by Maple, if there is a way to dig through the code.

Hello!

I am currently trying to plot the function: sqrt(x^2+y^2-c), where x & y are variables in cartesian coordinates, and c is an arbitrary real constant. I came across a jagged edged plot when I asked maple to plot:

sqrt(x^2+y^2-c)       *** Code below ***

Explore(plot3d([sqrt(x^2+y^2-c),-sqrt(x^2+y^2-c)],x=-2..2,y=-2..2,numpoints=10000),c=-1..1)

So I entered in the "Re" command to take the real part:

Explore(plot3d([Re(sqrt(x^2+y^2-c)),Re(-sqrt(x^2+y^2-c))],x=-2..2,y=-2..2,numpoints=10000),c=-1..1)

This smoothed the plot out at the ring x^2+y^2=1, but however also added what looks like a solid disc as well. Is there a way I can plot the function correctly without this disc in the middle?

Thanks!

solve_V_alfa.mws

 

I'm trying to solve two simultaneous equations for velocity, V, and angle of inclination, alfa, given the range, ranj and maximum height, H.  The solve part works fine, but gives me several unwanted complex solutions.  I was trying to put the solutions in a list so that I could access them.  The text below is rather verbose, but I've left comments in as a possible educational aid for people understanding expression sequences, and sets. 

restart:
#interface(imaginaryunit, errorbreak=0, errorcursor=true, #labelling=false):
#with(SolveTools);

# Investigating sets and expression sequences
#S:={q, w,e}:
S:=7,2,5:
whattype(S);
L4:=convert(S,list): #Doesn't work for expression sequences
L4:=[S]; # this converts the expression sequence to a list, L4
L4[3]; # outputs 3rd element of L4 which is 5
# End of investigation

print(`Next part - solving two equations: Ranj and height H given`);
print(`To find angle of inclination, alfa, and velocity, V`);
g:=9.81:Ranj:=80:H:=15:
L:=solve({4*V^2*cos(alfa)^2-g*Ranj^2/(Ranj*tan(alfa)-2*H), Ranj*g-V*sin(2*alfa)},{V, alfa}): #::real}):
#L:=solve([4*V^2*cos(alfa)^2-g*Ranj^2/(Ranj*tan(alfa)-2*H), #Ranj*g-V*sin(2*alfa)],{V, alfa}): #::real}):
# ::real, alfa::real:
printf("L is of type %a", whattype(L));
#whattype(L);
#L2:=convert(L,list); #gives error message
L2:=[L]:
L2;
print(`Next: To distinguish between real and complex solutions`);
print(`Output in if statement is not working as expected.`);
#nops([L]);
for i from 1 to nops([L]) do
if type(L[i],complex(float)) then
#if type(L[i],nonreal) then
printf("Complex solution for i=%d\n",i);
else
printf("else part of if: i=%d\n",i);
print( L[i]);
end if;
end do; #for

Download solve_V_alfa.txt

 

Hi, having two different arrays of the same length,  is there a command to associate every element of one to the other of the other array? Thanks



It means, to have an array compsed by ex := [[2, 3.584328599],[3, ...] ]
Attention : there's no correlation among elements!
Thanks a lot

I'm attempting to calculate eigenvalues of a 16 x 16 matrix (Vibronic_Model_Worksheet.mw) which contains a single variable "x".

However, this matrix contains 24 instances of imaginary numbers.

When I try to solve for any number other than x = 0, I get: "Error, (in LinearAlgebra:-Eigenvalues) expecting either Matrices of rationals, rational functions, radical functions, algebraic numbers, or algebraic functions, or Matrices of complex(numeric) values"

Eventually I want to be able to solve for multiple values of x simultaneously.

I'm still fairly new to maple, so I may have overlooked something.

Hello
What is the Problem

Hi,

Here is a set of simple instructions to illustrate the first problem :

restart:
fichier := TheNameOfSomeFile:
writeto(fichier):
printf("Hello\n"):
writeto(termional):

When executed from Maple 2015 or Maple 2016, the content of TheNameOfSomeFile is

Hello

When executed from Maple 2018 it becomes

> printf("Hello\n"):
Hello
> writeto(terminal):

 

Using interface(echo=0) changes nothing to the result obtained with Maple 2018.

Has anyone ever encountered this problem?
How can I fix it?


Thanks in advance


 

``

x1 := 0; -1; x2 := 0; -1; J2 := J1

J1

(1)

NULL

ec1 := (1/J3-1/J2)*M2*M3+m*g*(g2*x3-g3*x2) = 0;

(1/J3-1/J1)*M2*M3+m*g*x3*g2 = 0

(2)

ec2 := (1/J1-1/J3)*M1*M3+m*g*(-g1*x3+g3*x1) = 0;

(1/J1-1/J3)*M1*M3-m*g*x3*g1 = 0

(3)

ec3 := (1/J2-1/J1)*M1*M2+m*g*(g1*x2-g2*x1) = 0;

0 = 0

(4)

ec4 := g2*M3/J3-g3*M2/J2 = 0;

g2*M3/J3-g3*M2/J1 = 0

(5)

ec5 := g3*M1/J1-g1*M3/J3 = 0;

g3*M1/J1-g1*M3/J3 = 0

(6)

ec6 := g1*M2/J2-g2*M1/J1 = 0;

g1*M2/J1-g2*M1/J1 = 0

(7)

F1 := (1/J3-1/J2)*M2*M3+m*g*(g2*x3-g3*x2);

(1/J3-1/J1)*M2*M3+m*g*x3*g2

(8)

F2 := (1/J1-1/J3)*M1*M3+m*g*(-g1*x3+g3*x1);

(1/J1-1/J3)*M1*M3-m*g*x3*g1

(9)

F3 := (1/J2-1/J1)*M1*M2+m*g*(g1*x2-g2*x1);

0

(10)

F4 := g2*M3/J3-g3*M2/J2;

g2*M3/J3-g3*M2/J1

(11)

F5 := g3*M1/J1-g1*M3/J3;

g3*M1/J1-g1*M3/J3

(12)

F6 := g1*M2/J2-g2*M1/J1;

g1*M2/J1-g2*M1/J1

(13)

with(Groebner)

[Basis, FGLM, HilbertDimension, HilbertPolynomial, HilbertSeries, Homogenize, InitialForm, InterReduce, IsBasis, IsProper, IsZeroDimensional, LeadingCoefficient, LeadingMonomial, LeadingTerm, MatrixOrder, MaximalIndependentSet, MonomialOrder, MultiplicationMatrix, MultivariateCyclicVector, NormalForm, NormalSet, RationalUnivariateRepresentation, Reduce, RememberBasis, SPolynomial, Solve, SuggestVariableOrder, Support, TestOrder, ToricIdealBasis, TrailingTerm, UnivariatePolynomial, Walk, WeightedDegree]

(14)

G := {F1, F2, F3, F4, F5, F6};

{0, g1*M2/J1-g2*M1/J1, g2*M3/J3-g3*M2/J1, g3*M1/J1-g1*M3/J3, (1/J1-1/J3)*M1*M3-m*g*x3*g1, (1/J3-1/J1)*M2*M3+m*g*x3*g2}

(15)

B := Basis(G, tdeg(M1, M2, M3, g1, g2, g3))

Error, (in gcd/Freeze) arguments should be polynomials

 

IsBasis(B, tdeg(M1, M2, M3, g1, g2, g3))

Error, invalid input: Groebner:-IsBasis expects its 1st argument, G1, to be of type {list, set}, but received B

 

``

NULL


 

Download 418.mw

I have big expressions containing RootOf() which are however pretty simple.

For example something like

RootOf(x^2+1,x)

Is it possible to convert this later into the actual solution? e.g. +-*I ??

In Maple this works

my_list :=[1,2,3];
my_list[1]:=0;

But this does not

my_set:={1,2,3};
my_set[1]:=0;

gives error "Error, cannot reassign the entries in a set". I suppose it has to do with the fact that sets, mathematically speaking, do not have an "oder" per say? But the elements must be ordered internally as they show, right? So the first element in the set is "1" and the second element in the set is "2", etc...

Had to use the ugly and unatural notation of

my_set := subsop(1=0, my_set)

To change the element of a set. The above implifies an order as well. So why the first did not work, but the above works?

The question is why is this inconsistency of notation?   It is much more natural to write "A[i]:=something". 

If using "subsop(1=0, my_set)" is a must for some reason, then why Can't Maple make a short cut, where if a user types "A[i]:=something" where A is a "set", then it will internally get modified/replaced by "A:=subsop(i=something, A)", so that one can still use the more natural syntax instead?

But it would be better just removing this restriction of using A[i]:=something on a set.

i have a panel case here. Now I have got three 10 by10 data matrix which are x location, y location and z displacements respectively. How can i draw them into a surface plot? and 

how can i draw a displacement contour plot?

Hi all, is there a reliable way to hide/obfuscate the source code of a maple library file (*.mla) (e.g. if you want to redistribute it)?

From what I know, since it has to be into the archive, any not exported (or hidden) procedure can be easily viewed setting kernelopts(opaquemodules=false) or through LibraryTools:-Browse.

First 805 806 807 808 809 810 811 Last Page 807 of 2428