mmcdara

6149 Reputation

17 Badges

9 years, 72 days

MaplePrimes Activity


These are replies submitted by mmcdara

I agree with vv.
For the elder of us they are these beautiful curves we used to see on oscilloscope screen during electrical experiments at school.
For special cases of m and n these curves are dense in the unit square [-1,1]^2

plot([sin(127/11*t), sin(63/5*t), t=0..200*Pi], color=gray, transparency=0.7);

 

@Carl Love 
done (even if I have vote up for your initial answer and not for your last reply)

@Carl Love 
I think it would be helpful if this kind of detailed information that some of you provide could be archived somewhere and easily accessible to users.

@Carl Love @Kitonum
Hi,

I had thought using patmatch but I didn't find a simple way to use it.
The problem comes from the fact that c*x^a (for instance) is not of the form c*x^a*y^0.
Separating all the different "degenerated" forms of c*x^a*y^b is feasible if you have only two indeterminates (x and y)

restart;
P:=randpoly([x,y]) +123;
        3         2  2       4       2       2             
    -4 x  y - 83 x  y  - 10 y  + 97 x  - 73 y  - 62 x + 123
map(u -> if patmatch(u, (c::realcons)*x^(a::realcons)*y^(b::realcons), 'abc') then 
           eval([[a, b], c], abc) 
         elif patmatch(u, (c::realcons)*x^(a::realcons), 'abc') then 
           eval([[a, 0], c], abc) 
         elif patmatch(u, (c::realcons)*y^(b::realcons), 'abc') then 
           eval([[0, b], c], abc) 
         elif patmatch(u, (c::realcons), 'abc') then 
           eval([[0, 0], c], abc) 
         end if, 
         [op(P)]
)
  [[[3, 1], -4], [[2, 2], -83], [[0, 4], -10], [[2, 0], 97], 

    [[0, 2], -73], [[1, 0], -62], [[0, 0], 123]]


So my question : could we use patmatch  to answer the problem?

Very impressive work!
I know almost nothing about chemistry but I had a lot of pleasure tio read the full pdf.
Of course I vote up.

 

@acer 
The very first sentence of my Answer states that pf is a table...
Right, but I've never realized this.
I think it's because I try to never use variables whose type is implicitly defined by the context (such as pf[i] := ...)
Probably an overcaution due to the fact that even after several years of using Maple I am still an amateur, or a habit inherited from other languages.
This was only after Carl's reply that I used whattype(pf) to see pf was a table.

What confused me is that pf := 'pf' is an unevaluation of pf, not a declaration of pf as a table (as Carl suggested), it looks like "let's let Maple do it, he'll find the right type by itself".

By the way, why doesn't Maple affect the type Vector to pf? id it because table is more general a type?

@Carl Love 

Thanks Carl.
I hadn't realized pf was a table.
In fact I never write things like this and thus I never wonder myself what type pf might have here

restart:
for i from 1 to 3 do
pf[i] := i^2:
end do:

I  always something like this depending on the structure I want for pf.

restart:
pf := table([]):  # I undesrtood pf:=table() is enough
for i from 1 to 3 do
pf[i] := i^2:
end do:

#---- or 

restart:
pf := Vector(3):
for i from 1 to 3 do
pf[i] := i^2:
end do:

So having understood that pf is a table I understand why an explicit initialization should be needed.
 

@tomleslie 

Thanks Tom, 
I'm going to look to your file right now.
Unfortunately the dirichlet boundary conditions are not that simple (but there is some home for they are a sum of gaussians, and a gaussian is a very particular function for the heat equation).

 

 

@666 jvbasha 

Here is an updated version of contours_and_labels.mw
It introduces a gaussian filter to damp the oscillation the kriging model contains.
No pretention here, just the mood to give you some more ideas.
contours_and_labels_2.mw

@666 jvbasha 

Thanks for your feedback.
 

@666 jvbasha 

One solution before using Kitonum's code (see here 202222-Contour-Curves-With-Labels) is to build a continuous representation of the unknown function f : (x,y) --> z whose z values are gathered in your xls file.

