Maple 2022 Questions and Posts

These are Posts and Questions associated with the product, Maple 2022

Hello Everyone;

Hope you are fine. I I have make a code but there is error and dsolve comand is working. I also need to plot. Kindly help me. I am waiting kind response. Code is attached.

restart; Cm := 1.0; ENa := 50.0; EK := -77.0; ELeak := -54.387; gNa := 120.0; gK := 36.0; gLeak := .3; II := piecewise(`and`(t >= 10, t <= 40), 10.0, 0.); alpha_m := proc (V) .1*(V+40.0)/(1.0-exp((-1)*(V+40.0)/10.0)) end proc; beta_m := proc (V) 4.0*exp((-1)*(V+65.0)/18.0) end proc; alpha_h := proc (V) 0.7e-1*exp((-1)*(V+65.0)/20.0) end proc; beta_h := proc (V) 1.0/(1.0+exp((-1)*(V+35.0)/10.0)) end proc; alpha_n := proc (V) 0.1e-1*(V+55.0)/(1.0-exp((-1)*(V+55.0)/10.0)) end proc; beta_n := proc (V) .125*exp((-1)*(V+65.0)/80.0) end proc; eq1 := diff(V(t), t) = (II-gNa*m(t)^3*h(t)*(V(t)-ENa)-gK*n(t)^4*(V(t)-EK)-gLeak*(V(t)-ELeak))/Cm; eq2 := diff(m(t), t) = alpha_m(V(t))*(1-m(t))-beta_m(V(t))*m(t); eq3 := diff(h(t), t) = alpha_h(V(t))*(1-h(t))-beta_h(V(t))*h(t); eq4 := diff(n(t), t) = alpha_n(V(t))*(1-n(t))-beta_n(V(t))*n(t); ics := {V(0) = -65, h(0) = .6, m(0) = 0.5e-1, n(0) = .32}

1.0

 

50.0

 

-77.0

 

-54.387

 

120.0

 

36.0

 

.3

 

20

 

proc (V) .1*(V+40.0)/(1.0-exp((-1)*(V+40.0)/10.0)) end proc

 

proc (V) 4.0*exp((-1)*(V+65.0)/18.0) end proc

 

proc (V) 0.7e-1*exp((-1)*(V+65.0)/20.0) end proc

 

proc (V) 1.0/(1.0+exp((-1)*(V+35.0)/10.0)) end proc

 

proc (V) 0.1e-1*(V+55.0)/(1.0-exp((-1)*(V+55.0)/10.0)) end proc

 

proc (V) .125*exp((-1)*(V+65.0)/80.0) end proc

 

diff(V(t), t) = 3.683900000-120.0000000*m(t)^3*h(t)*(V(t)-50.0)-36.00000000*n(t)^4*(V(t)+77.0)-.3000000000*V(t)

 

diff(m(t), t) = .1*(V(t)+40.0)*(1-m(t))/(1.0-exp(-.1000000000*V(t)-4.000000000))-4.0*exp(-0.5555555556e-1*V(t)-3.611111111)*m(t)

 

diff(h(t), t) = 0.7e-1*exp(-0.5000000000e-1*V(t)-3.250000000)*(1-h(t))-1.0*h(t)/(1.0+exp(-.1000000000*V(t)-3.500000000))

 

diff(n(t), t) = 0.1e-1*(V(t)+55.0)*(1-n(t))/(1.0-exp(-.1000000000*V(t)-5.500000000))-.125*exp(-0.1250000000e-1*V(t)-.8125000000)*n(t)

 

{V(0) = -65, h(0) = .6, m(0) = 0.5e-1, n(0) = .32}

(1)

sol := dsolve({eq1, eq2, eq3, eq4, ics})

