185 Reputation

6 Badges

11 years, 27 days

MaplePrimes Activity

These are replies submitted by wswain


As always.  Thank you.

I had updated the code to initiate the variable, but was waiting to see the reply before running.

Found a couple "minor" typo's and got the debugger working where I also found a syntax problem, [ ] needed versus () for matrix index, causing the grief.   


@Carl Love 

Thank you for replying and that you use these. 

I used error in my decription for ease of reading.  The variable is actually error_now and compared to error_tol set.

I am not sure why when I tried to change the execution group to Maple Input (with F5 and by the pull down) and it kept responding as in 2-D mode even though it said "maple input" in the bar.

I went ahead and created a code block to ensure 1-D entry and the operator took.

However, I am still getting an error.   (Not pretty code yet) as I'm trying to fix the recursive while loop flow problem and havent applied the vector to run through.  Please find:

Trial := proc() 
    local y2, test1, iterations; 
    y2 := Vector(5, fill = 0.); 
    y2[5] := 1; 
    test1 := 1.0; 
    while 1e-5 < test1 do
        test1 /= 2.0; 
    end do; 
    end proc;

Error, (in Trial) recursive operator assignment

It seems like valid code iterative calculations.  Any assitance greatly appreciated.


@Carl Love 


As to what am I trying to accomplish?  I often do not know when I run into MATLAB commands that are unusual like "deal".  I appreciate the response about why it exists as the reply was exactly in the direction I was thinking and you've both helped clarify.

Kind Regards,



This is helpful.   I love Maple for its math capabilities.  I struggle with converting the documents into professional reports for delivery to the customer with the embedded math, but hiding the commands such as restart and the set-up like "with(XXX)", or UseUnits, etc.



It looks like the answer still requires the command "convert" which I was trying to avoid as combersome looking for a report, but I'll go for hiding this.  The context menu doesn't seem to allow the same conversion as stipulated via the convert command.


@Joe Riel 

I am struggling as I'm kinda used to the regular debugger of ifort, MS C++, etc. with pretty easy controls of walking through of loops and function levels to finally find - maybe a simple syntax call error.

I'm finally really using Maplesoft in a more coding level and find the stepping through debug a challenge.

I used your example and see how that kicked open the debugger (thumbs up).   The next thing was to assign i:=1 to restart and begin single stepping.  In this simple case the problem identifies pretty quick.  But, I could not iterate one at a time to watch the flow from 1, 2, 3 - boom, which on a much bigger process loop may not be so obvious.

Am I missing something in how to do this?



@Joe Riel 

Hi Joe, 

Thanks for your reply.  I'll incorprate the stoperror('all');  ...  somewhere.

The iterative "for loop" resides in a worksheet.

It calls Property() from the thermophysical,coolprop package.

The crash is an error -> 

"Error, (in ThermophysicalData:-CoolProp:-PropsSI) Two-phase inputs not supported for pseudo-pure for now : PropsSI("Z","P",1289238.529,"T",112.1727954,"Air")"

From this error it looks like I've hit the saturated vapor line for the iteration at 112.17K.    This would look correct on a T-s plot for the isentropic process.   

I might have the answer through a different way to do debugging without single stepping up to the error, but do find it frustrating to not be able to stop say 5 iterations before the break-out and then single step through to follow what's happening in code vs. physlcs world.

The value returned from the error "1289238.529" is suspect and I don't recogize this.  The PropsSI call is a subfunction of Property and this call is getting Z, compressibility, but I did not ask for this that I am aware of, so is has to be sub-process.   I did achieve 412 iterations with what looks like physically resonable answers until it "error'ed" out.

I would presume the thermophysical package "property" method/procs are locked would not let single stepping into them, and so would:

"Stoperror('all'); allow to watch the process up to the error?

Any assistance with debugging techniques into Maplesoft packages from a worksheet level call (within "for loop") and tracing the variable through until the error would be very helpful.



