Carl Love

Carl Love

28055 Reputation

25 Badges

12 years, 364 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are replies submitted by Carl Love

@adrian5213 Just add ,rn to the return statement.

Do you mean the tensor package? There is no standard package named debever, but ?debever takes you to help about the tensor package.

Here's a Maple worksheet that does it.


restart:

temps:= [0, 10, 20, 30, 50, 80, 100]:

 

concs:= [1,2,4,8,12,16,20,24]:

 

densities:= Matrix(
     8, 7,
     [[1.0033, 1.0029, 1.0013, .9987, .9910, .9749, .9617],
      [1.0067, 1.0062, 1.0045, 1.0018, .9940, .9780, .9651],
      [1.0135, 1.0126, 1.0107, 1.0077, .9999, .9842, .9718],
      [1.0266, 1.0251, 1.0227, 1.0195, 1.0116, .9963, .9849],
      [1.0391, 1.0370, 1.0344, 1.0310, 1.0231, 1.0081, .9975],
      [1.0510, 1.0485, 1.0457, 1.0422, 1.0343, 1.0198, 1.0096],
      [1.0625, 1.0596, 1.0567, 1.0532, 1.0454, 1.0312, 1.0213],
      [1.0736, 1.0705, 1.0674, 1.0641, 1.0564, 1.0426, 1.0327]
     ]
):

n:= nops(concs):  m:= nops(temps):

Temps:= <`$`~(temps, n)>:

Concs:= <op~([concs $ m])>:

Densities:= <convert(densities, list)>:

 

V:= [t,c]:  deg:= [3,3]:

poly33:= [op(expand(mul(add(V[j]^k, k= 0..deg[j]), j= 1..nops(V))))]:

dens:= Statistics:-LinearFit(poly33, <Temps | Concs>, Densities, V);

HFloat(0.999827834949608)+HFloat(0.0035296553038636205)*c-HFloat(2.4310027666692226e-5)*c^2+HFloat(2.1317696091887753e-7)*c^3+HFloat(2.7032609112586373e-5)*t-HFloat(2.1306485300650898e-5)*t*c+HFloat(5.109610725598598e-7)*t*c^2-HFloat(5.615941220840037e-9)*t*c^3-HFloat(6.015095308141257e-6)*t^2+HFloat(2.2177754561062198e-7)*t^2*c-HFloat(4.0121110835311455e-9)*t^2*c^2+HFloat(9.663636955724667e-11)*t^2*c^3+HFloat(1.5893434605505464e-8)*t^3-HFloat(1.4989540552602354e-10)*t^3*c-HFloat(4.967636004952312e-12)*t^3*c^2-HFloat(4.948269477780804e-13)*t^3*c^3

(1)


plots:-display(
     plot3d(dens, t= 0..100, c= 0..24),
     plots:-pointplot3d(convert(<Temps|Concs|Densities>, listlist), color= red),
     axes= normal
);

 

 


Download NH4Cl_density.mw

@adrian5213 Yes, it's easy using the same binary converter that I gave above with a new operator that gives the quotient and remainder.

`&B`:= (ex::uneval)->
     subsindets(eval(subsindets(ex, integer, convert, decimal, 2)), integer, convert, binary):

QR:= proc(N::integer, n::integer) local r, q:= iquo(N,n,r); [q,r] end proc:

&B QR(010100111, 10010);

@tomleslie You don't need to worry about options c[3], c[4], c[5]. The first, c[3], only applies if itask = 4 or 5; you're using itask = 1 (the default). The other two, c[4] and c[5], only apply if you're using one of the -band submethods of lsode; you're using submethod adamsfull. These options specify how many super- and sub-diagonals, respectively, of the jacobian to use. Personally, I think that using a jacobian-based method for such a "wild" RHS is a bad idea. I think that the submethod should be changed to adamsfunc, which uses no jacobian.

@Kitonum Sigh. I guess that it's yet another difference between 1D and 2D input. I guess that as the 2D input is internally translated to 1D, an extra level of evaluation occurs.

@mskalsi Your errors have nothing to do with my code. Your first error, Error, recursive assignment, happened because you tried to use A in two ways. You wanted it to be both the name of the Matrix and one of the coefficients and hence one of the entries of the Matrix. A Matrix can't contain itself as own of its own entries. An attempt to do it is called a recursive assignment.

Your second error is caused by essentially the same thing, but in a more subtle and insidious way. You are trying to use both A[1] and A as separate variables. But they aren't separate, as the following shows:

A[1]:= 7:
A:= 3:
A[1];

     

If you want to use both A and a subscripted form of A in the same program, then use A and A__1 (the 1 can be replaced by anything). The A__1 will appear subscripted in the output (and also in the input since you're using 2D input). These will be treated as completely separate variables.

Regarding the disordering caused by indets: The order in the final Matrix is determined by the order in the Vector product <U[1],U[2]>.<a[1] | a[2]>; the order returned by indets is irrelevant.

 

@marc sancandi Please excuse me: I misinterpretted something that you said. I thought that you said that you'd used Maple for 25 years primarily for its dsolve(..., numeric) command. Anyway, I recommend that you try the things that I suggested, especially the infolevel.

@Kitonum The [T=~C] works in Maple 16. Does it not work in your Maple? The elementwise operators do in general allow "naked" expression sequences as operands, as long as they are one level of evaluation away from being "explicit".

@tomleslie You asked,

If maxfun=-1 does not remove the limit on the number of calculations, does anyone know what does?

Everything seems to be different for lsode, perhaps because it was written externally. See the help page ?dsolve,lsode,advanced, in particular the input option c[10] = mxstep and the output option c[12] = istate = -1. Note that the option is mxstep, not maxstep.

@marc sancandi The method lsode is the most heavily documented of the methods, and it has by far the greatest number of options. I'd like to direct your attention to the help page ?dsolve,lsode,advanced, in particular to the input option hmax and the output option istate.

You can set infolevel[`dsolve/lsode`]:= 2 to get more information about what lsode is doing.

You are free to read the code of the numerous `dsolve/numeric/...` procedures.

If you are a numerical analyst who has used Maple, primarily dsolve(..., numeric), for 25 years, then the fact that you haven't mentioned doing any of the above things is most disturbing and leads me to believe that you are a provocateur.

@Christian Wolinski Yes, your first line of code gives 25 solutions.

Your second block of code gives a warning and NULL output.

I don't know if it accepts inert Products. I'd be surprised if it can solve any. What exactly did you have in mind?

@Carl Love Well, does the above code do what you want?

@Christian Wolinski 

I can't duplicate your results in Maple 16. Giving your command directly gives an error message because the second argument is not meant for specifying the variable of the system. If I give your command with just the first argument

isolve((x > 3/2, x < 5/2});

then the correct answer is returned immediately.

@Doug Meade Actually, I meant irreproducible, as in No experiment is valid with irreproducible results; but I'll concede that better phrasing is No experiment is valid without reproducible results. Thanks for catching the error; I've corrected the original.

First 432 433 434 435 436 437 438 Last Page 434 of 709