dharr

Dr. David Harrington

8215 Reputation

22 Badges

20 years, 339 days
University of Victoria
Professor or university staff
Victoria, British Columbia, Canada

Social Networks and Content at Maplesoft.com

Maple Application Center
I am a retired professor of chemistry at the University of Victoria, BC, Canada. My research areas are electrochemistry and surface science. I have been a user of Maple since about 1990.

MaplePrimes Activity


These are answers submitted by dharr

Maybe you only need to classify, and not order the sublists after classification? If so you only need LL and not the sort line in the procedure. I'm not too familiar with these orderings and I'm not sure which one you actually want.

restart;

F := [x^2 - y - 1, y^2 - y, y^3 - y, x^2 - 4, y^3 - 1, z^2 - 4, 2*x^2, x^2*y];

[x^2-y-1, y^2-y, y^3-y, x^2-4, y^3-1, z^2-4, 2*x^2, x^2*y]

monomial_classify := proc(L::list(polynom), ord)
  local LL, Lmon, xx;
  Lmon := xx -> Groebner:-LeadingMonomial(xx, ord);
  LL := map(convert,convert(ListTools:-Classify(Lmon, L),'list'),'list');
  sort(LL, (a, b) -> Groebner:-TestOrder(Lmon(a[1]), Lmon(b[1]), ord));
end proc:

monomial_classify(F, grlex(z,y,x));

[[2*x^2, x^2-4, x^2-y-1], [y^2-y], [z^2-4], [x^2*y], [y^3-1, y^3-y]]

 

Download sort2.mw

I'm assuming you want two plots, of Cb(t) and Cm(t) vs time, and not Cb(t) vs Cm(t). You seem to have cut and pasted things, so I set up to solve the problem from live commands. You may have to adjust some things to get exactly what you want. (The plot doesn't show here in Mapleprimes, but does if you download the document.) I had to make a guess about the meaning of c0 and c; they may be the wrong way around.

restart

 

 

 

 

Absorption from stomach

de1 := diff(Cm(t), t) = -Ka*Cm(t)                            

 

Glucose concentration in blood

de2 := diff(Cb(t), t) = Ka*Cm(t)-Ku*Cb(t)

 

Initial conditions

 

ins := Cb(0) = c0, Cm(0) = c 

 

Solve

solution := dsolve({de1, de2, ins})

{Cb(t) = -(-Ka+Ku)*(Ka*c+Ka*c0-Ku*c0)*exp(-Ku*t)/(Ka-Ku)^2-Ka*exp(-Ka*t)*c/(Ka-Ku), Cm(t) = c*exp(-Ka*t)}

Ceqns := eval([Cb(t), Cm(t)], solution)

[-(-Ka+Ku)*(Ka*c+Ka*c0-Ku*c0)*exp(-Ku*t)/(Ka-Ku)^2-Ka*exp(-Ka*t)*c/(Ka-Ku), c*exp(-Ka*t)]

Explore(plot(Ceqns, t = 0 .. 5, 0 .. 30), Ka = 1 .. 10, Ku = 1 .. 10, c0 = 0 .. 20, c = 0 .. 20, initialvalues = [Ka = 2, Ku = 1, c0 = 10, c = 10])

 

NULL

NULL

``

NULL

NULL

Download Explore_plot.mw

See the ?evalhf help page, There is overhead converting from software floats to hardware floats and back again. The conversion to hfloats is presumably still present below, but it doesn't have to convert back.

restart;

UseHardwareFloats:=false;

false

CodeTools:-Usage( for i from 1 to 100 by 0.001 do exp(i) end do):
CodeTools:-Usage( for i from 1 to 100 by 0.001 do evalhf[hfloat](exp(i)) end do):

memory used=0.87GiB, alloc change=109.00MiB, cpu time=2.31s, real time=2.42s, gc time=93.75ms
memory used=12.84MiB, alloc change=0 bytes, cpu time=78.00ms, real time=68.00ms, gc time=0ns

 

 

Download evalhf.mw

Since all trig and exp functions of interest are expressible in terms of exponentials, this method may be more general; at least it doesn't require the generation of different side relations for each case.

The solved parameters are sometimes complex, which has led to psi having cosh rather than cos. This may be OK or maybe solving for an appropriate subset of the variables solves this problem; which subset to use wasn't clear to me.

restart

with(PDEtools); _local(gamma)

undeclare(prime)

`There is no more prime differentiation variable; all derivatives will be displayed as indexed functions`

declare(phi(x, t)); declare(psi(x, t))

phi(x, t)*`will now be displayed as`*phi

psi(x, t)*`will now be displayed as`*psi

pde := diff(phi(x, t), `$`(t, 2))+diff(phi(x, t), `$`(x, 3), t)-3*(diff((diff(phi(x, t), x))*(diff(phi(x, t), t)), x))

diff(diff(phi(x, t), t), t)+diff(diff(diff(diff(phi(x, t), t), x), x), x)-3*(diff(diff(phi(x, t), x), x))*(diff(phi(x, t), t))-3*(diff(phi(x, t), x))*(diff(diff(phi(x, t), t), x))

