Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Simple question I cannot remember the solution of.

When I import "executable maple input" from a file, the content is imported as a string and therefore have quotation marks around the code if saved in a variable. It therefore wont execute.

How do you defeat quotation marks around  executable maple code with a command in order to execute the code ?

hello dear maple, in the following code (code attached at the bottom )

I'm curious to know if it's possible to show the product of two matrices  in an unevaluated form, so for instance something like this instead of this 

UnEval_Mat.mw

Thanks in advance

This is about functionality introduced in Maple 2022, which however is still not well known: Integral Vector Calculus and parametrization using symbolic (algebraic) vector notation. Four new commands were added to the Physics:-Vectors package, implementing the parametrization of curves, surfaces and volumes, as well as the computation of path, surface and volume vector integrals. Those are integrals where the integrand is a scalar or vector function. The computation is done from any description (algebraic, parametric, vectorial) of the region of integration - a path, surface or volume.
 
There are three kinds of line or path integrals:

NOTE Jan 1: Updated the worksheet linked below; it runs in Maple 2022.
Download Integral_Vector_Calculus_and_Parametrization.mw

Edgardo S. Cheb-Terrab
Physics, Differential Equations and Mathematical Functions, Maplesoft

hello maple world, in the following code (code attached at the bottom) i wish to select the terms which have the term so i used the "select" command for this task

but as u can see from the results it also selects other terms which is wrong. so what is the mistake here

thanks in advance

Physic_select.mw

Hi everyone,

I have been trying to solve a system of 8 differential equations (1st order) with 8 different initial conditions. The system in question is the following.

sys:={

diff(a[0](t), t) - diff(a[1](t), t) + diff(a[2](t), t) - diff(a[3](t), t) = 0,

diff(b[0](t), t) + diff(b[1](t), t) + diff(b[2](t), t) + diff(b[3](t), t) = 0,

diff(a[0](t), t) + diff(a[1](t), t) + diff(a[2](t), t) + diff(a[3](t), t) - diff(b[0](t), t) + diff(b[1](t), t) - diff(b[2](t), t) + diff(b[3](t), t) = 0,

diff(a[1](t), t) + 4*diff(a[2](t), t) + 9*diff(a[3](t), t) - 3*diff(b[1](t), t) + 12*diff(b[2](t), t) - 27*diff(b[3](t), t) = 0,

diff(a[0](t), t) - diff(a[1](t), t)/2 - diff(a[2](t), t)/2 - 16*a[2](t) + diff(a[3](t), t) + 48*a[3](t) = 0,

diff(a[0](t), t) + diff(a[1](t), t)/2 - diff(a[2](t), t)/2 - 16*a[2](t) - diff(a[3](t), t) - 48*a[3](t) = 0,

diff(b[0](t), t) - diff(b[1](t), t)/2 - diff(b[2](t), t)/2 - 48*b[2](t) + diff(b[3](t), t) + 144*b[3](t) = 0,

diff(b[0](t), t) - diff(b[1](t), t)/2 - diff(b[2](t), t)/2 - 48*b[2](t) + diff(b[3](t), t) + 144*b[3](t) = 0}

and the initial conditions are

ics:={a[0](0) = 1/8, a[1](0) = 1/4, a[2](0) = 1/4, a[3](0) = 1/8, b[0](0) = 23/24, b[1](0) = 1/12, b[2](0) = -1/12, b[3](0) = 1/24}

When I run 

sols := dsolve(sys union ics, numeric)

I get the error message

Error, (in DEtools/convertsys) ODE system is insufficient to determine values for all dependent variables in the system

What is happening?

Thanks for the help.

Hey guys. i recently faced a problem where i needed to substitute the "physics's overloaded product operator" , namely with normal matrice product (`.`), so maple can do the matrice product calculation after my non-commutative physics operator(yellow symbols in the following code) has been replaced with real matrices (for instance, this substitution:)

