Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

I have a problem in plotting bellow function. actually because my main program is not working so I decided to do it in simple way. I found that my program in maple can't plot the function I introduced it as a procudure and is an implicit function. can you help me please?

>EQ := proc(x, t) local y, m, func;
                 m := 3;
                 func := m*x^2 + t*y^2 = 4;
          end proc;


>eq := EQ(x, 10);                              
                     eq := 3*x^2  + 10*y^2  = 4

>implicitplot(eq, x = -1 .. 1, y = 0 .. 2)
 Error, (in plots/implicitplot) invalid input: the following extra unknowns were found in the input expression: {y}
 

 

Given this "pattern" to transfporm an expression into an arrow procedure

e := 1/b:
f := unapply(e, b):
f(3)
                               1
                               -
                               3

I would like now to use this same "pattern" to transform an expression e which depends on 2 indeterminates a and b into a "double layered arrow procedure" f.
Here is a notional example

e := a/b:
f := unapply(unapply(e, b), a);
                     a
           a -> b -> -
                     b

 f(A)(B)
                              a  
                              -
                              B  

How can I proceed in order that f(A)(B) gives A/B ?

TIA

I was surprised to learn that implicitplot doesn't recognize the constant Pi.  I attach a simple example to illustrate.

restart

with(plots)

f := x-y-Pi

x-y-Pi

(1)

implicitplot(f)

Error, (in plots/implicitplot) found 3 variables that the expression depends on ({Pi, x, y}), but expected only 2

 

evalf(Pi)

3.141592654

(2)

g := x-y-3.14

x-y-3.14

(3)

implicitplot(g)

 

NULL

Download implicitplot_error.mw

dgdx := (x, T) -> diff(g(x, T), x);

g := (x, T) -> T*x + x^2;#just an example

dgdx(1, 2);
Error, (in dgdx) invalid input: diff received 1, which is not valid for its 2nd argument

So, I like to introduce a new function dgdx(x,T) from the x-derivative of g(x,T) but if I insert a value for x I get an error message. It would be great if you can help me out!

Maple Learn is an incredibly powerful tool for math and plotting, but it is made even more powerful when used in combination with Maple! Using scripting tools in Maple, we can make use of hundreds of commands that can solve complex problems for us. In the example of the Lagrange calculator, we are able to use the Maple command LagrangeMultipliers to generate a plot of the two functions and the critical points, even including text feedback about the points.


Something like this seems like it would take hours and a lot of coding knowledge to create, but a simple Maple command generates the entire plot for us! Then, all we had to do was use a button to update the plot. Give it a try yourself in Maple, run the following command with two functions f and g of your choosing:

That’s all there is to it! We now have a complex 3D plot showing the Lagrange problem, something that can be difficult to visualize in multivariate calculus. If we want detailed feedback about the Lagrange problem values, simply change output to detailed from plot:



Check out the entire Maple document (.mw file) to see how the Learn page was generated and to try things out for yourself. This entire document uses the LagrangeMultipliers command, but Maple has hundreds more to experiment with, so the possibilities are virtually limitless!

Share your creations here on MaplePrimes and tag us in your posts.

Maple Learn Document: 
https://learn.maplesoft.com/doc/lagrange-multipliers-calculator-1biue2ben9

Maple .mw file: https://maple.cloud/app/6546482431000576/LagrangeCalc

Perhaps a silly question but is it possible to stack two dataframe columns? When I use the Vector command the columns are stacked but nested.

Thank you for your help

5_6190449716501677775.pdf

I ahve a signal y_a to which adding mu(t) doesn't seem to give any plot but error , what is missing here?.

And also in second k(x,t) pdf file I want the value of k(x,t) after I did the integration. When I type k(x,t) and hit enter it's not giving me the value of k(x,t) but returns k(x,t) as it is.K(x_t).pdf

I do not remember now if this was asked before. Doing search here is hard. 

But I am trying this now on 2022.1 and this gives FAIL.

What is the correct syntax to use odetest to verify solution to ode using series method with expansion around infinity? Why do I get FAIL here?
 

interface(version)

`Standard Worksheet Interface, Maple 2022.1, Windows 10, May 26 2022 Build ID 1619613`

Physics:-Version()

`The "Physics Updates" version in the MapleCloud is 1257 and is the same as the version installed in this computer, created 2022, June 22, 16:27 hours Pacific Time.`