Error, (in dsolve) invalid input: solve expects its 1st argument, eqs, to be of type {`and`, `not`, `or`, algebraic, relation(algebraic), ({list, set})({`and`, `not`, `or`, algebraic, relation(algebraic)})}, but received {{V(0) = -65, h(0) = 3/5, m(0) = 1/20, n(0) = 8/25}}

 

NULL

Download Question1.mw

Thanks

I think some form of simplify() would do but I am not sure how.

See the following script for more details:

restart

#Define the assumptions ex-ante (variances as real and positive, correlations in between -1 and +1 and so on...) - or Maple wouldn't know

assume(`#msub(mi("mu",fontstyle = "normal"),mi("1"))`::real, `#msub(mi("mu",fontstyle = "normal"),mi("2"))`::real, `#msub(mi("mu",fontstyle = "normal"),mi("3"))`::real, `#msub(mi("lambda",fontstyle = "normal"),mi("1"))`::real, `#msub(mi("lambda",fontstyle = "normal"),mi("2"))`::real, `#msub(mi("lambda",fontstyle = "normal"),mi("3"))`::real, `#msub(mi("sigma",fontstyle = "normal"),mi("epsilon1"))`::real, `#msub(mi("sigma",fontstyle = "normal"),mi("epsilon2"))`::real, (`#msub(mi("nu",fontstyle = "normal"),mi("0"))`[1])::real, (`#msub(mi("nu",fontstyle = "normal"),mi("0"))`[2])::real, (`#msub(mi("rho",fontstyle = "normal"),mi("u"))`[1, 2])::real, (`#msub(mi("rho",fontstyle = "normal"),mi("u"))`[1, 3])::real, (`#msub(mi("rho",fontstyle = "normal"),mi("u"))`[2, 3])::real, (`#msub(mi("rho",fontstyle = "normal"),mi("v"))`[1, 2])::real, (`#msub(mi("sigma",fontstyle = "normal"),mi("u"))`[1])::real, (`#msub(mi("sigma",fontstyle = "normal"),mi("u"))`[2])::real, (`#msub(mi("sigma",fontstyle = "normal"),mi("u"))`[3])::real, (`#msub(mi("sigma",fontstyle = "normal"),mi("v"))`[1])::real, (`#msub(mi("sigma",fontstyle = "normal"),mi("v"))`[2])::real)
 

assume(0 <= `#msub(mi("mu",fontstyle = "normal"),mi("1"))`, 0 <= `#msub(mi("mu",fontstyle = "normal"),mi("2"))`, 0 <= `#msub(mi("mu",fontstyle = "normal"),mi("3"))`, 0 <= `#msub(mi("lambda",fontstyle = "normal"),mi("1"))`, 0 <= `#msub(mi("lambda",fontstyle = "normal"),mi("2"))`, 0 <= `#msub(mi("lambda",fontstyle = "normal"),mi("3"))`, 0 <= `#msub(mi("sigma",fontstyle = "normal"),mi("epsilon1"))`, 0 <= `#msub(mi("sigma",fontstyle = "normal"),mi("epsilon2"))`, 0 <= `#msub(mi("nu",fontstyle = "normal"),mi("0"))`[1], 0 <= `#msub(mi("nu",fontstyle = "normal"),mi("0"))`[2], -1 <= `#msub(mi("rho",fontstyle = "normal"),mi("u"))`[1, 2] and `#msub(mi("rho",fontstyle = "normal"),mi("u"))`[1, 2] <= 1, -1 <= `#msub(mi("rho",fontstyle = "normal"),mi("u"))`[1, 3] and `#msub(mi("rho",fontstyle = "normal"),mi("u"))`[1, 3] <= 1, -1 <= `#msub(mi("rho",fontstyle = "normal"),mi("u"))`[2, 3] and `#msub(mi("rho",fontstyle = "normal"),mi("u"))`[2, 3] <= 1, -1 <= `#msub(mi("rho",fontstyle = "normal"),mi("v"))`[1, 2] and `#msub(mi("rho",fontstyle = "normal"),mi("v"))`[1, 2] <= 1, 0 <= `#msub(mi("sigma",fontstyle = "normal"),mi("u"))`[1], 0 <= `#msub(mi("sigma",fontstyle = "normal"),mi("u"))`[2], 0 <= `#msub(mi("sigma",fontstyle = "normal"),mi("u"))`[3], 0 <= `#msub(mi("sigma",fontstyle = "normal"),mi("v"))`[1], 0 <= `#msub(mi("sigma",fontstyle = "normal"),mi("v"))`[2])

