Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X
Hi all experts
Hope you could do me a favor.
How could i express the following series order with programing function?
Tks
Ton is the constant value and Toff(t) is variable by having different "duration" Ton, Ton+T1, Ton+T1+T2
Solved! Go to Solution.
You may try a recursive approach either using he if-function
or the if-statement
And here is a non-recursive approach which should be more efficient for larger values of n
We can get rid of the local variable Rlast but have to treat n=1 as a special case and so have to use an if-statement
We can also hide that if-statement using a boolean factor
You may try a recursive approach either using he if-function
or the if-statement
And here is a non-recursive approach which should be more efficient for larger values of n
We can get rid of the local variable Rlast but have to treat n=1 as a special case and so have to use an if-statement
We can also hide that if-statement using a boolean factor
Hi Werner
Thank you for the help.
If i would have better understand the logical flow in the programming, is there any debug command for watching the progress of step by step? like pause and start function, tks.
@Kocela wrote:
Hi Werner
Thank you for the help.
If i would have better understand the logical flow in the programming, is there any debug command for watching the progress of step by step? like pause and start function, tks.
No, unlike real Mathcad (version 15 and below) Prime unfortunately does not offer any kind of the debugging facilities you demand.
You may throw in "return" statements at specific positions of interest and return a single variable or a vector of variable values which are of interest to examine, but its tedious to do so and not very flexible. Its not a substitute for real debugging/trace capabilities.
Another way you may help yourself rudimentary is to use WRITEPRN and APPENDPRN to explicitely write informations of interest (variable values, recursion depth, ...) to an external text file. Still not a step by step debugger, requires code modification by throwing in the file access commands but can be quite handy in some situations.
Hi Master Werner
How to reform the program below to array or vector forms?
e.g: T(3)=[T1, T2, T3]
Tks
Quick and dirty without changing function T
And a bit more efficient using a modified function