restart;

ode:=x^3*diff(y(x),x$2)+x^2*diff(y(x),x)+y(x)=0;
sol:=dsolve(ode,y(x),'series',x=infinity);
odetest(sol,ode,'series','point'=infinity)

x^3*(diff(diff(y(x), x), x))+x^2*(diff(y(x), x))+y(x) = 0

y(x) = _C1*(1-1/x+(1/4)/x^2-(1/36)/x^3+(1/576)/x^4-(1/14400)/x^5+O(1/x^6))+_C2*(ln(1/x)*(1-1/x+(1/4)/x^2-(1/36)/x^3+(1/576)/x^4-(1/14400)/x^5+O(1/x^6))+2/x-(3/4)/x^2+(11/108)/x^3-(25/3456)/x^4+(137/432000)/x^5+O(1/x^6))

Warning, unable to compute series necessary to test the given solution

FAIL

 


 

Download odetest_series.mw

Update

I've testsed methods given below on 6 random ode's using Maple odetest, VV method and Axel method. THis is the result obtained using Maple 2022.1 

odetest was able to verify the solution zero out of 6 times.
VV method was able to verify the solution 3 out of 6 times.
Axel method was able to verify the solution 5 out of 6 times.

So based on this small test, Axel method seems to do the best. Attached worksheet. I will use this method to verify my series solution to ode's instead of Maple's odetest but will use Maple's odetest for non-series method solutions.


 

interface(version);