eq2 := phi(x, t) = 3*(diff(ln(psi(x, t)), x))

phi(x, t) = 3*(diff(psi(x, t), x))/psi(x, t)

eq3 := (1/3)*numer(normal(eval(pde, eq2)))

(diff(diff(diff(psi(x, t), t), t), x))*psi(x, t)^4+(diff(diff(diff(diff(diff(psi(x, t), t), x), x), x), x))*psi(x, t)^4-2*(diff(diff(psi(x, t), t), x))*(diff(psi(x, t), t))*psi(x, t)^3-13*(diff(diff(psi(x, t), t), x))*(diff(diff(diff(psi(x, t), x), x), x))*psi(x, t)^3-(diff(diff(diff(diff(psi(x, t), x), x), x), x))*(diff(psi(x, t), t))*psi(x, t)^3-(diff(psi(x, t), x))*(diff(diff(psi(x, t), t), t))*psi(x, t)^3-4*(diff(diff(diff(diff(psi(x, t), t), x), x), x))*(diff(psi(x, t), x))*psi(x, t)^3-15*(diff(diff(diff(psi(x, t), t), x), x))*(diff(diff(psi(x, t), x), x))*psi(x, t)^3+69*(diff(diff(psi(x, t), t), x))*(diff(psi(x, t), x))*(diff(diff(psi(x, t), x), x))*psi(x, t)^2+2*(diff(psi(x, t), x))*(diff(psi(x, t), t))^2*psi(x, t)^2+17*(diff(diff(diff(psi(x, t), x), x), x))*(diff(psi(x, t), t))*(diff(psi(x, t), x))*psi(x, t)^2+15*(diff(diff(psi(x, t), x), x))^2*(diff(psi(x, t), t))*psi(x, t)^2+21*(diff(diff(diff(psi(x, t), t), x), x))*(diff(psi(x, t), x))^2*psi(x, t)^2-60*(diff(diff(psi(x, t), t), x))*(diff(psi(x, t), x))^3*psi(x, t)-90*(diff(diff(psi(x, t), x), x))*(diff(psi(x, t), t))*(diff(psi(x, t), x))^2*psi(x, t)+60*(diff(psi(x, t), x))^4*(diff(psi(x, t), t))

We seek a solution of this form

eq4 := psi(x, t) = gamma[1]*cos(theta[0]*(t*omega[0]+x))+gamma[2]*exp(theta[1]*(t*epsilon[0]+x))+exp(-theta[1]*(t*epsilon[0]+x))

psi(x, t) = gamma[1]*cos(theta[0]*(t*omega[0]+x))+gamma[2]*exp(theta[1]*(t*epsilon[0]+x))+exp(-theta[1]*(t*epsilon[0]+x))

After substitution into the ode, we want to find the coefficients of the trig functions, which we can set to zero since we want it to be true for all x and t. In principle solve/identity with two identity variables would work, but Maple allows only one.
Notice that substituting in leads us not only to have cos, but also sin, and if we have sin^2 and cos^2 the we can simplify using sin^2 + cos^2 =1 as a side relation. But this means tailoring the answer to the particular ode, since another may have other trig relationships.

eq5 := normal(eval(eq3, eq4)); indets(eq5)

{t, x, epsilon[0], gamma[1], gamma[2], omega[0], theta[0], theta[1], cos(theta[0]*(t*omega[0]+x)), exp(theta[1]*(t*epsilon[0]+x)), exp(-theta[1]*(t*epsilon[0]+x)), sin(theta[0]*(t*omega[0]+x))}

We have two distinct arguments, call them X and Y

eq6 := eval(eq5, {theta[0]*(t*omega[0]+x) = X, theta[1]*(t*`ε`[0]+x) = Y}); indets(eq6)

{X, Y, epsilon[0], gamma[1], gamma[2], omega[0], theta[0], theta[1], cos(X), exp(Y), exp(-Y), sin(X)}

Try converting all the trig functions to exp.

eq7 := convert(eq6, exp); indets(eq7)

{X, Y, epsilon[0], gamma[1], gamma[2], omega[0], theta[0], theta[1], exp(Y), exp(-(2*I)*X), exp(-I*X), exp(I*X), exp((2*I)*X), exp(-3*Y), exp(-2*Y), exp(-Y), exp(3*Y), exp(Y-(2*I)*X), exp(Y+(2*I)*X), exp(2*Y-I*X), exp(2*Y+I*X), exp(3*Y-(2*I)*X), exp(3*Y+(2*I)*X), exp(4*Y-I*X), exp(4*Y+I*X)}

All the exps are products of exp(Y) and exp(IX) - convert these to eY and eX

tr := solve({eX = exp(I*X), eY = exp(Y)}, {X, Y}); eq8 := simplify(eval(eq7, tr)); indets(eq8)

{X = -I*ln(eX), Y = ln(eY)}

{eX, eY, epsilon[0], gamma[1], gamma[2], omega[0], theta[0], theta[1]}

