acer

32358 Reputation

29 Badges

19 years, 332 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@TomM Those older kinds of plot persistence, such as for axis style, (manual) sizing, etc, are implemented by design, I believe.

But it's obviously undesirable when thumb-nailing gets applied while rendering singleton plot output not even part of a sequence or an assignment statement.

 

@mapleq2013 That call to map is applying its first argument (a procedure) to its second argument (which happens to be a Matrix in your example).

The procedure being mapped across the Matrix is this:

u -> simplify(simplify(combine(u)),size)

That procedure does three nested operations. Each might do a different kind of "simplification", which is a broadly used term. It's possible that the inner use of combine had little or no useful effect, where I used it.

The u is the formal parameter of that procedure. The procedure will get called on each element of the Matrix, and so (in turn) each element will be used as a value of u.

For example,

M := Matrix( [[1,2], [3,4]] );
                                      [1  2]
                                 M := [    ]
                                      [3  4]
map( u->sin(u)^2, M);
                             [      2        2]
                             [sin(1)   sin(2) ]
                             [                ]
                             [      2        2]
                             [sin(3)   sin(4) ]

Sorry, I'm not sure what else might be unclear to you about this.

@mapleq2013 

1) M[i,j,..] means the whole 1-dimensional portion of Array M, where i and j are fixed and the third index runs its whole range. In this example the third index of M goes from 1 to 6. In this example M[i,j,..] is the same as M[i,j,1..6] or M[i,j,1..-1] or M[i,j,1..] or M[i,j,..-1].

This form of indexed accessing of an Array is allowed for both extraction and for assignment. In this case I am using it on the left hand side of an assignment statement, for assigning into M. Here I assigned a 6-element Vector into this portion of M, though alternatively I could insert a 6-element Array. See also this help-page.

2) Yes, I used seq to repeat something 6 times, ie. for i=1..6. The increment of the seq command is 1, by default. Yes, I was extracting 2-dimensional Arrays from the 3-dimensional Array M. It is clear that you have already figured out most all of this.

matrixplot has a few options to display 2-dimensional data differently than as a surface (ie. as a histogram, too). But when used to show a surface there is not too much difference from surfdata. But one important difference is that the tickmarks on the two dependent axes from matrixplot are just the index values of the Array or Matrix. But surfdata accepts two additonal arguments to specify arbitrary ranges for the tickmarks shown on the two independent axes.

The map command applies its first argument across the entries of its second argument (which is usually something indexable). The map and the eval commands do two quite unrelated things.

3) I confess that since I was producing a grid of points for a only a finite grid (for plotting purposes) I did not take the time to examine just how close any pair of the surfaces got, or what their qualitative behaviour is where they get close. I may have jumped the gun there, sorry.

4) Maple is quite capable of doing numerics well, and fast, though that is not very widely known. Many people get caught by the fact that there are often several or many ways to do something in Maple, and often only a few of those ways are most efficient. Numerics in Maple is not a stranger to this issue.

Sometimes you'll find problems for which it makes sense to compute a general symbolic answer and then evaluate that at many numeric sets of values. And sometimes that will be slow, and it'll turn out to be better to do the many numeric computations instead.

@necron Well, in several of your test cases you are evaluating at y=something_less_than_Pi and your c33 becomes identically zero due to the piecewise produced by f1(y).

I do not understand why you'd want to introduce a multiplicative piecewise term like f1(y) and make the integrand discontinuous when you could instead just split the y-integral into a few more smoother pieces. Numerical quadrature methods often rely on smoothness.

@shoeless You can (as of some recent release, 2015?) utilize the command Units:-UseUnit to set the preferred unit for its corresponding dimension. So in this case Unit(cal/mol) for the dimension length^2*mass/(time^2*amount).

The upshot of that is that expression in terms of units having that dimension will simplify to that preferred unit.

In the case of your worksheet the answer you were looking for drops out right away.

Note that you had an earlier question about this kind of definite integral, which is handled badly in the purely symbolic case. And int doesn't know much about the nature of Unit things, ie. that they're not just symbols. In that earlier question the use of map did better.


restart

Units:-UseUnit(cal/mol):

T__sys := 64.47487*Unit('K'): 

NULL

Pure Component Parameters

 

NULL

REVIEW-1

 

Aspen Plus | Methods | Parameters | Pure Components

``

enam := "METHANE":

mwgh := 16.04276*Unit('g'/'mol'): 

DHFORM := -17798.79622*Unit('cal'/'mol'): ``

T__c := 190.564*Unit('K'):   ``

T__sys/T__c

.3383370941

