MaplePrimes Questions

In the following code,  

Although the lines in the figure include asterisk or points, the symbols don't appear in the legends.

 

restart:
f1:=x->x^2:
f2:=x->x^2-0.08:
N:=10: ptsize:=8: th:=1:
(a,b) := 0,2:
p1:=plot(f1(x),x=a..b,color=red,thickness=th,legend=f1(x),style=pointline,symbol=solidcircle,symbolsize=ptsize,adaptive=false,numpoints=N+1):
p2:=plot(f2(x),x=a..b,color=blue,thickness=th,legend=f2(x),style=pointline,symbol=asterisk,symbolsize=ptsize+4,adaptive=false,numpoints=N+1):

plots:-display(p1,p2);

 

 

For example; what is your method for showing asterisk, point etc. in the legends as in the following picture?

Hello!

I would appreciate any help on how to do computations on Maple of the following problem. 

Say we have 3 generators x,y,z and I define a map on polynomials in three variables over rational numbers L: Q[x,y,z] -> Q[x,y,z] on the generators, for example L(x)=xy, L(y)=1, L(z)=z^2. 

Then I need to compute L(xy+yz) and it needs to compute it using linearity and derivation (Leibniz rule):

L(x)y+xL(y)+L(y)z+yL(z)=xy^2+x+z+yz^2. 

 

I have in mind a recursive algorithm but I don't know enough syntacsys to implement it. 

P.S.: I need to compute Poisson brackets on a polynomial algebra for which there is no special way of doing it, right? So I though it must be easier for each basis element to come up with a linear map and extend it via derivations to know its action. 

Hi,

I was trying to differentiate an equation with two random variables with respect to my decision variable. But it took 4-5 hrs still MAPLE could not evaluate nor show an error.

 Later I want to find q* from the FOC and wish to substitute it back into the equation. I will be grateful if someone please help me in doing both.

doubt_1.mw

Thanks in Advance

I think Maple is wrong here. But may be someone could show me how it is correct?

Maple says this ode (below) is of type d'Alembert. But I am not able to show this. It is impossible for me to put this ode in _dAlembert. form. So I gave up.

https://www.maplesoft.com/support/help/Maple/view.aspx?path=odeadvisor/dAlembert

The challenge then is to put the following first order ODE in the above form to show it is dAlembert.

I could not do it. I worked on this by hand and not possible to get the ODE in the above form. Could someone show this?

restart;
ode:=3*x^2*y(x)^3+y(x)^4+(3*x^3*y(x)^2+4*x*y(x)^3+y(x)^4)*diff(y(x),x) = 0;
DEtools:-odeadvisor(ode);

The first thing I do when I want to show this, is to solve for y(x) from the ode. Since I can't use solve on an ode, I start by replacing all the diff(y(x),x) with say p. Then now solve for y(x). If it is dAlembert, then it should give expression that be put in the form    y(x)=x*f(p) + g(p). Notice that the functions f(p) and g(p) are functions of p only and not of x. This is important.  And f(p) is multiplied by linear term and not x^(3/2) or x^(1/2), etc... The term multiplying f(p) has to be linear in x.

ode:=subs(diff(y(x),x)=p,ode):
sol:=[PDEtools:-Solve(ode,y(x))];

Looking at second and third solutions. None of them is dAlembert.  This can be shown by either simplyfing it with assumptions, where not possible to obtain the needed form, or by simply replacing p back with diff(y(x),x) and asking advisor for the type of the resulting ode

DEtools:-odeadvisor( subs(p=diff(y(x),x),sol[2]));
DEtools:-odeadvisor(subs(p=diff(y(x),x),sol[3]));

So none is d'Alembert.

Question is: Could someone may be proof that this ode is d'Alembert? By putting it in the form   y(x)=x*f(p)+g(p)? Or is advisor is wrong here?

ps. I tried infolevel[DEtools:-odeadvisor]:=4 to try to trace it, but it does not work.

pps. I worked this out by hand, and I get 

                y(x)= x^(3/2)*f(p)  where f(p) = sqrt(-12 p^2)+sqrt(12*p)

And this is not d'Alembert.

 

clc;clear;
% Define i1(t) and i2(t) as symbolic variable
syms i1(t) i2(t)

% Given differential equation
ode1 = diff(i1) == 0.5*i1 + -3*i2 +5*exp(-2*t);
ode2 = diff(i2) == 2*i1 - 6*i2;
odes = [ode1; ode2];

% Define initial conditions
cond1 = i1(0) == 1;
cond2 = i2(0) == -1;
conds = [cond1; cond2];

% Solution of system of differential equation
[i1(t), i2(t)] = dsolve(odes,conds)

fplot(i1(t))
hold on
fplot(i2(t))
legend('i1(t)','i2(t)')

Output:

i1(t) =
exp((t*(73^(1/2) - 11))/4)*(73^(1/2)/8 + 13/8)*((57*73^(1/2))/292 - exp((3*t)/4 - (73^(1/2)*t)/4)*((15*73^(1/2))/292 + 5/4) + 3/4) - exp(-(t*(73^(1/2) + 11))/4)*(73^(1/2)/8 - 13/8)*(exp((3*t)/4 + (73^(1/2)*t)/4)*((15*73^(1/2))/292 - 5/4) + (3*73^(1/2)*(73^(1/2) - 19))/292)


i2(t) =
exp(-(t*(73^(1/2) + 11))/4)*(exp((3*t)/4 + (73^(1/2)*t)/4)*((15*73^(1/2))/292 - 5/4) + (3*73^(1/2)*(73^(1/2) - 19))/292) + exp((t*(73^(1/2) - 11))/4)*((57*73^(1/2))/292 - exp((3*t)/4 - (73^(1/2)*t)/4)*((15*73^(1/2))/292 + 5/4) + 3/4)

Hi everyone,

I'm new with maple and i want to evaluate this expresssion :

f := x -> exp((-1)*0.13/x)[0.4700036292*`–`(0.3364722366, 1.2)] + exp(-1/x)[0.2135277634 + 0.528*x] + (-1)*0.528*x + 0.5420043550 = 0 ..

i Have try fsolve (f, x) but with no result..

I don't know if someone have a solution for that kind of problems..

thank in advance 

I was just using odeadvisor to check type of some ode's, when I noticed it gives 

             Error, (in ODEtools/radnormal) numeric exception: division by zero

on ode's of form y(x)=x*diff(y(x),x)^n+x^2

for different n:

restart;
for n from -5 to 5 do
    if n<>0 then
       try
          ode:=y(x)=x*diff(y(x),x)^(n)+x^2;
          DEtools:-odeadvisor(ode);
          print("n=",n,"OK, no error");
       catch:
          print("n=",n,StringTools:-FormatMessage( lastexception[2..-1] ));
       end try;
    fi;
od;

Is this known issue and is expected?

Maple 2020.2 on windows 10


 

I am getting this error. Is this expected or known issue?  

restart;
sol:=-csgn(1, 1/(_C1*a - _C1*x - 1))*_C1*a^4/((k + 1)*(_C1*a - _C1*x - 1)^2) + 4*csgn(1, 1/(_C1*a - _C1*x - 1))*_C1*a^3*x/((k + 1)*(_C1*a - _C1*x - 1)^2) - 6*csgn(1, 1/(_C1*a - _C1*x - 1))*_C1*a^2*x^2/((k + 1)*(_C1*a - _C1*x - 1)^2) + 4*csgn(1, 1/(_C1*a - _C1*x - 1))*_C1*a*x^3/((k + 1)*(_C1*a - _C1*x - 1)^2) - csgn(1, 1/(_C1*a - _C1*x - 1))*_C1*x^4/((k + 1)*(_C1*a - _C1*x - 1)^2) + a^2/((k + 1)*(_C1*a - _C1*x - 1)^2) - 2*a*x/((k + 1)*(_C1*a - _C1*x - 1)^2) + x^2/((k + 1)*(_C1*a - _C1*x - 1)^2) + csgn(1, 1/(_C1*a - _C1*x - 1))*a^3/((k + 1)*(_C1*a - _C1*x - 1)^2) - 3*csgn(1, 1/(_C1*a - _C1*x - 1))*a^2*x/((k + 1)*(_C1*a - _C1*x - 1)^2) + 3*csgn(1, 1/(_C1*a - _C1*x - 1))*a*x^2/((k + 1)*(_C1*a - _C1*x - 1)^2) - csgn(1, 1/(_C1*a - _C1*x - 1))*x^3/((k + 1)*(_C1*a - _C1*x - 1)^2) - csgn(1/(_C1*a - _C1*x - 1))*a^2/((k + 1)*(_C1*a - _C1*x - 1)^2) + 2*csgn(1/(_C1*a - _C1*x - 1))*a*x/((k + 1)*(_C1*a - _C1*x - 1)^2) - csgn(1/(_C1*a - _C1*x - 1))*x^2/((k + 1)*(_C1*a - _C1*x - 1)^2);

solve( simplify(sol)=0,x,allsolutions = true) assuming real; #also x::real, same error

Maple 2020.2 on winsows 10. Physics 897

 

 

The following command returned 1026 instead of 1000 samples. Any ideas why?

R1 := Sample(Normal(0, 1), 1000);
length(R1);
 

Thanks

restart; with(plots):unprotect(gamma):
_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)]:
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):
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]):
How to simplify this program ? Thank you.

Should dsolve has missed this solution? I used singsol=all option:

restart;
ode:=y(x)^2+(x^2+x*y(x))*diff(y(x),x) = 0;
dsolve(ode,y(x),singsol=all)

But y(x)=0 is singular solution. It can not be obtained from the above general solutions for any constant of integration value.

odetest(y(x)=0,ode)

                 0

if I change the type of ode, Maple now gives y(x)=0 but the general solution is too complicated (which is OK) but the point is that it does now find y(x)=0.

dsolve(ode,y(x),[dAlembert]);


           y(x)=0,  etc.....