So now collecting wrt eX and eY should give only independent relationships? From which the required equations are the coefficients.

eqs := {coeffs(collect(numer(normal(eq8)), {eX, eY}, 'distributed'), {eX, eY})}; nops(%); indets(eqs)

32

{epsilon[0], gamma[1], gamma[2], omega[0], theta[0], theta[1]}

Next we solve for some subset of the variables in terms of the others. Here I just solve for all of them

vars := indets(eqs); ans := solve(eqs, vars)

{epsilon[0], gamma[1], gamma[2], omega[0], theta[0], theta[1]}

{epsilon[0] = 0, gamma[1] = 0, gamma[2] = gamma[2], omega[0] = omega[0], theta[0] = theta[0], theta[1] = theta[1]}, {epsilon[0] = epsilon[0], gamma[1] = 0, gamma[2] = 0, omega[0] = omega[0], theta[0] = theta[0], theta[1] = theta[1]}, {epsilon[0] = epsilon[0], gamma[1] = 0, gamma[2] = gamma[2], omega[0] = omega[0], theta[0] = theta[0], theta[1] = 0}, {epsilon[0] = 0, gamma[1] = gamma[1], gamma[2] = gamma[2], omega[0] = omega[0], theta[0] = 0, theta[1] = theta[1]}, {epsilon[0] = epsilon[0], gamma[1] = gamma[1], gamma[2] = gamma[2], omega[0] = omega[0], theta[0] = 0, theta[1] = 0}, {epsilon[0] = epsilon[0], gamma[1] = gamma[1], gamma[2] = gamma[2], omega[0] = 0, theta[0] = theta[0], theta[1] = 0}, {epsilon[0] = 0, gamma[1] = gamma[1], gamma[2] = gamma[2], omega[0] = 0, theta[0] = theta[0], theta[1] = theta[1]}, {epsilon[0] = epsilon[0], gamma[1] = gamma[1], gamma[2] = (1/4)*gamma[1]^2, omega[0] = -epsilon[0], theta[0] = -I*theta[1], theta[1] = theta[1]}, {epsilon[0] = epsilon[0], gamma[1] = gamma[1], gamma[2] = (1/4)*gamma[1]^2, omega[0] = -epsilon[0], theta[0] = I*theta[1], theta[1] = theta[1]}

eqI := ans[9]

{epsilon[0] = epsilon[0], gamma[1] = gamma[1], gamma[2] = (1/4)*gamma[1]^2, omega[0] = -epsilon[0], theta[0] = I*theta[1], theta[1] = theta[1]}

eqpsi := eval(eq4, eqI)

psi(x, t) = gamma[1]*cosh(theta[1]*(-t*epsilon[0]+x))+(1/4)*gamma[1]^2*exp(theta[1]*(t*epsilon[0]+x))+exp(-theta[1]*(t*epsilon[0]+x))

eqphi := eval(eq2, eqpsi)

phi(x, t) = 3*(gamma[1]*theta[1]*sinh(theta[1]*(-t*epsilon[0]+x))+(1/4)*gamma[1]^2*theta[1]*exp(theta[1]*(t*epsilon[0]+x))-theta[1]*exp(-theta[1]*(t*epsilon[0]+x)))/(gamma[1]*cosh(theta[1]*(-t*epsilon[0]+x))+(1/4)*gamma[1]^2*exp(theta[1]*(t*epsilon[0]+x))+exp(-theta[1]*(t*epsilon[0]+x)))

simplify(eval(pde, eqphi))

0

NULL

Download PDE-Hard.mw

Your hand calculation of ode1 does not appear to be correct. See attached.

problem.mw

The problem is that your function CP can't take T1(t) as an argument since that is not what CoolProp wants. But dsolve will complain if you don't have it. So you can make the procedure just return unevaluated if given a symbolic input to keep dsolve happy, but pass a numeric value to CoolProp. See attached.

Download Coolprop.mw

restart

with(PDEtools); _local(gamma)

undeclare(prime)

`There is no more prime differentiation variable; all derivatives will be displayed as indexed functions`

declare(phi(x, t)); declare(psi(x, t))

phi(x, t)*`will now be displayed as`*phi

psi(x, t)*`will now be displayed as`*psi

pde := diff(phi(x, t), t)+diff(phi(x, t), x)+(3/2)*phi(x, t)*(diff(phi(x, t), x, t))-(3/2)*(diff(phi(x, t), x))*(diff(phi(x, t), t))+(1/2)*phi(x, t)^2*(diff(phi(x, t), t))

diff(phi(x, t), t)+diff(phi(x, t), x)+(3/2)*phi(x, t)*(diff(diff(phi(x, t), t), x))-(3/2)*(diff(phi(x, t), x))*(diff(phi(x, t), t))+(1/2)*phi(x, t)^2*(diff(phi(x, t), t))

eq2 := phi(x, t) = 3*(diff(ln(psi(x, t)), x))

phi(x, t) = 3*(diff(psi(x, t), x))/psi(x, t)

eq3 := (1/3)*numer(normal(eval(pde, eq2)))

