acer

29899 Reputation

29 Badges

18 years, 203 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@C_R The OP is using Maple 18 (released 2014), not Maple 2018.

@Ali Hassani The first bullet point of the Rules section of the Help page for define begins, "A rule can be an equational rule specified using the syntax of patmatch, or...".

And the Help page for patmatch describes these terms: nonunit, conditional, and _type.

The terms algebraic, anything, identical, and freeof are Maple types.

Regarding your additional requirement, an additional rule can be added,

restart;

 

define(T,T(a::nonunit(algebraic)+b::nonunit(algebraic))=T(a)+T(b),
         T(a::nonunit(algebraic)*x^n::integer)=a*T(x^n),
         T(a::nonunit(algebraic)*f(x))=a*T(f(x)),
         'conditional'(T(a::anything)=a*T(1),
                       _type(a,And(Not(identical(1)),freeof(x)))));

 

T(alpha__1*x^2*y+alpha__2*x^4*t+alpha__3*t*y);

t*alpha__2*T(x^4)+y*alpha__1*T(x^2)+alpha__3*t*y*T(1)

T(3*t*x^(-2)+4*alpha*t^4*f(x));

3*t*T(1/x^2)+4*alpha*t^4*T(f(x))


Download define_ex2.mw

@Preben Alsholm A partial result,

restart;

sol:=y(x) = (exp(RootOf(-sin(x)*tanh(1/2*_Z+1/2*c__1)^2+sin(x)+exp(_Z)))+sin(x))/sin(x);

y(x) = (exp(RootOf(-sin(x)*tanh((1/2)*_Z+(1/2)*c__1)^2+sin(x)+exp(_Z)))+sin(x))/sin(x)

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

diff(y(x), x)-cot(x)*(y(x)^(1/2)-y(x)) = 0

sol1,sol2:=allvalues(sol);

y(x) = (exp(-c__1+ln(-1+2*(-sin(x)*exp(c__1))^(1/2))+(2*I)*Pi*_Z1)+sin(x))/sin(x), y(x) = (exp(-c__1+ln(-1-2*(-sin(x)*exp(c__1))^(1/2))+(2*I)*Pi*_Z1)+sin(x))/sin(x)

simplify(evalc(simplify(sol1)),radical) assuming c__1::real, x>0, x<Pi;
simplify(evalc(odetest(%,ode,y(x)))) assuming c__1::real, x>0, x<Pi;

y(x) = ((2*I)*exp(-(1/2)*c__1)*sin(x)^(1/2)+sin(x)-exp(-c__1))/sin(x)

0

simplify(evalc(simplify(sol2)),radical) assuming c__1::real, x>0, x<Pi;
simplify(evalc(odetest(%,ode,y(x)))) assuming c__1::real, x>0, x<Pi;

y(x) = (-(2*I)*exp(-(1/2)*c__1)*sin(x)^(1/2)+sin(x)-exp(-c__1))/sin(x)

0

Download nm_odetest_simp_ex1.mw

@Preben Alsholm Since historically there can be more than one numeral after the first period (or, just one), then one might Search for the leading comma instead.

Eg,

str:=convert(kernelopts(version),string);

   "Maple 18.02, X86 64 LINUX, Oct 20 2014, Build ID 991181"

str[7 .. StringTools:-Search(",",str)-1];

              "18.02"
str:=convert(kernelopts(version),string);

   str := "Maple 2024.0, X86 64 LINUX, Mar 01 2024, Build ID 1794891"

str[7 .. StringTools:-Search(",",str)-1];

              "2024.0"

@jrive Do you understand that the two forms are not always equal?

Your code's primary issue is that you have no procedure named shoot defined.

So the function call shoot(....) simply returns unevaluated, and isn't a result suitable for passing to odeplot, etc.

@dharr I didn't mean to sound at all harsh, and apologies if I did in any way.

I'm just at a loss to understand what aspects the OP wants to be done less "by hand". If (as you say) the OP knows the form of eq13 then I'm unsure as to the main point of all this rearrangement. But perhaps your approach is exactly what the OP is after.

It just seems a bit like writing down the answer, manually, to me. Or, at most, typeset rearrangement more than actual computation. But maybe that's just me. And (even if so) is fine, naturally, if typeset exposition is a major part of the goal.

It seems to me that this construction gets the effect but is accomplished entirely by hand; no factorization is done programmatically.

@mmcdara Fwiw (using Maple 2023.2 as the OP did),

restart

NULLeq1 := (R2+Rhi)*R1/(R1+R2+Rhi) = RloNULL

(R2+Rhi)*R1/(R1+R2+Rhi) = Rlo

 

NULLeq2 := R1*Rlo/(R1+Rlo)+R2 = RhiNULL

R1*Rlo/(R1+Rlo)+R2 = Rhi

`assuming`([evala({solve({eq1, eq2}, {R1, R2}, explicit, useassumptions)})], [positive, Rhi > Rlo])

{{R1 = ((Rhi-Rlo)*Rhi)^(1/2)*Rlo/(Rhi-Rlo), R2 = ((Rhi-Rlo)*Rhi)^(1/2)}}

Download for_help_jrive_acc.mw

As for queries about using evala, there are lots of examples for which simplify does not rationalize (...radicals in the denominator). Sometimes expand@rationalize gets the desired effect. I usually submit reports about such examples exhibiting weakness in plain simplify.

Simplification is not easy, and has to deal with potential blowups. It uses a different heuristic organization than just trying every hammer.

@jrive I suppose "few" is the wrong term, sorry. Of course there are many elementary and special functions, etc, which can return any unevaluated  call.

All I really meant was that seeing such may be a hint that something's not gone right. (An unevaluated return to implicitplot might mean that plots were not loaded, as another example.)

I don't know of a list of such commands. One is fsolve, whose unevaluated return indicates that no numeric root was found. (That can be slightly awkward to manage, but persists at least for backwards compatibility.)

There are few commands (aside from elementary, special functions, etc) in Maple that can return unevaluated, and solve isn't one of them.

So the apparent return of an unevaluated solve call was a hint.

@jrive From you last image it appears that there is a space between solve and the opening bracket?

That would make it a multiplication, not a function call.

(It'd be more helpful to attach the actual worksheet, in such a situation that the return appeared like your last image.)

You don't need any conversion. Maple's .mw files are already stored as XML.

Just upload and insert a link to the file using the green up-arrow in the Mapleprimes editor.

So far, you haven't provided a link.

@Ronan If your results were itself an expression sequence then you could keep it that way. You don't have to make it a list or Vector to accomplish this kind of thing.

@C_R It is indeed referenced on the ?solve,details Help page -- one of several by links to ancillary methods/functionality.

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