You will find an example in the attached file.
It relies upon a particular interpolation reconstruction named Kriging, whose a simplified code is included in the file.
If you want a pretty rendering, with very smooth level curves there are chances you will be disappointed; but this comes more from the data themselves than from the strategy I used, even if a lot of improvements can be done.
Among them are:

  • A much clever choice of the level curves.
  • A prior transformation of the data ot make the ECDF (look inside the attached file) less sharp.
  • Adding a nugget effect to the Kriging interpolator introduces a natural smoothing (but the fact it might be inroduced or not depends on the origin of your data: if they come from experimental measurements then a nugget term can be justified, if they are values of some algebraic functions the nugget is just an artifact).
    A nugget effect transporms a Kriging interpolation in a  Kriging approximation (more or less in the same way that there exist interpolation splines and approximation splines) ; if your data are noisy, then introducing a nugget effect makes sense.
  • One can alo average a set of Kriging solution instead of bust using the one which gives the highest value of the likelihood, or condition the choice to the psi ranges by other means.
  • Use any other interpolation/approximation method which returns a function and not a colelction of points.


As you will see on the 3D plot the surface is almost everywhere flat excepted in narrow regions close to the boundary of the x-y domain. In the vast plain the  Kriging solution presents small oscillations which do not change the whole aspect of the surface but make extremely difficult, if possible, the plot of smooth level corves for small absolute values of z.

contours_and_labels.mw
 

@acer 

Hi, 
Is there a particular reason why you unevaluate pf just after the restart command?

@adel-00 

Your equation looks like some PDE written in spherical/polar cordinates[*] with revolution symetries (diff(u(r, theta, phi), theta)=diff(u(r, theta, phi), phi)=0)
If it is so r ranges from 0 to someting positive and changing r by abs(r) would be a wrong solution.
In this case the solution is to write symmetry conditions at r=0 (diff(u(r), r)|t=0 = 0)

But I could be wrong in my interpretation of your equation



[*] It's common to introduce an integer parameter alpha whose role is to provide a unique expression if the differential operators  in different coordinate sustems (alpha=2 -->spherical, alpha=1 --> polar/cylindrical.)

@vs140580 

I'm not sure that you have tried to understand the codes I sent you?
Or even that you have completely read all my answers?


If you use Maple 2020 (maybe it works with Maple 2019 too), look to the help page about LinearFit and search what informations can be returned.
Choose these one [parametervector, standarderrors, tvalue, tprobability].
And try to do something by yourself.

 


One more time read example.mw and example_4.mw.

Now I'm done, I hope you will find someone else with more patience.

PS: Do you know that a "complete" polynomial in p indeterminates, and with a total degree equal to d, have
K = (p+d)!/p!/d! coefficients?
And that K must not be larger than the number of observations for this polynomial to be identifiable?

@vs140580 

If your model is Y=a0+a1*x1+a2*x2+....... +a9*x9
then you have the solution in my last reply (example_2.mw and example_3.mw).
Have your read it?
PS : No need here to use PolynomialFit ;  LinearFit does the job, all the more that (cf help page) "The PolynomialFit command fits a univariate polynomial"


If your model is polynomial with terms such as x1^2 (why do you present a model of order 4? is it what you want)
or has interaction effects such as x1*x2
then you had the solution in my first answer (still with LinearFit).
But, given you have just 26 observations you won't be able to fit a model with more than 26 terms.
Which means you can fit a quadratic model without interactions (19 terms) but nothing more.
Even in this case your model will be overfitted by ordinary standards


If you do not understant how to "mix" my to answers
then look at this example
example_4.mw
If it doesn't suit you I can't do anything more for you.


By the way: a model like Y=a0+a1*x1+a2*x2+....... +a9*x9 is a usually termed "linear model".
The expression "polynomial model" is generally restricted to more complex models like
Y=sum( a[k]*f[k], k=1..K) where each f[k] is a polynomial of indeterminates  x1, ...xP where at least one of them has a total degree strictly greater than 1.
But of course your model is also polynomial with f[k] := (x1, ...xP) -> x[k]

You write "The output is from maple": what version do you use?
what is the meaning of your original question if the answer is in the Maple's help pages?

First 59 60 61 62 63 64 65 Last Page 61 of 125