2*(diff(diff(psi(x, t), t), x))*psi(x, t)-9*(diff(diff(psi(x, t), t), x))*(diff(diff(psi(x, t), x), x))+2*(diff(diff(psi(x, t), x), x))*psi(x, t)-2*(diff(psi(x, t), x))^2-2*(diff(psi(x, t), x))*(diff(psi(x, t), t))+9*(diff(psi(x, t), x))*(diff(diff(diff(psi(x, t), t), x), x))

I'm following the notation in the paper - there were missing multiplications in this line

eq4 := psi(x, t) = gamma[1]*cos(theta[0]*(t*omega[0]+x))+gamma[2]*exp(theta[1]*(t*epsilon[0]+x))+exp(-theta[1]*(t*epsilon[0]+x))

psi(x, t) = gamma[1]*cos(theta[0]*(t*omega[0]+x))+gamma[2]*exp(theta[1]*(t*epsilon[0]+x))+exp(-theta[1]*(t*epsilon[0]+x))

After the following substitution, we are supposed to find 5 equations from the coefficients, i.e., independent of x and t.

eq5a := eval(eq3, eq4)

2*(-gamma[1]*theta[0]^2*omega[0]*cos(theta[0]*(t*omega[0]+x))+gamma[2]*theta[1]^2*epsilon[0]*exp(theta[1]*(t*epsilon[0]+x))+theta[1]^2*epsilon[0]*exp(-theta[1]*(t*epsilon[0]+x)))*(gamma[1]*cos(theta[0]*(t*omega[0]+x))+gamma[2]*exp(theta[1]*(t*epsilon[0]+x))+exp(-theta[1]*(t*epsilon[0]+x)))-9*(-gamma[1]*theta[0]^2*omega[0]*cos(theta[0]*(t*omega[0]+x))+gamma[2]*theta[1]^2*epsilon[0]*exp(theta[1]*(t*epsilon[0]+x))+theta[1]^2*epsilon[0]*exp(-theta[1]*(t*epsilon[0]+x)))*(-gamma[1]*theta[0]^2*cos(theta[0]*(t*omega[0]+x))+gamma[2]*theta[1]^2*exp(theta[1]*(t*epsilon[0]+x))+theta[1]^2*exp(-theta[1]*(t*epsilon[0]+x)))+2*(-gamma[1]*theta[0]^2*cos(theta[0]*(t*omega[0]+x))+gamma[2]*theta[1]^2*exp(theta[1]*(t*epsilon[0]+x))+theta[1]^2*exp(-theta[1]*(t*epsilon[0]+x)))*(gamma[1]*cos(theta[0]*(t*omega[0]+x))+gamma[2]*exp(theta[1]*(t*epsilon[0]+x))+exp(-theta[1]*(t*epsilon[0]+x)))-2*(-gamma[1]*theta[0]*sin(theta[0]*(t*omega[0]+x))+gamma[2]*theta[1]*exp(theta[1]*(t*epsilon[0]+x))-theta[1]*exp(-theta[1]*(t*epsilon[0]+x)))^2-2*(-gamma[1]*theta[0]*sin(theta[0]*(t*omega[0]+x))+gamma[2]*theta[1]*exp(theta[1]*(t*epsilon[0]+x))-theta[1]*exp(-theta[1]*(t*epsilon[0]+x)))*(-gamma[1]*theta[0]*omega[0]*sin(theta[0]*(t*omega[0]+x))+gamma[2]*theta[1]*epsilon[0]*exp(theta[1]*(t*epsilon[0]+x))-theta[1]*epsilon[0]*exp(-theta[1]*(t*epsilon[0]+x)))+9*(-gamma[1]*theta[0]*sin(theta[0]*(t*omega[0]+x))+gamma[2]*theta[1]*exp(theta[1]*(t*epsilon[0]+x))-theta[1]*exp(-theta[1]*(t*epsilon[0]+x)))*(gamma[1]*theta[0]^3*omega[0]*sin(theta[0]*(t*omega[0]+x))+gamma[2]*theta[1]^3*epsilon[0]*exp(theta[1]*(t*epsilon[0]+x))-theta[1]^3*epsilon[0]*exp(-theta[1]*(t*epsilon[0]+x)))

We have sin^2 and cos^1 with the same coefficients

eq5b := collect(normal(eq5a), {cos, sin})