my question is: Why singsol=all did not also give y(x)=0 in this example?  Is there something I am misundertanding here?

Maple 2020.2

I've been struggling to implement a more complicated version of the example from Acer here:
    https://www.mapleprimes.com/questions/231110-Typesetting-In-Plots-

The basic idea is that Maple allows XML for typesetting (and maybe MathML? I don't use the MLs, so I can't speak to limitations or differences).

It's somewhat straightforward, but extremely tedious. The statement that this is " undocumented, but not overly difficult " may be true, but it's time-consuming to learn bits and pieces of any additional language just to typeset something that resembles extremely common typesetting language, and frankly feels like a waste of time. In a world where we have LaTeX, I don't see why Maple can't use LaTeX language for typesetting in plots. Python, MatLAB have this feature, and a homebrew version of this for Mathematica came up during my searching, but nothing useful for Maple. The Physics package  has some function to take the Maple and produce LaTeX code (untested by me so far), but not being able the other direction to typeset axes, titles, and textplots with LaTeX notation is shocking to me.

When one attempts the tag formating from html/XML like here:
  https://www.maplesoft.com/support/help/Maple/view.aspx?path=MathML
or formatting, errors come up. Basic things like having control over a given character's size seem impossible without the tag formatting, and I tried for some time to get all sorts of variations of #mstyle to work using the syntax method of the linked question. The converters that I've found that go from LaTeX to MathML use this tag formatting.

Here are some examples that I made up to demonstrate acer's method and one particular area where the MathML spectactularly fails compared to LaTeX, and included to (current as of this moment) links that give element names for XML and symbol names for html/xml:
https://developer.mozilla.org/en-US/docs/Web/MathML/Element
https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references

MapleXMLExamples.mw

The contents are failing to be inserted, but the file downloads correctly from the preview for me.

Hi

A user with a new install of maple 2020 is unable to plot graphs. they get the output seen in the attached image. I mostly provide desktop support and i'm not too familiar with Maple, so i'm reaching out for assistance. Thanks in advance.

I just had enough with odetest hanging (even when using with timelimit). I wait hours and hours each time (even though I have 30 second timelimit, which Maple ignores) and I do not think Maplesoft is going to fix this in my lifetime.  

So I am attempting to make my own very simple and basic odetest.

I give it an ode and explicit solution in for form sol:= y(x)=... and the function uses algsubs(sol,ode) and checks it is gets zero or not (it will also do simplify if needed)

But there is a BIG problem.   Even though algsubs(z=0,z/z);  gives back 1 as expected,  but

restart;
ode:=diff(y(x), x)/y(x);
sol:=y(x)=0;

algsubs(sol,ode);   #this gives ZERO. It should be 1

If we do algsubs on each term one by one

algsubs(sol,numer(ode));
algsubs(sol,denom(ode));

            0
            0

So why did algsubs give zero in the first case, since  the result of the algsubs should be 0/0 which algsubs knows in the limit it is 1?   How did it come up with zero?

Clearly my simple method of replacing odetest with algsubs is not working. I need a more robust way to handle this.

subs does not work. Since subs does not know how substitute y(x)=f(x) into derivatives involved in an ODE.

My question is: Is there a way to teach algsubs to give 1 for the above example? or better function to use?

I tried applyrule instead of algsubs, but that does not work.

applyrule(sol, ode)

Error, (in rec) numeric exception: division by zero
 

Is there a better method to use? I am trying to do simple version of odetest that does not hang. Even if not perfect. Will only use it for explicit solutions, not implicit since implicit is much harder.

Here is a more full example

ode:=diff(y(x),x)^2+2*x*diff(y(x),x)/y(x)-1 = 0;
sol:=y(x)=0;
odetest(sol,ode)

                            0

But when I use my simple method

ode:=diff(y(x),x)^2+2*x*diff(y(x),x)/y(x)-1 = 0;
sol:=y(x)=0;
algsubs(sol,ode);

                          -1 = 0

The reason it failed, because algsubs replaced the second term by 0 instead of 1. The second term in the ode is diff(y(x),x)/y(x)

Which is 0/0 but this is 1 in the limit. But algsubs used 0 instead for some reason.

So I need a little bit smarter way to replace my solution into the ode than just using algsubs. May need to use some of the tricks I've seen used here before using freez/thaw/frontend, etc.. which I still do not understand.

Any recommendation?  This is meant to work for any single ode and any explicit solution of the form y(x)=....

This algsubs method works actually pretty well on many ode's. I've tested it on 2,000 ode's. It just fails so far on subtle ones like the above. Here is just random example where it works

restart;
ode:=diff(y(x),x)^2 = (-x+1)/x;
sol:=y(x)=_C1+arcsin(2*x-1)/2+sqrt(x-x^2);

evalb(simplify(algsubs(sol,ode)))

                     true

So I just need a way to handle the cases where it gives 0/0 I think. I have 20 ODE's which now fail out of about 2,000 using this basic method compared to using odetest.

 

Thank you

First 427 428 429 430 431 432 433 Last Page 429 of 2401