After my initial rsponse it occured that you're most likely trying to solve psychrometric problems with water vapour (?).   There is a different module in Maple for psychrometrics.  Specifically, if you search help on psychrometrics you'll see examples and how to potentially find the solution you're looking for.

If you're looking at saturated vapour with quality 1.0 or >  then this might be a better place to start as that falls on the pressure temperature line for vaporization and above.



I use thermophysical data package all the time.  From what I can see you've asked for Pressure for water in the solid state (233K is < freezing point) with a mass vapor quality of 1.  These two conditions are physically incompatible.  

    PropsSI is only valid for > freezing state.  Hence the error range says must be > 273K.

This link shows the valid range for PropsSI with water (bottom of page table)

Hope this helps,


The main reason I've gone down this path is the units carried through within the Matrix elements don't seem to work well with certain functions such as Statistics:-Mean  hence the unit_free step and checks for reapplying later.   

The goal is to do the math and then preset the results with correct units (i.e. create variable for the combined units as a unit conformity check, strip (unit_free) to allow other packages to work on the matrix then re-apply the correct dimensions.

The final result is getting to an output with units.  (P.S., I know the Mean in this sheet is not a real mean physically for the workseheet at this stage - its a test of the package function and the call to it.

If I'm not approaching this correct, please - all help accepted.  I'd love for the units to carry through without the problems.  I do know some funtions must be unitless.



Please find attached.

I am still trying to work out Matrices with units, dataframes and rTables as final outputs for presentation in a report (i.e., excel looking with Row's column headers.

Please see attached.

Based on the replies, does #mi or #mo (etc.) become MathML when enclosed in the single, left facing quotes instead of a comment via the # symbol?



Thank you Tom for the clear response.

I was trying to avoid the addition of the explicit "convert(%, units, 1/minute);" to get to the units desired.  I most often use the context window to change it to the units desired and let the SW handle all the conversion math.   This ensures to me that a bad conversion factor hasn't been used and I get dimensional checks.  (1/time and Hz vs. rev (cycle) get dimensional hiccups)

The main issue I was having was using " per 'rev' " as circumfrence length per revolution (rev) as units where maplesoft has rev as 2*pi radians and uses an awkward "length(radians)" unit which confuses my dimensional checking head.

I can live with 1/time where 1/"time each rev" = rev speed (not a unit, but a description).



I know that we use A*e^b*t  all the time for time series of growth or -b*t for decay.

I had always assumed the t carried the seconds.   

After posting and doing a bit more digging into the dimensional analysis ALL power exponents must be dimensionless - which makes sense.  you can't exponent time (or other) dimension as an independent variable (or as a single number either).

Therefore, b must carry 1/s to cancle the time dimension.

My recent post was about getting the coeffients and I now have the 'b' to rebuild/recast the solution with units by adding Unit(1/s) to 'b'. 

Still stumped why 'A' returned correct in the eqn form, but not correct in output = parametervalues or parametervector.




Understand, thanks.

P.S., You didn't comment on actually doing the nonlinearfit (or exponential fit) with a dimensioned matrix, or vectors.

Is this not possible?

I note your over-complicated statement.  Is there a cleaner way to strip or send dimensioned data into a regression solver (linear or nonlinear)?




I've been working with output = parametervalues and output = parametervector after I posted the original.

I do get a two values.   How can I assign them back to two variables?  I tried (a1,b1):= to assign the two onto the new variables for use.  The error was saying I was trying to assign 2 variables from 1 item (the vector results)

Also, The orginal A_Const and C_Const are not assigned these results.

As additional info/question:

I also used:  ExponentialFit with output = paramatervalues.

The result showed 0.43*e^3.2854....    

the plot showed good agreement to the data - However:

The  output = parametervalues  returned [-0.8384..    3.2854..]

How could these be so different?   i.e, var1  showing as 0.43 is correct,    -0.8384..  is not.  

Thanks in advance,


1 2 3 4 Page 1 of 4