(-9*gamma[1]^2*omega[0]*theta[0]^4-2*gamma[1]^2*omega[0]*theta[0]^2-2*gamma[1]^2*theta[0]^2)*cos(theta[0]*(t*omega[0]+x))^2+(9*exp(theta[1]*(t*epsilon[0]+x))*epsilon[0]*gamma[1]*gamma[2]*theta[0]^2*theta[1]^2+9*exp(theta[1]*(t*epsilon[0]+x))*gamma[1]*gamma[2]*omega[0]*theta[0]^2*theta[1]^2+9*exp(-theta[1]*(t*epsilon[0]+x))*epsilon[0]*gamma[1]*theta[0]^2*theta[1]^2+9*exp(-theta[1]*(t*epsilon[0]+x))*gamma[1]*omega[0]*theta[0]^2*theta[1]^2+2*exp(theta[1]*(t*epsilon[0]+x))*epsilon[0]*gamma[1]*gamma[2]*theta[1]^2-2*exp(theta[1]*(t*epsilon[0]+x))*gamma[1]*gamma[2]*omega[0]*theta[0]^2-2*exp(theta[1]*(t*epsilon[0]+x))*gamma[1]*gamma[2]*theta[0]^2+2*exp(theta[1]*(t*epsilon[0]+x))*gamma[1]*gamma[2]*theta[1]^2+2*exp(-theta[1]*(t*epsilon[0]+x))*epsilon[0]*gamma[1]*theta[1]^2-2*exp(-theta[1]*(t*epsilon[0]+x))*gamma[1]*omega[0]*theta[0]^2-2*exp(-theta[1]*(t*epsilon[0]+x))*gamma[1]*theta[0]^2+2*exp(-theta[1]*(t*epsilon[0]+x))*gamma[1]*theta[1]^2)*cos(theta[0]*(t*omega[0]+x))+(-9*gamma[1]^2*omega[0]*theta[0]^4-2*gamma[1]^2*omega[0]*theta[0]^2-2*gamma[1]^2*theta[0]^2)*sin(theta[0]*(t*omega[0]+x))^2+(-9*exp(theta[1]*(t*epsilon[0]+x))*epsilon[0]*gamma[1]*gamma[2]*theta[0]*theta[1]^3+9*exp(theta[1]*(t*epsilon[0]+x))*gamma[1]*gamma[2]*omega[0]*theta[0]^3*theta[1]+9*exp(-theta[1]*(t*epsilon[0]+x))*epsilon[0]*gamma[1]*theta[0]*theta[1]^3-9*exp(-theta[1]*(t*epsilon[0]+x))*gamma[1]*omega[0]*theta[0]^3*theta[1]+2*exp(theta[1]*(t*epsilon[0]+x))*epsilon[0]*gamma[1]*gamma[2]*theta[0]*theta[1]+2*exp(theta[1]*(t*epsilon[0]+x))*gamma[1]*gamma[2]*omega[0]*theta[0]*theta[1]+4*exp(theta[1]*(t*epsilon[0]+x))*gamma[1]*gamma[2]*theta[0]*theta[1]-2*exp(-theta[1]*(t*epsilon[0]+x))*epsilon[0]*gamma[1]*theta[0]*theta[1]-2*exp(-theta[1]*(t*epsilon[0]+x))*gamma[1]*omega[0]*theta[0]*theta[1]-4*exp(-theta[1]*(t*epsilon[0]+x))*gamma[1]*theta[0]*theta[1])*sin(theta[0]*(t*omega[0]+x))-36*exp(theta[1]*(t*epsilon[0]+x))*exp(-theta[1]*(t*epsilon[0]+x))*epsilon[0]*gamma[2]*theta[1]^4+8*exp(theta[1]*(t*epsilon[0]+x))*exp(-theta[1]*(t*epsilon[0]+x))*epsilon[0]*gamma[2]*theta[1]^2+8*exp(theta[1]*(t*epsilon[0]+x))*exp(-theta[1]*(t*epsilon[0]+x))*gamma[2]*theta[1]^2

eq5c := simplify(eq5b, {cos(theta[0]*(t*omega[0]+x))^2+sin(theta[0]*(t*omega[0]+x))^2 = 1})

(-36*(epsilon[0]*theta[1]^2-(2/9)*epsilon[0]-2/9)*theta[1]^2*gamma[2]*exp(theta[1]*(t*epsilon[0]+x))-9*gamma[1]*((((-omega[0]-epsilon[0])*theta[0]^2-(2/9)*epsilon[0]-2/9)*theta[1]^2+(2/9)*theta[0]^2*(omega[0]+1))*cos(theta[0]*(t*omega[0]+x))+sin(theta[0]*(t*omega[0]+x))*theta[0]*theta[1]*(omega[0]*theta[0]^2-epsilon[0]*theta[1]^2+(2/9)*omega[0]+(2/9)*epsilon[0]+4/9)))*exp(-theta[1]*(t*epsilon[0]+x))+9*gamma[1]*(((((omega[0]+epsilon[0])*theta[0]^2+(2/9)*epsilon[0]+2/9)*theta[1]^2-(2/9)*theta[0]^2*(omega[0]+1))*cos(theta[0]*(t*omega[0]+x))+sin(theta[0]*(t*omega[0]+x))*theta[0]*theta[1]*(omega[0]*theta[0]^2-epsilon[0]*theta[1]^2+(2/9)*omega[0]+(2/9)*epsilon[0]+4/9))*gamma[2]*exp(theta[1]*(t*epsilon[0]+x))-gamma[1]*theta[0]^2*(omega[0]*theta[0]^2+(2/9)*omega[0]+2/9))

eq5d := collect(eq5c, {cos, sin})

