## dharr

Dr. David Harrington

## 6083 Reputation

19 years, 322 days
University of Victoria
Professor or university staff

## Social Networks and Content at Maplesoft.com

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

## double check...

@michele I'm just worried that for different versions of Maple, different number of random numbers might be used, leading to a diffferent answer for later calculations, even if the first one, r, is the same. An across-versions comparison might need to save the actual polynomial to an .m file and the read them in. That seems like overkill, so try running this to see if you get the same answer, and then the timing comparisons might make more sense.

Edit: 13th Gen Intel(R) Core(TM) i5-1335U   1.30 GHz; 16.0 GB RAM, in "best performance" mode.

 > restart;
 > interface(version);

 > kernelopts(system,cputype,numcpus);

 > randomize(7136121377375);

 > r:= 87*x^10 - 56*x^9 - 62*x^3 + 97*x - 73;

 > p:=expand(r*randpoly(x, degree=10^6)): q:=expand(r*randpoly(x, degree=10^5)):
 > CodeTools:-Usage(gcd(p,q));

memory used=18.21MiB, alloc change=8.75MiB, cpu time=1.76s, real time=8.61s, gc time=15.62ms

 >

## version etc...

@michele The version of Maple could make a difference here, and the exact random numbers might not be the same (which seems to be the case in the second example because a different answer is obtained). Different polynomials might take different times so unless you average a lot of examples, it is hard to know what an average time is. So for the class polynomials you are using these might not be typical.

So are these results not acceptable to you? You are getting answers without crashes for what I would call large degree polynomials. Your CPU and real times are the same suggesting only one CPU, and perhaps an older computer without multiple cores?

## details?...

I assume grade means degree here? Some further details about typical coeffs, number of terms, degree etc would be helpful. For integer coeffs, dense or sparse number of terms, degree 10^5 seems feasible, but with both degrees 10^6, it took longer than I was willing to wait. (This was Maple 2024 on Windows 11.)

 > restart;
 > r:=randpoly(x, degree = 15); p:=expand(r*randpoly(x, dense, degree=10^5)): q:=expand(r*randpoly(x, dense, degree=10^5+20)):

 > CodeTools:-Usage(gcd(p,q));

memory used=70.30MiB, alloc change=35.88MiB, cpu time=4.72s, real time=19.49s, gc time=0ns

 > p:=expand(r*randpoly(x, degree=10^6)): q:=expand(r*randpoly(x, degree=10^5)):
 > CodeTools:-Usage(gcd(p,q));

memory used=8.03MiB, alloc change=-29.05MiB, cpu time=1.06s, real time=3.67s, gc time=0ns

 >

## not sure...

@MaPal93 I'm not sure how they are chosen. They seem to be points with integer coordinates on a grid, but I suppose if a region was too small for that then some rationals would be chosen. Note that for regions 2 and 3, the horizontal axis has no particular significance. I think the basic idea is to have any point for which evaluation proves that the equations and inequalities are satisfied; in that sense it doesn't matter where in the region it is.

## floating point limits...

@C_R With floating point limits, it is supposed to switch to numerical integration. From ?int

"If any of the integration limits of a definite integral are floating-point numbers (e.g. 0.0, 1e5 or an expression that evaluates to a float, such as exp(-0.1)), then int computes the integral using numerical methods if possible (see evalf/Int). Symbolic integration will be used if the limits are not floating-point numbers unless the numeric=true option is given."

But the alternate form also gave a numeric answer with 0..1,0..1 which is not expected, unless the floats in the integrand triggered this.

## nice analysis...

@mmcdara Very nice. Vote up.

## axes=boxed...

For axes=normal, the default, I don't know how to change this, but if you are OK with axes=boxed, then the labels are on the other side.

## allvalues...

@C_R So even for polynomials allvalues will use radicals for cubics unless told not to. So to avoid radicals, and possible missed solutions, it should be possible to tell dsolve to use solve to get a RootOf. It turns out it is not so simple, but it can be done without as much done "by hand" as I did above.

 > restart

dsolve without method

 > ode:=diff(y(x), x) = (3*x - y(x) + 1)/(3*y(x) - x + 5); ic:=y(0)=0; dsolve({ode,ic});

According to the help, (?dsolve,details), dsolve is sensitive to _EnvExplicit. so I expected this to work

 > _EnvExplicit:=false;

but no

 > dsolve({ode,ic});

But if we dsolve implicitly, now solve will use RootOf. It seems to find each solution 3 times, but it doesn't miss any.

 > dsolve({ode,ic},implicit); solve(%,y(x)); plot([allvalues(%,implicit)],x=-10..10);

 >

## need typical values of x...

@Axel Vogt Yes, I noticed that early on, but it was unclear about what exactly the poster wanted. If the poster can explain the practical range of x that they want the integral for I might be willing to look more closely. I've had success with method = _do1akc in the past with oscillating integrals. But non-dimensionalization would be a good first step; I doubt reliable numerics can be found with the parameters ranging from 10^23 to 10^(-37). m is set to 1 but I'm not sure if this is just a test parameter. If it is later to have very different values that also would make a big difference since it multiplies x.

## missing x and difficult integrand....

We are still missing a value for x.

The first integral is problematic, since the integrand

`(-epsilon^2/(4*a^2) - tau*epsilon^3)*(cos(epsilon*x) - 1)/epsilon^2`

goes to infinity as epsilon goes to infinity because of the tau* epsilon^3. Is the first factor perhaps intended to be within an exp?

## OK...

@Carl Love OK, thanks for that.

## row indexing...

If you reorganize the dataframe so the your Data are the row labels (which seems logical to me but may not be what you want), then you can just select the rows and columns by indexing:

`TestData[["LC3", "LC4", "LC5", "LC6", "LC7", "LC8", "LC9"], Load];`

dataframe.mw

## polar...

@C_R I think Maple intends polar to serve that purpose - you can do arithmetic with it, but you need evalc() or simplify() to get back to the Re/Im form.

 >
 >

 >

 >

 >

 >

 >

 >

 >

 >

## qualifications?...

@Carl Love Generally true of course, but the statement needs some qualification.

 >

 >

Sample solution

 >

 >

## unable to reproduce...

I am unable to reproduce this (Maple 2024, Windows 11). After the reformatting thw worksheet runs correctly.

cost_comparison_-_liquid_(v01MP).mw

 1 2 3 4 5 6 7 Last Page 1 of 62
﻿