NULL

t__1 := (`&sigma;__v`[2]^2*(`&rho;__v`[1, 2]^2-1)-`&sigma;__&epsilon;2`^2)*`&sigma;__v`[1]^2/((`&sigma;__v`[2]^2*(`&rho;__v`[1, 2]^2-1)-`&sigma;__&epsilon;2`^2)*`&sigma;__v`[1]^2-`&sigma;__&epsilon;1`^2*(`&sigma;__&epsilon;2`^2+`&sigma;__v`[2]^2))

t__2 := -`&sigma;__v`[1]*`&rho;__v`[1, 2]*`&sigma;__v`[2]*`&sigma;__&epsilon;1`^2/((`&sigma;__v`[2]^2*(`&rho;__v`[1, 2]^2-1)-`&sigma;__&epsilon;2`^2)*`&sigma;__v`[1]^2-`&sigma;__&epsilon;1`^2*(`&sigma;__&epsilon;2`^2+`&sigma;__v`[2]^2))

t__3 := (`&sigma;__v`[1]*`&rho;__v`[1, 2]*`&sigma;__v`[2]*`&sigma;__&epsilon;1`^2*`&nu;__0`[2]-`&nu;__0`[1]*`&sigma;__&epsilon;1`^2*(`&sigma;__&epsilon;2`^2+`&sigma;__v`[2]^2))/((`&sigma;__v`[2]^2*(`&rho;__v`[1, 2]^2-1)-`&sigma;__&epsilon;2`^2)*`&sigma;__v`[1]^2-`&sigma;__&epsilon;1`^2*(`&sigma;__&epsilon;2`^2+`&sigma;__v`[2]^2))


See for example that they share the same denominator...
# I want Maple to automatically/smartly choose the most compact way...e.g., (i) t2=t1+... or (ii) t2=t3*... (i) is equivalent to (ii) but I want Maple to pick (ii) if more compact than (i)
# I have 9 expressions like t1,t2,t3 and I want Maple to re-write them as function of each other smartly

 

NULL

``

Download rearrangingterms.mw

It must be something similar to this https://www.mapleprimes.com/maplesoftblog/201455-Rearranging-The-expression-Of-Equations, but my case is slighty different.

Dear all:

    I am using maple2022 to learn Fourier Series package - Maple Application Center (maplesoft.com) . the author provide the package here:

cgi.math.muni.cz/kriz/xsrot/fourierseries/  I use the lastest version: Package FourierTrigSeries version 0.41 

there is no .mla so I do not know how to use this package.(the package is a little old). 

please enlight me if you know how to install this old package.

but the author provide the code inside fourierseries-structs.mws 

here is what I do:

1. first delete some lines which is not useful(which I shared in the attachment as FourierTrigSeries.mw)

and remain everything inside module and save as .mw (maybe the orginal .mws is a old version of maple files)

2. export as .FourierTrigSeries.mpl (also attached)

3. use the examples.mws (the code also from author)

I got error as:

the package can be recognized, but the first line wil give some error which is out of my knowledge field.

everything mentioned above is here, including the original author's files.

fouriertrigseries_0_41en_mapleprime.zip

Could you please have a look. your idea is valuable to me.

PS: this package is not available The Fourier Series package for Maple - Maple Application Center (maplesoft.com) whenI try to learn  Teaching Fourier Series with Maple II 

if anyone keep it before, please share it.