(-9*gamma[1]*(((-omega[0]-epsilon[0])*theta[0]^2-(2/9)*epsilon[0]-2/9)*theta[1]^2+(2/9)*theta[0]^2*(omega[0]+1))*exp(-theta[1]*(t*epsilon[0]+x))+9*gamma[1]*(((omega[0]+epsilon[0])*theta[0]^2+(2/9)*epsilon[0]+2/9)*theta[1]^2-(2/9)*theta[0]^2*(omega[0]+1))*gamma[2]*exp(theta[1]*(t*epsilon[0]+x)))*cos(theta[0]*(t*omega[0]+x))+(-9*gamma[1]*theta[0]*theta[1]*(omega[0]*theta[0]^2-epsilon[0]*theta[1]^2+(2/9)*omega[0]+(2/9)*epsilon[0]+4/9)*exp(-theta[1]*(t*epsilon[0]+x))+9*gamma[1]*theta[0]*theta[1]*(omega[0]*theta[0]^2-epsilon[0]*theta[1]^2+(2/9)*omega[0]+(2/9)*epsilon[0]+4/9)*gamma[2]*exp(theta[1]*(t*epsilon[0]+x)))*sin(theta[0]*(t*omega[0]+x))-36*(epsilon[0]*theta[1]^2-(2/9)*epsilon[0]-2/9)*theta[1]^2*gamma[2]*exp(theta[1]*(t*epsilon[0]+x))*exp(-theta[1]*(t*epsilon[0]+x))-9*gamma[1]^2*theta[0]^2*(omega[0]*theta[0]^2+(2/9)*omega[0]+2/9)

coeffs of cos, sin and constant parts

cospart, rest := selectremove(has, eq5d, cos); cospart := cospart/cos(theta[0]*(t*omega[0]+x)); sinpart, rest := selectremove(has, rest, sin); sinpart := sinpart/sin(theta[0]*(t*omega[0]+x)); rest

-9*gamma[1]*(((-omega[0]-epsilon[0])*theta[0]^2-(2/9)*epsilon[0]-2/9)*theta[1]^2+(2/9)*theta[0]^2*(omega[0]+1))*exp(-theta[1]*(t*epsilon[0]+x))+9*gamma[1]*(((omega[0]+epsilon[0])*theta[0]^2+(2/9)*epsilon[0]+2/9)*theta[1]^2-(2/9)*theta[0]^2*(omega[0]+1))*gamma[2]*exp(theta[1]*(t*epsilon[0]+x))

-9*gamma[1]*theta[0]*theta[1]*(omega[0]*theta[0]^2-epsilon[0]*theta[1]^2+(2/9)*omega[0]+(2/9)*epsilon[0]+4/9)*exp(-theta[1]*(t*epsilon[0]+x))+9*gamma[1]*theta[0]*theta[1]*(omega[0]*theta[0]^2-epsilon[0]*theta[1]^2+(2/9)*omega[0]+(2/9)*epsilon[0]+4/9)*gamma[2]*exp(theta[1]*(t*epsilon[0]+x))

-36*(epsilon[0]*theta[1]^2-(2/9)*epsilon[0]-2/9)*theta[1]^2*gamma[2]*exp(theta[1]*(t*epsilon[0]+x))*exp(-theta[1]*(t*epsilon[0]+x))-9*gamma[1]^2*theta[0]^2*(omega[0]*theta[0]^2+(2/9)*omega[0]+2/9)

The exponentials in "rest" cancel leaving one of the equations

eq51 := expand(simplify(rest))

-9*gamma[1]^2*omega[0]*theta[0]^4-36*epsilon[0]*gamma[2]*theta[1]^4-2*gamma[1]^2*omega[0]*theta[0]^2+8*epsilon[0]*gamma[2]*theta[1]^2-2*gamma[1]^2*theta[0]^2+8*gamma[2]*theta[1]^2

We get the others from the coefficients of the exps in cospart and sinpart

eq53 := expand(coeff(cospart, exp(-theta[1]*(t*`ε`[0]+x)))); eq55 := expand(coeff(cospart, exp(theta[1]*(t*`ε`[0]+x)))); eq54 := expand(coeff(sinpart, exp(theta[1]*(t*`ε`[0]+x)))); eq52 := expand(coeff(sinpart, exp(-theta[1]*(t*`ε`[0]+x))))

9*epsilon[0]*gamma[1]*theta[0]^2*theta[1]^2+9*gamma[1]*omega[0]*theta[0]^2*theta[1]^2+2*epsilon[0]*gamma[1]*theta[1]^2-2*gamma[1]*omega[0]*theta[0]^2-2*gamma[1]*theta[0]^2+2*gamma[1]*theta[1]^2

9*epsilon[0]*gamma[1]*gamma[2]*theta[0]^2*theta[1]^2+9*gamma[1]*gamma[2]*omega[0]*theta[0]^2*theta[1]^2+2*epsilon[0]*gamma[1]*gamma[2]*theta[1]^2-2*gamma[1]*gamma[2]*omega[0]*theta[0]^2-2*gamma[1]*gamma[2]*theta[0]^2+2*gamma[1]*gamma[2]*theta[1]^2