now in order to substitute  with `.` I have utilized the maple `use` command. but the problem is, it doesn't do the substitution when I utilized `use` command as follows (code file is attached at the bottom) :

so what's the mistake here?

thanks in advance

Physic_subs.mw

Let's say we have a velocity vector v := c _i + d _j, where _i and _j are the i hat and j hat Cartesian basis vectors as present in the Physics[Vectors] package.

When we integrate this velocity vector relative to t, the result in maple is the position vector (c _i + d _j)t.

I guess that is correct.

My question is: is there am in-built way to specify an initial position vector for the integration? Ie, can I specify constants in the integration?

Right now I am just doing 

s0 := sx _i + sy _j

s:= int(v, t) + s0

I've been trying to figure out what i_  means in Maple. In what follows is some experimentation and then my questions.

Just a few initial experiments without loading any packages.

i_

i_

(1)

i_ = i_NULL

_i

_i

(2)

_i = _iNULL

D(_i)

D(_i)

(3)

f := proc (t) options operator, arrow; _i end proc

proc (t) options operator, arrow; _i end proc

(4)

D(f)

0

(5)

f := proc (t) options operator, arrow; t*_i end proc

proc (t) options operator, arrow; t*_i end proc

(6)

D(f)

proc (t) options operator, arrow; _i end proc

(7)

D(t*_i)

D(t)*_i+t*D(_i)

(8)

Impression: _i is treated like an algebraic basis vector when the result of a function; but not in an expression.

NULL

with(Physics)

_i

_i

(9)

_i = _iNULL

D(_i)

D(_i)

(10)

f := proc (t) options operator, arrow; t*_i end proc

proc (t) options operator, arrow; Physics:-`*`(t, _i) end proc

(11)

D(f)

proc (t) options operator, arrow; _i end proc

(12)

Nothing really seemed to change with the Physics package being used. However, if we use the following package

with(Physics[Vectors])

_i

_i

(13)

i_

i_

(14)

_i = _iNULL

i_ = i_NULL

In the middle of v__0 := v__x0*_i = v__x0*_i text. Doesn't work as expected.

In the middle of v__0 = v__x0*_i = v__x0*_i = v__x0*_i text.

 

NULL

My question is: is the symbol _i somehow special by default? Where can I find it in the documentation?

Note the second-to-last line in the Maple document pasted above: "Doesn't work as expected". The difference between this line and the next one is simply the presence of a := instead of an =. The assignment makes the vector notation differ. Is this difference a bug or some feature I am unaware of?

Here is yet another behavior that seems kinda weird to me. Given the function f defined above, D(f) gives us the expected result but D(f(x)) does not. Yet, int(f) gives an error, and we have to use int(f(x))

EDIT: a little more research indicates there is a difference between the operator and the function diff. 

Download PhysicsVectors.mw

Reading another question today I discovered that I can use syntax like

a := 2 _i + 3 _j

b:= _i - _j

a+b  

Maple computes the sum by vector component. This is very useful, and it prompted me to start reading the Multivariate Calculus Study Guide. I am still going through it but haven't seen this particular notation yet. When I check the type of above I get a result that sort of looks like `+` but actually it seems to be tilted to the right (so I guess it is italicized and represents some symbol).

What is this type?

I don't find much searching online, and I did see this page that says 

"Any symbol beginning with an underscore (_) is effectively reserved for use only by library code. It is not available to users. Failure to observe this rule can lead to unexpected results."

Edit: After a bit more looking, looks like my example code is using notation available from the Physics package, which I am now reading a bit about (but it is not clear to my why this package is used since I am not importing it explicitly).

I noticed something that seems to be new to my usage of Maple.

As I am typing in an expression in a Maple Worksheet (Document Mode), it seems Maple goes into "Evaluating" for a split second on every new keystroke.

For context, I have my own worksheet open and also the Maple Study Guide open for Multivariate Calculus. But just now I closed it and restarted Maple. A brand new worksheet has this same behavior. 