thanks for your help.

rockyicer 

restart;
with(plots);
with(plottools);
with(DEtools);
N := S(t) + In(t) + C(t);
                    N := S(t) + In(t) + C(t)

eqn1 := diff*(S(t), t) = lambda - (lambda + sigma)*S(t) - (beta + Zeta)*S(t)*In(t) - beta[1]*S(t)*C(t), S(0) = ic1;
 eqn1 := diff (S(t), t) = lambda - (lambda + sigma) S(t)

    - (beta + Zeta) S(t) In(t) - beta[1] S(t) C(t), S(0) = ic1


eqn2 := diff*(In(t), t) = beta*S(t)*In(t) - (lambda + gamma)*In(t), In(0) = ic2;
 eqn2 := 

   diff (In(t), t) = beta S(t) In(t) - (lambda + gamma) In(t), 

   In(0) = ic2


eqn3 := diff*(C(t), t) = Zeta*In(t) + Zeta*In(t)^2 - (rho + lambda)*C(t) - Zeta*C(t)*In(t), C(0) = ic3;
                                                     2
     eqn3 := diff (C(t), t) = Zeta In(t) + Zeta In(t) 

        - (rho + lambda) C(t) - Zeta C(t) In(t), C(0) = ic3


lambda := 0.117852;
                       lambda := 0.117852

mu := 0.035378;
                         mu := 0.035378

beta := 0.11;
                          beta := 0.11

beta__1 := 0.05;
                        beta__1 := 0.05

g := 1;
rho := 0.1;
                           rho := 0.1

zeta := 0.02;
                          zeta := 0.02

sigma := 0.066;
                         sigma := 0.066


ic1 := 2390000;
ic2 := 753;
ic4 := 358500;
                         ic1 := 2390000

                           ic2 := 753

                         ic4 := 358500

dsol := dsolve([eqn1, eqn2, eqn3], numeric);
Error, (in dsolve/numeric/process_input) system must be entered as a set/list of expressions/equations
 

I have this tedious looking function that I want to write in terms of the other expression but the command i usually use does not work here because the expressions are not polynomials. I am wondering if there is an alternative to doing this manually.
Temp.mw

Hi everyone
how can i overcome this error to solve this ODE ? tnx in advanced.

restart

U := 1:L := 10:k := 1:Dea := 0.00001:CA0 := 10:Pe := U*L/Dea:Da := k*CA0^2/Dea:

Eq1 := diff(CA(x), x, x) - Pe*diff(CA(x), x)/L = Da*L*CA(x)^2/CA0;

diff(diff(CA(x), x), x)-100000.0000*(diff(CA(x), x)) = 10000000.00*CA(x)^2

(1)

BCs := CA(0) = CA0, D(CA)(L) = 0

CA(0) = 10, (D(CA))(10) = 0

(2)

ans := dsolve([Eq1, BCs], numeric);

Error, (in dsolve/numeric/bvp) initial Newton iteration is not converging

 

 

Download Hw.mw

I am trying to give an input to an R program from an output the edge set of maple code 

Now how to Build a function which takes a list of edge sets as inputs and returns a list on the below format

Show I want for one edge set of the list

Now I have edge set of a Graph G say {{1,2},{2,3},{3,4},{4,5}}

Now want to pick the first values of each index make one set 

from<-c(1,2,3,4)

Similiarly first values of each index make one more set 

to<-c(2,3,4,5)

Then I want to form a list [from<-c(1,2,3,4),to<-c(2,3,4,5),ft <- cbind(from, to),Graph1<-ftM2graphNEL(ft)]

Now it will take second graph in the Edge list say {{1, 2}, {1, 7}, {2, 3}, {3, 4}, {4, 5}, {5, 6}, {6, 7}}

It will append to the previous list like