`Standard Worksheet Interface, Maple 2022.1, Windows 10, May 26 2022 Build ID 1619613`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1257 and is the same as the version installed in this computer, created 2022, June 22, 16:27 hours Pacific Time.`

restart;

Example 1  Regular singular point. Complex roots

 

Order:=6;
ode:=sin(x)*diff(y(x),x$2)+cos(x)*diff(y(x),x)+1/x*y(x)=0;
sol:=dsolve(ode,y(x),type='series',x=0)

6

sin(x)*(diff(diff(y(x), x), x))+cos(x)*(diff(y(x), x))+y(x)/x = 0

y(x) = _C1*x^(-I)*(series(1+(1/48-(1/16)*I)*x^2+(1/57600-(217/57600)*I)*x^4+O(x^6),x,6))+_C2*x^I*(series(1+(1/48+(1/16)*I)*x^2+(1/57600+(217/57600)*I)*x^4+O(x^6),x,6))

VV method

 

odetest(sol,ode):
asympt(%,x);

Error, (in asympt) unable to compute series

odetest method

 

odetest(sol,ode,'series','point'=0);

y(x) = _C1*x^(-I)*(series(1+(1/48-(1/16)*I)*x^2+(1/57600-(217/57600)*I)*x^4+O(x^6),x,6))+_C2*x^I*(series(1+(1/48+(1/16)*I)*x^2+(1/57600+(217/57600)*I)*x^4+O(x^6),x,6))

y(t) = _C1*t^(-I)*(series(1+(1/48-(1/16)*I)*t^2+(1/57600-(217/57600)*I)*t^4+O(t^6),t,6))+_C2*t^I*(series(1+(1/48+(1/16)*I)*t^2+(1/57600+(217/57600)*I)*t^4+O(t^6),t,6))

Axel method

 

rhs(sol):
Y:= unapply(%, x):
eval(lhs(ode), y=Y):
MultiSeries:-asympt(%, x):
convert(%,polynom);

0

Example 2 Regular singular point. Dierence is integer

 

Order:=6;
ode:=sin(x)*diff(y(x),x$2)+cos(x)*y(x)=0;
sol:=dsolve(ode,y(x),type='series',x=0):

6

sin(x)*(diff(diff(y(x), x), x))+cos(x)*y(x) = 0

VV method

 

odetest(sol,ode):
asympt(%,x);
convert(%,polynom);

O(x^7)

0

odetest method

 

odetest(sol,ode,'series','point'=0);

Warning, unable to compute series necessary to test the given solution

FAIL

y(t) = _C1*t^(-I)*(series(1+(1/48-(1/16)*I)*t^2+(1/57600-(217/57600)*I)*t^4+O(t^6),t,6))+_C2*t^I*(series(1+(1/48+(1/16)*I)*t^2+(1/57600+(217/57600)*I)*t^4+O(t^6),t,6))

Axel method

   

rhs(sol):
Y:= unapply(%, x):
eval(lhs(ode), y=Y):
MultiSeries:-asympt(%, x):
convert(%,polynom);

0

Example 3 Regular singular point. Repeated root

 

Order:=6;
ode:=(exp(x)-1)*diff(y(x),x$2)+exp(x)*diff(y(x),x)+y(x)=0;
sol:=dsolve(ode,y(x),type='series',x=0):

6

(exp(x)-1)*(diff(diff(y(x), x), x))+exp(x)*(diff(y(x), x))+y(x) = 0

VV method

 

odetest(sol,ode):
asympt(%,x):
convert(%,polynom);

0

odetest method

 

odetest(sol,ode,'series','point'=0);

Warning, unable to compute series necessary to test the given solution

FAIL

y(t) = _C1*t^(-I)*(series(1+(1/48-(1/16)*I)*t^2+(1/57600-(217/57600)*I)*t^4+O(t^6),t,6))+_C2*t^I*(series(1+(1/48+(1/16)*I)*t^2+(1/57600+(217/57600)*I)*t^4+O(t^6),t,6))

Axel method

   

rhs(sol):
Y:= unapply(%, x):
eval(lhs(ode), y=Y):
MultiSeries:-asympt(%, x):
convert(%,polynom);

0

Example 4 Regular singular point. Repeated root

 

Order:=6;  
ode:=(exp(x)-1)*diff(y(x),x$2)+exp(x)*diff(y(x),x)+y(x)=0;
sol:=dsolve(ode,y(x),type='series',x=0):

6

(exp(x)-1)*(diff(diff(y(x), x), x))+exp(x)*(diff(y(x), x))+y(x) = 0

VV method

 

odetest(sol,ode):
asympt(%,x):
convert(%,polynom);

0

odetest method

 

odetest(sol,ode,'series','point'=0);

Warning, unable to compute series necessary to test the given solution

FAIL

y(t) = _C1*t^(-I)*(series(1+(1/48-(1/16)*I)*t^2+(1/57600-(217/57600)*I)*t^4+O(t^6),t,6))+_C2*t^I*(series(1+(1/48+(1/16)*I)*t^2+(1/57600+(217/57600)*I)*t^4+O(t^6),t,6))

Axel method

   

rhs(sol):
Y:= unapply(%, x):
eval(lhs(ode), y=Y):
MultiSeries:-asympt(%, x):
convert(%,polynom);

0

Example 5 . Regular singular point. Complex roots

 

Order:=6;  
ode:=x^3*diff(y(x),x$2)+sin(x^3)*diff(y(x),x)+x*y(x)=0;
sol:=dsolve(ode,y(x),type='series',x=0):

6

x^3*(diff(diff(y(x), x), x))+sin(x^3)*(diff(y(x), x))+x*y(x) = 0

VV method

 

odetest(sol,ode):
asympt(%,x);
#convert(%,polynom);

Error, (in asympt) unable to compute series

odetest method

 

odetest(sol,ode,'series','point'=0);

Error, (in odetest/series) need to determine the sign of I*3^(1/2)

y(t) = _C1*t^(-I)*(series(1+(1/48-(1/16)*I)*t^2+(1/57600-(217/57600)*I)*t^4+O(t^6),t,6))+_C2*t^I*(series(1+(1/48+(1/16)*I)*t^2+(1/57600+(217/57600)*I)*t^4+O(t^6),t,6))

Axel method

   

rhs(sol):
Y:= unapply(%, x):
eval(lhs(ode), y=Y):
MultiSeries:-asympt(%, x):
#convert(%,polynom);

Error, (in MultiSeries:-multiseries) need to determine the sign of -I*3^(1/2)

Example 6 . Regular singular point. Complex roots

 

Order:=6;  
ode:=x^2*diff(y(x),x$2)+x*diff(y(x),x)+(x+1)*y(x)=0;
sol:=dsolve(ode,y(x),type='series',x=0):

6

x^2*(diff(diff(y(x), x), x))+x*(diff(y(x), x))+(x+1)*y(x) = 0

VV method

 

odetest(sol,ode):
asympt(%,x);
#convert(%,polynom);

Error, (in asympt) unable to compute series

odetest method

 

odetest(sol,ode,'series','point'=0);

y(x) = _C1*x^(-I)*(series(1+(-1/5-(2/5)*I)*x+(-1/40+(3/40)*I)*x^2+(3/520-(7/1560)*I)*x^3+(-1/2496+(1/12480)*I)*x^4+(9/603200+(1/361920)*I)*x^5+O(x^6),x,6))+_C2*x^I*(series(1+(-1/5+(2/5)*I)*x+(-1/40-(3/40)*I)*x^2+(3/520+(7/1560)*I)*x^3+(-1/2496-(1/12480)*I)*x^4+(9/603200-(1/361920)*I)*x^5+O(x^6),x,6))

y(t) = _C1*t^(-I)*(series(1+(1/48-(1/16)*I)*t^2+(1/57600-(217/57600)*I)*t^4+O(t^6),t,6))+_C2*t^I*(series(1+(1/48+(1/16)*I)*t^2+(1/57600+(217/57600)*I)*t^4+O(t^6),t,6))

Axel method

   

rhs(sol):
Y:= unapply(%, x):
eval(lhs(ode), y=Y):
MultiSeries:-asympt(%, x):
convert(%,polynom);

0

 

 


 

Download test_new_odetest.mw

 

 

 

What is the [explict] relation between Maple's WeierstrassP and Weierstrass' P-function (e.g. https://en.wikipedia.org/wiki/Weierstrass_elliptic_function) ?

pdf.mw
 

with(stats)

"f(x):=statevalf[pdf,normald[0,2*4.47]]  "

proc (x) options operator, arrow, function_assign; statevalf[pdf, normald[0, 2*4.47]] end proc

(1)

plot(f(x), -20 .. 20)

 

int(x*f(x), x)

.5000000000*x^2*statevalf[pdf, normald[0, 8.94]]

(2)

NULL


 

Download pdf.mw

Want to integrate x*f(x) where x is from -20..20, I am expecting a pure float number but getting symbols like statevalf_pdf in answer.

 

I am using some custom procedures which return error messages if something doesn´t work as planned and would need to make a distinction (when using try..catch) between these errors and all the other potential error messages Maple can return. Is there a way to do this efficiently - without having to list all of the error messages from my own procedures after catch?

Hello Everyone;

Hope you are fine. My problem is convert into nonlinear system of ODE's and further i need make the code of apply rk-4 for the formulated ODE's. Kindly guide me. The file is attached. I am waiting for your kind response.

Thanks

Question3.mw

 


 

restart

``

var111 := [C[1, 1](t), C[1, 2](t), C[1, 3](t), C[2, 1](t), C[2, 2](t), C[2, 3](t), C[3, 1](t), C[3, 2](t), C[3, 3](t), ZETA[1](t), ZETA[2](t), ZETA[3](t)]:

sysM := [diff(C[1, 1](t), t) = -(3/16)*Pi*(C[2, 1](t)+4*C[1, 1](t)), diff(C[1, 2](t), t) = -5*Pi*(C[2, 2](t)+4*C[1, 2](t)), diff(C[1, 3](t), t) = -(945/4)*Pi*(C[2, 3](t)+4*C[1, 3](t)), diff(C[2, 1](t), t) = -(1/8)*Pi*(C[3, 1](t)+6*C[2, 1](t)+6*C[1, 1](t)), diff(C[2, 2](t), t) = -10.4719755119659774615421446110*C[3, 2](t)-62.8318530717958647692528676658*C[2, 2](t)-62.8318530717958647692528676658*C[1, 2](t)-2.38361014507273884349657421134*10^15*ZETA[1](t)*C[1, 1](t), diff(C[2, 3](t), t) = -494.800842940392435057866332869*C[3, 3](t)-2968.80505764235461034719799721*C[2, 3](t)-2968.80505764235461034719799721*C[1, 3](t)-1.35954060126371030332767566128*10^16*ZETA[1](t)*C[1, 2](t)-1.35954060126371030332767566128*10^16*ZETA[2](t)*C[1, 1](t), diff(C[3, 1](t), t) = -(3/8)*Pi*(2*C[3, 1](t)+3*C[2, 1](t)), diff(C[3, 2](t), t) = -62.8318530717958647692528676658*C[3, 2](t)-94.2477796076937971538793014986*C[2, 2](t)-1.12625579354686910355213131486*10^17*ZETA[1](t)*C[2, 1](t), diff(C[3, 3](t), t) = -2968.80505764235461034719799721*C[3, 3](t)-4453.20758646353191552079699581*C[2, 3](t)-6.42382934097103118322326749959*10^17*ZETA[1](t)*C[2, 2](t)-6.42382934097103118322326749959*10^17*ZETA[2](t)*C[2, 1](t), diff(ZETA[1](t), t) = -(1/3)*C[2, 1](t), diff(ZETA[2](t), t) = -(1/3)*C[2, 2](t), diff(ZETA[3](t), t) = -(1/3)*C[2, 3](t)]:

ICS := [C[1, 1] = 0.998238989835086492681507032141e-1, C[1, 2] = -0.137051161872492529218951625903e-1, C[1, 3] = -0.629146365720807620696267926206e-2, C[2, 1] = 0.923300332435106257640735267282e-1, C[2, 2] = -0.126762613568515069966837491839e-1, C[2, 3] = -0.581915808273854734025727975244e-2, C[3, 1] = -0.190143920352772604950256237747e-1, C[3, 2] = 0.261054171122321128306306984717e-2, C[3, 3] = 0.119839394846335068333097530793e-2, ZETA[1] = .464598743230343884242076682299, ZETA[2] = .429720916976380440572769663279, ZETA[3] = -0.884964696113332752036741498040e-1]:

``


 

Download Question3.mw

The worksheet here shows a couple of failed attempts at coaxing Maple to calculate the general solution of a pretty simple second order ODE.  I have also included the expected solution which I  have calculated by hand.  Perhaps I am missing a key trick.  Any ideas?

The ODE that I am actually interested in is significantly more complex. The one in the worksheet is a much simplified "bare bones" specimen that exhibits the issue that I am facing.

Attempt to solve with Heaviside

restart;

de := diff(u(x),x$2) = Heaviside(x - a)*u(x);

diff(diff(u(x), x), x) = Heaviside(x-a)*u(x)

dsolve fails:

dsolve(de);

u(x) = DESol({diff(diff(_Y(x), x), x)-Heaviside(x-a)*_Y(x)}, {_Y(x)})

Attempt to solve with piecewise

restart;

de := diff(u(x),x$2) = piecewise(x < a, 0, 1)*u(x);

de := diff(u(x), x, x) = piecewise(x < a, 0, 1)*u(x)

dsolve(de);

Error, (in dsolve) give the main variable as a second argument

dsolve(de, u(x));

Error, (in dsolve) give the main variable as a second argument

 

 

The solution is easy to calculate by hand

We just solve the (quite trivial) DE over the intervals x < a and x>a

separately, and patch the two solutions by requiring the continuity

of u(x) and diff(u(x), x) at x = a.  We get

sol := piecewise(x < a,
        x*c[1] + c[2],
        ((a*c[1] + c[1] + c[2])*exp(x))/(2*exp(a)) + ((a*c[1] - c[1] + c[2])*exp(-x))/(2*exp(-a)));

sol := piecewise(x < a, x*c[1]+c[2], (a*c[1]+c[1]+c[2])*exp(x)/(2*exp(a))+(a*c[1]-c[1]+c[2])*exp(-x)/(2*exp(-a)))

Download solving-an-ode.mw

Hello,

I am fairly new to Maple. Suppose I have two Matrices

A := <<true, false, true> | <true, false, true> | <false, false, false>>

B := <<1, 2, 6> | <3, 4, 7> | <22, 33, 44>>

and apply select(A, B)

Why do I receive [[[(),3,22],[(),(),()],[(),7,44]]] instead of [[[1,(),6],[3,(),7],[(),(),()]]] as a result? I just want to select every element of B where A is true.

I appreciate any insight.

This is a simple algebraic, but I would like to know how to officially solve the problem,

I tried factor(6*a+12*b+18*c); it simply outputs what I input.

I tried primpart(6*a+12*b+18*c) ; the output is: a+2b+3c

I tried content(6*a+12*b+18*c), the output is 6

What I'm looking for an output is, 6*(a+2*b+3*c), this is the answer my Algebra book is looking for, I also get this answer by

using my HP Graphing Calculator, but I'm unable to get the answer from Maples. Can anyone help?

1 2 3 4 5 6 7 Last Page 1 of 1923