Did I just miss this before or is it normal for Maple to show "Evaluating" for a split second on every keystroke (instead of just "Ready")?

I just wrote up a bug report (aka "Software Change Request") but got a "We are currently experiencing technical difficulties" error so the report is not being sent.

I will just post here about the bug in case anyone knows what it is.

I am going through the Multivariate Calculus Study Guide. I went to section 1.1, and was going through the examples. At the end of an example is a link "Next Example", but when I click this I get an error and have to go back to section 1.1 Table of Contents. Kind of annoying. Also, I notice that Maple simply crashes seemingly randomly when going through this study guide. Very annoying.

Here is a screenshot of the write-up to the bug report service that isn't working, for the record

I was wondering if this is something wrong with my Maple installation or if other people experience it too.

I was just trying to follow along the Multivariate Calculus Study Guide.

There is an example where we are supposed to plot a "rooted vector". Basically, a vector where the tail is not at the origin.

The commands seemed pretty straightforward but are not generating the expected results. Here is a worksheet with the commands in question

w := VectorCalculus:-RootedVector(root = [-2, 1], `<,>`(1, 2))

Vector[column](%id = 36893488152235632508)

(1)

VectorCalculus:-PlotVector(w, scaling = constrained)

 

VectorCalculus:-PlotVector(w)

 

NULL


Well wouldn't ya know? I am finally able to execute a worksheet in this question box. As you can see there is no vector being displayed. Now, after playing around with the values a bit, it seems that the root that I chose, [-2,1], seems to be the only one that won't work. In particular, the value 1 there seems to be problematic. If I use any other value (including for example 0.9999999), the vector seems to be drawn correctly. 

Why doesn't it work for the original parameters I chose?

Download PlotRootedVector.mw

For instance, given an adjacency matrix: 

convert([[1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
1, 0, 0, 0, 0, 0], [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, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0,
0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0,
0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0,
0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0,
0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0,
0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 0, 0]], Matrix): # adjacency

The desired diagram resembles:

The first one comes from Mathematica; the second one comes from MATLAB.
In MMA, we can use GraphLayout -> "LayeredDigraphEmbedding"; in MatLab, we can use Layout = "layered". Note that overlapping edges should be avoided in a layered plot.

Currently, since the vertices of a 2-D graph can be manually positioned, we can click, drag and place them to embed vertices, route edges, and then get a hierarchical structure as follows:

However, it's just a clumsy and fiddly job. Isn't there a fully automatic and less time-consuming method to do so in Maple?

                                                                                  Théorème de Brianchon
restart; with(plots):unprotect(gamma):
Error, missing operator or `;`
##Si un hexagone est circonscrit à un cercle, les droites qui joignent les sommets opposés passent par un même point.
_EnvHorizontalName := 'x';_EnvVerticalName := 'y';
                    _EnvHorizontalName := x

                     _EnvVerticalName := y