[from<-c(1,2,3,4),to<-c(2,3,4,5),ft <- cbind(from, to),Graph1<-ftM2graphNEL(ft),from<-c(1,1,2,3,4,5,6),to<-c(2,7,3,4,5,6,7),ft <- cbind(from, to),Graph2<-ftM2graphNEL(ft)]

This time Graph1 is changed to Graph2 to be observed.

Like that it will need  increase graph number based on the number of edge sets in the list of edges.

To be done all edge sets in list

As then I can copy the entire contents in the list and paste in R so that i can run 

As I can have 100 or more graphs done in maple doing for each of them manually typing may be difficult.

Kind help please

Your help will be surely Acknowledged 

Kind help

A toy code i simply tried for graph attached

But I have errors some come with double quotes can something be done if possible please guide

Kind help

As with 100 of lines it will easy to copy paste 

If the contents of the list can be written to txt file it would be helful 

please help

toy_try.mw

I have tried something to my knoewledge please help

Hello,

is there a limit to the matrix size on which the Determinant(A) can operate? I am working on a project that generates a 22x22 matrix of coefficients of unknowns, which I built out of the GenerateMatrix() function.  If I use subs(omega=1, AA), the determinant is calculated. Still, I want the determinant in terms of omega so I can solve for Determinant(A)=0 in order to find the natural frequencies and then find my unknown coefficients.

When I use the Determinant function on my symbolic matrix is always returns 0. I know from using smaller matrices that it can do symbolic determinants. If there is a better way to do what I am trying to do, please let me know!

Thanks!

Please check: Finding_Chi_Version1.mw

My end goal is to find the following three expressions:

chi_1 := collect(X_A,[nnu[1],nnu[2]]);

chi_2 := collect(X_B,[nnu[1],nnu[2]]);

chi_3 := collect(X_C,[nnu[1],nnu[2]]);

I expect these three expressions to be linear combinations of random variables nu[1] (nnu[1]) and nu[2] (nnu[2]).

While calling solve(), I encounter this error:

Error, (in assuming) when calling 'SolveTools:-Engine:-Dispatch'. Received: 'badly formed input to solve: not fully algebraic'

What is exactly the issue here? If it can help you answer my doubt, that argmin expression I defined is composed by conditional means and variances which I computed as in here: conditional_distributions_Version1.mw

The two formulas I am trying to implement in Maple are conditional distribution of a multivariate normal distributionAm I already doing any mistake in conditional_distributions_Version1.mw? An alternative interpretation of mine for these two formulas is: conditional_distributions_Version2.mw. Please check the light-blue-highlighted differences in the conditional variance calculation. This alternative interpretation leads to Finding_Chi_Version2.mw, which I also can't solve() (solver stuck in "evaluating") but at least I don't get the error mentioned above...

I am a bit lost to be honest: Is Finding_Chi_Version1 or Finding_Chi_Version2 the correct interpretation? 

Thanks!

Hello,
I m wondering if/how (i) can use the collect function twice:  collect(a, x, form, func ):  
collect(a, x, form, collect(x)), but it seems I can't use a func with opt. 
Can someone help please? 

Merci 

Hello Y'all,

I've been on this problem for a few days now and can't seem to find a solution and hope you fine people here can help me.

Is there a way to symbolically work with matrices? In detail I'm trying to calculate blocks in a block matrix equation symbolically/analytically. The first problem I had was that of course matrices dont commutate, which is solvable by just using the LinearAlgebra package and typing in

A.B instead of A*B

For now the big problem that remains is that of course in addition to that the inversion of a matrix A is not just 1/A (or \frac{1}{A} in LaTeX) but simply A^(-1). There is the MatrixInverse function but that needs a declared matrix. And since I dont have explicit matrices I can't use Matrix or the like to declare that A is a matrix. Any help here would appreciated. I tried to work with assume, but that didn't work either and I am kind of out of options (that I find on the web) right now. In essence I just want Maple to write A^(-1) and only cancel that if an A is next to it... (albeit with not just A but of course A also being setup by addition and multiplication of matrices...).