-9*epsilon[0]*gamma[1]*gamma[2]*theta[0]*theta[1]^3+9*gamma[1]*gamma[2]*omega[0]*theta[0]^3*theta[1]+2*epsilon[0]*gamma[1]*gamma[2]*theta[0]*theta[1]+2*gamma[1]*gamma[2]*omega[0]*theta[0]*theta[1]+4*gamma[1]*gamma[2]*theta[0]*theta[1]

9*epsilon[0]*gamma[1]*theta[0]*theta[1]^3-9*gamma[1]*omega[0]*theta[0]^3*theta[1]-2*epsilon[0]*gamma[1]*theta[0]*theta[1]-2*gamma[1]*omega[0]*theta[0]*theta[1]-4*gamma[1]*theta[0]*theta[1]

ans := solve({eq51, eq52, eq53, eq54, eq55})

{epsilon[0] = epsilon[0], gamma[1] = 0, gamma[2] = 0, omega[0] = omega[0], theta[0] = theta[0], theta[1] = theta[1]}, {epsilon[0] = 2/(9*theta[1]^2-2), gamma[1] = 0, gamma[2] = gamma[2], omega[0] = omega[0], theta[0] = theta[0], theta[1] = theta[1]}, {epsilon[0] = epsilon[0], gamma[1] = 0, gamma[2] = gamma[2], omega[0] = omega[0], theta[0] = theta[0], theta[1] = 0}, {epsilon[0] = epsilon[0], gamma[1] = gamma[1], gamma[2] = gamma[2], omega[0] = omega[0], theta[0] = 0, theta[1] = 0}, {epsilon[0] = 2*(9*theta[0]^2-2)/(81*theta[0]^2*theta[1]^2+4), gamma[1] = gamma[1], gamma[2] = -(1/4)*gamma[1]^2*theta[0]^2/theta[1]^2, omega[0] = -2*(9*theta[1]^2+2)/(81*theta[0]^2*theta[1]^2+4), theta[0] = theta[0], theta[1] = theta[1]}, {epsilon[0] = 2/(9*theta[1]^2-2), gamma[1] = gamma[1], gamma[2] = gamma[2], omega[0] = 2/(9*theta[1]^2-2), theta[0] = RootOf(_Z^2+1)*theta[1], theta[1] = theta[1]}, {epsilon[0] = -1, gamma[1] = gamma[1], gamma[2] = 0, omega[0] = omega[0], theta[0] = 0, theta[1] = theta[1]}, {epsilon[0] = epsilon[0], gamma[1] = 2*RootOf((epsilon[0]+1)*_Z^2-gamma[2]*epsilon[0]+gamma[2]), gamma[2] = gamma[2], omega[0] = epsilon[0]-1, theta[0] = RootOf((9*epsilon[0]-9)*_Z^2+2*epsilon[0]+2), theta[1] = (1/3)*RootOf(_Z^2-2)}

eqI := ans[5]

{epsilon[0] = 2*(9*theta[0]^2-2)/(81*theta[0]^2*theta[1]^2+4), gamma[1] = gamma[1], gamma[2] = -(1/4)*gamma[1]^2*theta[0]^2/theta[1]^2, omega[0] = -2*(9*theta[1]^2+2)/(81*theta[0]^2*theta[1]^2+4), theta[0] = theta[0], theta[1] = theta[1]}

eqpsi := eval(eq4, eqI)

psi(x, t) = gamma[1]*cos(theta[0]*(-2*t*(9*theta[1]^2+2)/(81*theta[0]^2*theta[1]^2+4)+x))-(1/4)*gamma[1]^2*theta[0]^2*exp(theta[1]*(2*t*(9*theta[0]^2-2)/(81*theta[0]^2*theta[1]^2+4)+x))/theta[1]^2+exp(-theta[1]*(2*t*(9*theta[0]^2-2)/(81*theta[0]^2*theta[1]^2+4)+x))

eqphi := eval(eq2, eqpsi)

phi(x, t) = 3*(-gamma[1]*theta[0]*sin(theta[0]*(-2*t*(9*theta[1]^2+2)/(81*theta[0]^2*theta[1]^2+4)+x))-(1/4)*gamma[1]^2*theta[0]^2*exp(theta[1]*(2*t*(9*theta[0]^2-2)/(81*theta[0]^2*theta[1]^2+4)+x))/theta[1]-theta[1]*exp(-theta[1]*(2*t*(9*theta[0]^2-2)/(81*theta[0]^2*theta[1]^2+4)+x)))/(gamma[1]*cos(theta[0]*(-2*t*(9*theta[1]^2+2)/(81*theta[0]^2*theta[1]^2+4)+x))-(1/4)*gamma[1]^2*theta[0]^2*exp(theta[1]*(2*t*(9*theta[0]^2-2)/(81*theta[0]^2*theta[1]^2+4)+x))/theta[1]^2+exp(-theta[1]*(2*t*(9*theta[0]^2-2)/(81*theta[0]^2*theta[1]^2+4)+x)))