``

 

CPIGDP-1

 

Aspen Plus | Methods | Parameters | Pure Components

 

CPIGDP__1 := 7.953090666*Unit('cal'/('mol'*'K')): ``

CPIGDP__2 := 19.09166906*Unit('cal'/('mol'*'K')):``

CPIGDP__3 := 2086.9*Unit('K'): ``

CPIGDP__4 := 9.936466991*Unit('cal'/('mol'*'K')): 

CPIGDP__5 := 991.96*Unit('K'): ````

CPIGDP__6 := 50*Unit('K'):  ``

CPIGDP__7 := 1500*Unit('K'): ``NULL

NULL

````NULL

Pure Component Ideal Gas Enthalpy Calculation [THRSWT/7]

 

NULL

Ideal Gas Heat Capacity Equation (DIPPR 107)

 

Aly and Lee 1981

``

C__p := proc (T) options operator, arrow; C__1a+C__2a*C__3a^2/(T^2*sinh(C__3a/T)^2)+C__4a*C__5a^2/(T^2*cosh(C__5a/T)^2) end proc:````

NULL

Required Pure Component Parameters

 

``

C__1a := CPIGDP__1:

C__2a := CPIGDP__2:

C__3a := CPIGDP__3:

C__4a := CPIGDP__4:  

C__5a := CPIGDP__5: 

C__6a := CPIGDP__6:

C__7a := CPIGDP__7:``

``

C__p(T__sys) = 7.953090666*Units:-Unit(('cal')/(('mol')*('K')))````

``NULL

Ideal Gas Enthalpy

 

NULL

T__ref := 298.15*Unit('K'):

NULL

HIG := proc (T__2) options operator, arrow; DHFORM+map(proc (e) options operator, arrow; int(e, T = T__ref .. T__2) end proc, C__p(T)) end proc:

HIG(T__sys)

-19682.67422*Units:-Unit(('cal')/('mol'))

NULL

NULLNULL


Download Int_Units_modif2.mw

 

I now see that there is such a crossing of eigenvalues roughly similar to what I described above.

It's easier to see in 2D with curves than with the 3D surfaces. So I substitute y=sqrt(3)*x into Matrix C, to reduce by one dimension. The plot of the 6 eigenvalues will now be 6 curves which represent the six spaces curves where the previous 6 surfaces intersect with the place y=sqrt(3)*x.