A smaller, related interest would be a general identity matrix. One that basically just fulfills A.I=I.A=A and I^(-1)=I. At least to me that seems kind of similar but I can't just define a Mtrix as being a Matrix and not having elements...

Thank you in advance and have a nice weekend y'all! :)

Good day! 

I attempted to download the geocoding package for Maple and I cannot get it to work. Executing the worksheet produces no results.

I am using Maple 2022. 

Can anyone shed some light on this please?

Thanks for reading ..

https://maple.cloud/app/5769608062566400/Google+Maps+and+Geocoding?activeGroup=MathApps

How to use collect() or coeffs() on random variables instead of standard variables?

I need to re-organize a linear combination of RVs nu[1], nu[2], u[1], u[2], u[3] by collecting the coefficients on each of these 5 RVs. Note that the Xs are correlated with each other and the Ys are correlated with each other (but Xs and Ys are uncorrelated).

For example, nu is a 2D gaussian vector where nu[1] and nu[2] are defined in terms of _R1, _R2, means, standard deviations and correlation coefficient. They are quite "nested" and the 3D gaussian vector u is even worse, so when these enter a linear combination it becomes hard to identify them back as simply nu[1], nu[2], u[1], u[2], u[3].

Is there a way to "isolate" them in a linear combination by using collect()-like or coeffs()-like functions (i) directly on the RVs or (ii) indireclty on the explicit expressions of _Rs, means, standard devs, correlation coeffs? 

(I already checked the answers to these two somewhat similar questions but did not help for my case:

https://mapleprimes.com/questions/235215-Reduce-Length-Of-Sum-Of-Products

https://mapleprimes.com/questions/234292-Re-How-To-Collect-Using-A-Term-By-Multiplication

)

See my script below: 

For example, I would want collect() on nu[1] (or equivalently on _R1*sigma__v[1]+nu__0[1]) to give me X__1+X__3 (as you easily see from my definition of Omega).

# 2.2.1 Define the Omega random variable as Omega__1+Omega__2+Omega__3:

`&Omega;__1` := X__1*(nu[1]-`&mu;__1`-`&lambda;__1`*(u[1]+X__1)); `&Omega;__2` := X__2*(nu[2]-`&mu;__2`-`&lambda;__2`*(u[2]+X__2)); `&Omega;__3` := X__3*(nu[1]+nu[2]-`&mu;__3`-`&lambda;__3`*(u[3]+X__3)); Omega := `&Omega;__1`+`&Omega;__2`+`&Omega;__3`

X__1*(sigma__v[1]*_R1+nu__0[1]-mu__1-lambda__1*(_R3*sigma__u[1]+X__1))+X__2*(sigma__v[2]*rho__v[1, 2]*_R1+(-rho__v[1, 2]^2+1)^(1/2)*sigma__v[2]*_R2+nu__0[2]-mu__2-lambda__2*(rho__u[1, 2]*sigma__u[2]*_R3+(-rho__u[1, 2]^2+1)^(1/2)*sigma__u[2]*_R4+X__2))+X__3*(sigma__v[1]*_R1+nu__0[1]+sigma__v[2]*rho__v[1, 2]*_R1+(-rho__v[1, 2]^2+1)^(1/2)*sigma__v[2]*_R2+nu__0[2]-mu__3-lambda__3*(rho__u[1, 3]*sigma__u[3]*_R3-sigma__u[3]*(rho__u[1, 2]*rho__u[1, 3]-rho__u[2, 3])*_R4/(-rho__u[1, 2]^2+1)^(1/2)+((-2*rho__u[1, 2]*rho__u[1, 3]*rho__u[2, 3]+rho__u[1, 2]^2+rho__u[1, 3]^2+rho__u[2, 3]^2-1)/(rho__u[1, 2]^2-1))^(1/2)*sigma__u[3]*_R5+X__3))