simplify(eval(pde, eqphi))

0

NULL

Download Sol1.mw

I don't know what happened - it disappeared just after I prepared my answer. 

restart;

myproc := proc(x) sin(x) end proc;

proc (x) sin(x) end proc

myproc2 := subsop(3=hfloat,eval(myproc))

proc (x) option hfloat; sin(x) end proc

 

 

Download proc.mw

The easiest way to extract the plot is

p := MathematicalFunctions:-Get(plot, Zeta)

Then plottools:-getdata(p[2][1]) extracts data from the plot, or use lprint(p[2][1]) to see the plot structure. As usual right-clicking on this plot can let you see various options, but I'm not aware of anything that can reconstruct the plot command. (Perhaps you were thinking about a plot component for that.)

In this case the plot can be generated by 

plots:-complexplot3d(Zeta(z), z = -4 - 10*I .. 4 + 40*I,
      view = [default, default, 0 .. 3], orientation = [-32, 68]);

though I didn't try to get all options exactly right.

(When I right-clicked on the plot from FunctionAdvisor, Maple disappeared completely, though not reproducibly!)

I found that with one of that OPs worksheets (one I loaded in that thread) with a few second delays each keystroke (not 20 s, and not always), but it did have one large plot and multiple large expressions. In the past I have attributed those delays to working from a remote disk, but that wasn't the case today.

The bottleneck seems to be the evaluation of the large number of exponentials. If I reformulate this as an (almost) polynomial in three variables, then many of the calculations run much faster. For example one of the fsolve's that took 84 minutes now takes 14 s. For the plots I made a procedure but only tested it at low resulution and didn't compare the timing. Unfortunately, in the fsolve calls where T is an output, this method does not work, and I think this is the case you are most interested in.

Campo_Médio_spin_7_2_-_Forum_new.mw

Rouben's answer is fine if you are looking only for real roots, but you seem to think there are complex roots.  Are you sure there are? You have a numerically very difficult function to solve, with your constants varying over many orders of magnitude. Working in symbolic form allowed significant simplification of your expression. I could get Analytic to finish, but it did not find any solutions despite knowing there is a root in the region.

question128.mw

See the comments on the worksheet.

restart;

with(Typesetting):
Settings(typesetdot = true):

eq1 := (r1 + r2)^2 = r1^2 + x(t)^2 - 2*r1*x(t)*cos(theta(t));
eq2 := diff(eq1, t);
eq3 := subs(diff(x(t), t) = v, diff(theta(t), t) = omega, eq2);
assume(0 < x(t));
assume(0 < t);
assume(0 < theta(t) and theta(t) < 2*Pi);

(r1+r2)^2 = r1^2+x(t)^2-2*r1*x(t)*cos(theta(t))

0 = 2*x(t)*(diff(x(t), t))-2*r1*(diff(x(t), t))*cos(theta(t))+2*r1*x(t)*(diff(theta(t), t))*sin(theta(t))

0 = 2*x(t)*v-2*r1*v*cos(theta(t))+2*r1*x(t)*omega*sin(theta(t))

The ~ after t means that there is an assumption on it. You can change or suppress this with interface(showassumed) or from the menu tools->options->display->assumed variables

xx := solve(eq3, v);

-r1*x(t)*omega*sin(theta(t))/(-cos(theta(t))*r1+x(t))

You need to tell solve to use the assumptions; it is lazy.

eqx := solve(eq1, x(t),useassumptions)[1];

cos(theta(t))*r1+(cos(theta(t))^2*r1^2+2*r1*r2+r2^2)^(1/2)

v := subs(x(t) = eqx, xx);
 

-r1*(cos(theta(t))*r1+(cos(theta(t))^2*r1^2+2*r1*r2+r2^2)^(1/2))*omega*sin(theta(t))/(cos(theta(t))^2*r1^2+2*r1*r2+r2^2)^(1/2)

Is this the simplification you want?

simplify(expand(v));

omega*sin(theta(t))*(-r1^2*cos(theta(t))/(cos(theta(t))^2*r1^2+2*r1*r2+r2^2)^(1/2)-r1)

NULL

Download solve.mw

Internally 1.23/n^1.65 is represented as 1.23*n^(-1.65), from which the results follow. On the other hand 1.23/n^2 is similarly represented, but numer and denom seem to "try harder" and give the results you expect. That is probably because normal, numer, denom are usually used for ratios of polynomials. On the last hand, 1.23/n^(1/2) works as you expect, so I guess Maple just doesn't want to deal with the floating point exponent. 

This sort of unexpected behaviour is what discourages new Maple users (and me too), so in that sense I would describe it as a bug. I submitted an SCR.

I don't know about a limit, but it's certainly more than two lines. But it can be frustrating copying parts of 2d output in terms of what gets selected. In those cases I just use lprint (that's lowercase L), which provides 1-D output, which can then be pasted into 1-D input (e.g., ctrl-m before you paste.)

First 9 10 11 12 13 14 15 Last Page 11 of 81