(I ran this in Maple 2015.1 because it's about three times faster than in Maple 12.02. But the worksheet loads in Maple 12.02 and if re-executed produces the same 2D plots.)

ex_modif3.mw

Here are the spacecurves where the 2nd, 3rd, 4th, and 5th surfaces intersect with y=sqrt(3)*x. Here is it in color.

And here it is in black, which I think shows the issue more clearly.

It is clear, I believe, that the blue curve is not tracking the "same" eigenvalue over all x values. Sure, the blue curve data and the green curve data together track two eigenvalues. But the coloring flips when it ought not.

This is all an artefact of the order of the eigenvalues, whether done by sorting the Eigenvectors or by the sorting that fsolve does.

And so the 3D surfaces have the same issue, I believe. Four of the colored surfaces may be "falsely" switching between eigenvalues, where the surfaces meet. If you display together just surrfaces 2 and 3 then at some rotation angles the switchovers are apparent.

In other words: the previously plotted surface 2 does not correspond to "one particular" eigenvalue (if you know what I mean...). But surfaces 2 and 3 (or 4 and 5) appear to represent a mashup of a pair of eigenvalues.

I somewhat doubt that this issue can be resolved easily using only implicit RootOfs to represent the 6 generic roots (eigenvalues). But I haven't experimented with even that.

@2cheakk The original question tried to plot from u=0 to u=10, so I took that as the goal. Often it helps to provide as much information as possible (to `simplify` or `int`, etc). It may not have made an impact.

@Prashanth Please take the time to describe your more "general" problem. It does not make sense to write about a "general solution" when you have not outlined the family of candidate problems.

Are all your problems going to be bivariate? Are they all going to involve (only) linear inequalities?

@Prashanth Reverse order in the list [x,y] of variables (as the 2nd argument passed to `solve`).

sol := solve([x-y = 10, x+y < 100], [y,x]):

convert(convert(op([1,1],sol),RealRange),relation);

                  And(-infinity <= y, y < 45)

which typesets like -infinity <= y <= 45 in the GUI.

Similarly,

solx := solve([x-y = 10, x+y < 100], [x,y]):
convert(convert(op([1,1],solx),RealRange),relation);

                  And(-infinity <= x, x < 55)

This kind of approach can get difficult, as the example becomes more complicated. This kind of thing has been asked before. It'd be nice if `solve` itself could do the heavy lifting.

It occured to me that obtaining the desired form (from what I got with a mapped int call) might possibly be accomplished with these replacement rules:

> rule1;

         2 (exp(2 a) - exp(2 b))        coth(b) coth(a) - 1
    - ----------------------------- = - -------------------
      (exp(2 b) - 1) (exp(2 a) - 1)        coth(-b + a)    

> rule2;

               coth(b) coth(a) - 1               
               ------------------- = coth(-b + a)
               -coth(a) + coth(b)                

I don't know how to obtain that rule1 except by some rather ad hoc business of adding/subtracting or multiplying/dividing key terms to numerator/denominator, with judicious partial simplification/expansion/etc.

The second one is easy to create programatically,

> convert(expand( coth(a-b) ),coth) = coth(a-b);

               coth(b) coth(a) - 1               
               ------------------- = coth(-b + a)
               -coth(a) + coth(b)                

I didn't actually try to use these, via applyrule, on the summands of the mapped int result for the given example.

@SRINIVASA RAGHAVA Your document appears to be essentially empty.

The only content in your attachment is an execution group whose input is the empty string. Ie,

Typesetting:-mrow(Typesetting:-mi(""), executable = "false", mathvariant = "normal")

 

@SRINIVASA RAGHAVA You haven't succeeded yet. When you use the Big Green Arrow you have to 1) select the file, 2) hit the "Upload" button, and then 3) scroll down in the popup and hit either the "Insert Link" or "Insert Contents" button.

Where is the attachment?

acer

@fzfbrd

Change your,

CrssOfVds := VDS -> ArrayInterpolation(Vds, Crss, V)

to,

CrssOfVds := VDS -> ArrayInterpolation(Vds, Crss, VDS)

And change,

Q := evalf(Int(CrssOfVds, Vdson .. Charge_Vds)

to,

Q := evalf(Int(CrssOfVds, Vdson .. Charge_Vds, epsilon = 0.1e-6))

That gets me a result of 2.96204101072752*10^(-9).

I found that at your default working precision of Digits=10 the epsilon tolerance for the evalf/Int call had to be at least about 1e-8. You can experiment with the working precision and that epsilon tolerance. (I don't know how accurate you want the result to be.)

Alternatively you could (and probably should) change that call to ArrayInterpolation to include the method=spline option. (See my Answer below.) That allows a result to attain even without using the epsilon option of evalf/Int, at default Digits=10.

Ie, on my 64bit Linux version of Maple 2015.0 I am seeing,

CrssOfVds := VDS -> ArrayInterpolation(Vds, Crss, VDS, method = spline):

Q := evalf(Int(CrssOfVds, Vdson .. Charge_Vds));

                 2.96479729742643*10^(-9)

Note that there is a distinction between obtaining a highly accurate numeric estimation of a crude (linear, say) interpolation, versus obtaining a numeric estimation of a higher degree (and likely more correct) interpolation. There's not much point in obtaining many digits of a crude linear interpolation. You'd be better off with a modest number of accurate digits of a higher degree (better fitting) interpolation. Hope that makes sense.

But of course if you are working with experimental data that is likely subject to noise then it may well be that only a few digits can even be meaningful. This might also be a good time to mention that if your data is experimental and subject to noise then you  might also consider the distinction between interpolating the data and smoothing (or fitting it) it. The interpolation schemes discussed here will pass directly through the data points. But it may be that experimental data merely approximates some physical process, in which case an interpolation which directly passes through the data points may not actually give the best approximation of the area under the abstract curve represented by the actual physical process. It may turn out that a smoothing of the data (of which a numeric "fit" is one example) might give a curve whose area better represents that of the actual physical process. In practice the difference may be indiscernable, up to the degree of noise present. Sorry if this is all obvious. You may well be (already) only expecting a few decimal digits to be trusted in any numerical estimate.

Here is my edited worksheet. (...you'll have to change back the definition of ThisDocumentPath, to run it.) 

Fet_Cap_modif.mw

I have seen a similar problem when I have a running worksheet that is minimized to the desktop tray (MS-Windows), and if I have the GUI set up to always ask whether to use a new or shared kernel for each new opened document.

In this situation, when I double-click the Maple launch icon the kernel-query-popup can be present and waiting but suprressed from view.

In this situation I can sometimes simply hit the Enter key and so clear the waiting query-popup.

acer

First 324 325 326 327 328 329 330 Last Page 326 of 592