(1)

# 2.2.2 Simplify and re-arrange the Omega RV to obtain the easy-to-read version (a,b,c,d,e,f are the coefficients):
#Omega__* = a + b*nu[1] + c*nu[2] + d*u[1] + e*u[2] + f*u[3];
# How to do it? Collect() does not work...simplify() doesn't make it any easier...

`&Omega;__*` := collect(Omega, [_R1*`&sigma;__v`[1]+`&nu;__0`[1], `&sigma;__v`[2]*`&rho;__v`[1, 2]*_R1+sqrt(-`&rho;__v`[1, 2]^2+1)*`&sigma;__v`[2]*_R2+`&nu;__0`[2], `&sigma;__u`[1]*_R3, `&sigma;__u`[2]*`&rho;__u`[1, 2]*_R3+sqrt(-`&rho;__u`[1, 2]^2+1)*`&sigma;__u`[2]*_R4, `&sigma;__u`[3]*`&rho;__u`[1, 3]*_R3-`&sigma;__u`[3]*(`&rho;__u`[1, 2]*`&rho;__u`[1, 3]-`&rho;__u`[2, 3])*_R4/sqrt(-`&rho;__u`[1, 2]^2+1)+sqrt((-2*`&rho;__u`[1, 2]*`&rho;__u`[1, 3]*`&rho;__u`[2, 3]+`&rho;__u`[1, 2]^2+`&rho;__u`[1, 3]^2+`&rho;__u`[2, 3]^2-1)/(`&rho;__u`[1, 2]^2-1))*`&sigma;__u`[3]*_R5])

Error, (in collect) cannot collect _R1*sigma__v[1]+nu__0[1]

 

`&Omega;__col` := collect(Omega, [nu[1], nu[2], u[1], u[2], u[3]])

Error, (in collect) cannot collect _R1*sigma__v[1]+nu__0[1]

 

 

Download collect.mw

I can derive a symbolic solution by hand for the following ODE, but cannot get Maple to do it for me.  Any tricks?

restart;

Velocity field, -infinity < x and x < infinity,  t > 0.

v := (x,t) -> piecewise(x <= -t, 0, x < t, 1 - 1/2*(1 - x/t));

v := proc (x, t) options operator, arrow; piecewise(x <= -t, 0, x < t, 1/2+(1/2)*x/t) end proc

Position x(t):

de := diff(x(t),t) = v(x(t),t);

de := diff(x(t), t) = piecewise(x(t) <= -t, 0, x(t) < t, 1/2+x(t)/(2*t))

Initial condition, assuming a > 0

ic := x(0) = -a;

x(0) = -a

Symbolic solution, calculated by hand:

x__exact := t -> piecewise(t < a, -a, t - 2*sqrt(t)*sqrt(a));

x__exact := proc (t) options operator, arrow; piecewise(t < a, -a, t-2*sqrt(t)*sqrt(a)) end proc

Verify exact solution by comparing it against the numeric solution for some a > 0:

a := 3;  # any a>0 should do
dsol := dsolve({de,ic}, numeric):
plots:-odeplot(dsol, t=0..5);   # dsolve solution
plot(x__exact(t), t=0..5);      # symbolic solution (calculated by hand)
a := 'a';

3

a

Can Maple's dsolve find the exact solution?  This one returns empty in Maple 2022:

dsolve({de, ic}) assuming a > 0, t > 0;

Download ode-piecewise.mw

 

I obtain the adjacency matrix from a graph. We know that it is indexed according to the order of vertices in the Vertices. But what if I want to rearrange it in a different order? Here is a specific example.

with(GraphTheory):
g:=Graph({{2,3},{1,2}});
Vertices(g); #[1,2,3]
AdjacencyMatrix(g);

I would like to display this matrix in the order of [3, 1, 2].

First 13 14 15 16 17 18 19 Last Page 15 of 42