line := proc (x1, y1, x2, y2) options operator, arrow; (x-x1)*(y2-y1)-(y-y1)*(x2-x1) end proc:
R := 3:
ang := [0, (1/3)*Pi, 3*Pi*(1/4)+.2, 7*Pi*(1/6)+.4, 8*Pi*(1/5), 13*Pi*(1/7)]:
for i to 6 do P || i := [R*cos(ang[i]), R*sin(ang[i])] end do:
pts := [seq(P || i, i = 1 .. 6)]:
for i to 6 do tang || i := x*P || i[1]+y*P || i[2] = R^2 end do:
sol:=solve({tang1,tang3},{x,y}):Q13:=[subs(sol,x),subs(sol,y)]:
sol := solve({tang1, tang2}, {x, y}): Q1 := [subs(sol, x), subs(sol, y)]:
sol := solve({tang2, tang3}, {x, y}): Q2 := [subs(sol, x), subs(sol, y)]:
sol := solve({tang3, tang4}, {x, y}): Q3 := [subs(sol, x), subs(sol, y)]:
sol := solve({tang4, tang5}, {x, y}): Q4 := [subs(sol, x), subs(sol, y)]:
sol := solve({tang5, tang6}, {x, y}): Q5 := [subs(sol, x), subs(sol, y)]:
sol := solve({tang1, tang6}, {x, y}): Q6 := [subs(sol, x), subs(sol, y)]:
ptQ := [seq(Q || i, i = 1 .. 6)]:
line14 := line(Q1[1], Q1[2], Q4[1], Q4[2]): L14 := implicitplot(line14, x = -10 .. 10, y = -10 .. 10, color = red):
line25 := line(Q2[1], Q2[2], Q5[1], Q5[2]): L25 := implicitplot(line25, x = -10 .. 10, y = -10 .. 10, color = red):
line36 := line(Q3[1], Q3[2], Q6[1], Q6[2]): L36 := implicitplot(line36, x = -10 .. 10, y = -10 .. 10, color = red):
sol := solve({line14, line25}, {x, y}): I1 := [subs(sol, x), subs(sol, y)]:

lineP23 := line(P2[1], P2[2], P3[1], P3[2]): lineP56 := line(P5[1], P5[2], P6[1], P6[2]):
sol := solve({lineP23, lineP56}, {x, y}): gamma := [subs(sol, x), subs(sol, y)]:
Error, attempting to assign to `gamma` which is protected.  Try declaring `local gamma`; see ?protect for details.
lineP12 := line(P1[1], P1[2], P2[1], P2[2]): lineP45 := line(P4[1], P4[2], P5[1], P5[2]):
sol := solve({lineP12, lineP45}, {x, y}): beta := [subs(sol, x), subs(sol, y)]:
lineP34 := line(P3[1], P3[2], P4[1], P4[2]): lineP16 := line(P1[1], P1[2], P6[1], P6[2]):
sol := solve({lineP16, lineP34}, {x, y}): alpha := [subs(sol, x), subs(sol, y)]:
pl:= line(alpha[1], alpha[2], gamma[1], gamma[2]):
hexa := seq(implicitplot(tang||i, x = -20 .. 20, y = -20 .. 20, linestyle=3,color = blue),i=1..6);
hexa:=plot([seq([P||i,P||(i mod 6)+1],i=1..6),color=green); 
hexa:=plot([seq([P||i,P||(i+1)],i=1..6)],thickness=4,color=green); 
hex:=plot([[Q1,Q2],[Q2,Q3],[Q3,Q4],[Q4,Q5],[Q5,Q6],[Q6,Q1]],thickness=4,color=green);
tp := textplot({seq([op(pts[i]), cat("P", i)], i = 1 .. 6)}, 'align' = {'above', 'left'});
tpq := textplot({seq([op(ptQ[i]), cat("Q", i)], i = 1 .. 6)}, 'align' = {'above', 'left'});
TP:=textplot([[I1[],"I"],[alpha[],"alpha"],[beta[],"beta"],[gamma[],"gamma"]],'align' = {'above', 'left'});
slopes:=[seq(((dx,dy)->dy/dx)((pts[i]-pts[(i mod 6)+1])[]),i=1..6)];
lines:=zip((pt,slope)->y=slope*(x-pt[1])+pt[2],pts,slopes);
plotpts:=plot(pts,style=point,colour=red,symbol=solidcircle,symbolsize=5);
plotptQ:=plot(ptQ,style=point,colour=black,symbol=solidcircle,symbolsize=5);
plotlines:=plot(rhs~(lines),style=line,linestyle=3,colour=magenta);
cir:=implicitplot(x^2+y^2=R^2,x=-R..R,y=-R..R,color=black);
PL:=implicitplot(pl,x=-1..15,y=-15..6,color=blue,thickness=3);

 hexa := implicitplot(tang1, x = -20 .. 20, y = -20 .. 20, 

   linestyle = 3, color = blue), implicitplot(tang2, 

   x = -20 .. 20, y = -20 .. 20, linestyle = 3, color = blue), 

   implicitplot(tang3, x = -20 .. 20, y = -20 .. 20, 

   linestyle = 3, color = blue), implicitplot(tang4, 

   x = -20 .. 20, y = -20 .. 20, linestyle = 3, color = blue), 

   implicitplot(tang5, x = -20 .. 20, y = -20 .. 20, 

   linestyle = 3, color = blue), implicitplot(tang6, 

   x = -20 .. 20, y = -20 .. 20, linestyle = 3, color = blue)


Error, `)` unexpected
display(plotpts,plotptQ,plotlines,hex,cir,L14,L25,L36,PL,tp,tpq,TP,axis = [gridlines = [4, color = blue]],
view=[-6..10,-15..6],scaling=constrained,axes=none,size=[800,800]);
display(plotpts, plotptQ, plotlines, hex, cir, 

  implicitplot(0, x = -10 .. 10, y = -10 .. 10, color = red), 

  implicitplot(0, x = -10 .. 10, y = -10 .. 10, color = red), 

  implicitplot(0, x = -10 .. 10, y = -10 .. 10, color = red), PL, 

  tp, tpq, TP, axis = [gridlines = [4, color = blue]], 

  view = [-6 .. 10, -15 .. 6], scaling = constrained, 

  axes = none, size = [800, 800])


NULL;
I don’t know how to correct those mistakes. Thank you to help me.

Hello everybody. 

Im working on some implicit differentiation math right now. And by following the example, it is not bringing me anywhere close to the right answer. 

In English it says: Given the implicit written function x^2-2*x*y+2*y^2=12. Determine the local maximum and/or minimum of y and x. 

The answer (as can be seen in the maple file), is for y between 2sqrt3 and -2sqrt3, and -2sqrt6 and 2sqrt6. 

The example clearly states in the solution (oplossing), that the dy/dx needs to be derived for x. But after doing that, and filling in the equation the same way the example is doing it, im not getting to the rigth answer, but -sqrt3/24, and that doesnt look like the right answer


 

#Opdracht 4

x^2-2*x*y+2*y^2-12

x^2-2*x*y+2*y^2-12

(1)

diff(x^2-2*x*y+2*y^2-12, x)

2*x-2*y

(2)

diff(x^2-2*x*y+2*y^2-12, y)

-2*x+4*y

(3)

solve(x^2-2*x^2+2*x^2-12 = 0, x)

2*3^(1/2), -2*3^(1/2)

(4)

"f(x,y):=x^(2)-2*x*y+2*y^(2)-12"

proc (x, y) options operator, arrow, function_assign; x^2-2*y*x+2*y^2-12 end proc

(5)

dy/dx = -(2*x-2*y)/(-2*x+4*y)

dy/dx = -(2*x-2*y)/(-2*x+4*y)

(6)

simplify(%)

dy/dx = (x-y)/(x-2*y)

(7)

x^2-2*x*y+2*y^2-12

smartplot[x, y](x^2-2*x*y+2*y^2-12 = 0)

 

 

evalf(2*sqrt(3))

3.464101616

(8)

(x-y)/(x-2*y)

diff((x-y)/(x-2*y), x)

1/(x-2*y)-(x-y)/(x-2*y)^2

(9)

simplify(%)

-y/(x-2*y)^2

(10)

-2*sqrt(3)/(2*sqrt(3)*0-(2*2)*sqrt(3))^2

-(1/24)*3^(1/2)

(11)

evalf(%)

-0.7216878367e-1

(12)

``

Thank you for your time!

Greetings,

The Function

Download Mapleprimes_Question_Book_2_Paragraph_5.9_Question_4.mw

First 245 246 247 248 249 250 251 Last Page 247 of 2218