This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
prime:misctips [2017/10/17 01:24] webmasterpdx created |
prime:misctips [2017/12/03 19:00] (current) webmasterpdx |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Miscellaneous Tips ====== | ||
+ | |||
+ | Integers are defined using the following formats. #19d is 19 decimal. #19Dh is 19D hex. #19:16d is 19 decimal 16 bits. #19D:16h is 19D hex 16 bits. #19:-16d is signed. Note the use of upper and lower case. More info [[https:// | ||
+ | |||
+ | LOCAL A; inside a program file, but outside a function definition, is a global variable that only functions defined inside the same program file can access. Thus, LOCAL A; will not compile as long as the variable A exsits globally (e.g. System variable A is a predefined global). i.e. LOCAL A; outside a function does not do any variable overloading. | ||
+ | |||
+ | Variable names can use all kinds of weird identifiers defined in unicode. To determine what identifiers (non-alphanumeric type characters), | ||
+ | |||
+ | Note that there is a shortcut to STRING(V) by just doing T: | ||
+ | |||
+ | When a variable is passed into a function, it's passed by value, so any changes to make to the variable will not be reflected in the variable passed in. You need to return the variable and assign it in the calling function to change it there. | ||
+ | |||
+ | When a loop must execute at least once, use REPEAT, otherwise use WHILE. | ||
+ | |||
+ | To get a single character from a string, S, there are several ways. S(3) returns an ASCII code. CHAR(S(3)) will return it as a string like " | ||
+ | |||
+ | The \ character is generated from the Shift-Vars/ | ||
+ | |||
+ | Screen real estate is as follows. | ||
+ | * (0, | ||
+ | * (0, | ||
+ | * (0, | ||
+ | * (0, | ||
+ | * (0, | ||
+ | |||
+ | When plotting a function where f(x) is complex over an interval, the graph will appear blank during that interval, as you cannot plot a complex value when there is only a real y-axis. Get the magnitude of the complex value and plot that instead. | ||
+ | |||
+ | Use L(0) to index the tail of a list. To concatenate to a list, you can do something like L: | ||
+ | That would result in L being {4, | ||
+ | |||
+ | Indefinite integral has an implicit "+ constant" | ||
+ | |||
+ | When integrating in CAS, if you put a . after a limit (definite integral) it knows to use approximation, | ||
+ | |||
+ | When working with trigonometric functions, there are a group of functions that can allow for simplification of terms, or expansion in a particular direction. trigcos() will try to express the expression in terms of cosines, similarly with trigsin, trigtan. Likewise, there are a set of functions to convert between exponents, trig and ln functions. simplify and trigexpand can be useful in such cases too. tcollect() can convert an expression involving powers of trig functions to functions of nx. Note that some of these functions can result in a constant at the end of the expression and if this is an indefinite integral result, then this constant can be thrown away without error. ratnormal() can combine multiple fractions into one simplest irreducible fraction. | ||
+ | E.g. Calling integrate( (cos(2*x)^3)*(sin(2*x)^5), | ||
+ | Again, since it's an indefinite integral, the constant term at the end can be dropped. | ||
+ | |||
+ | In summary, have a trig expression and want to break it down to certain terms: | ||
+ | * trigcos: | ||
+ | * trigsin: | ||
+ | * trigtan: | ||
+ | * tcollect: | ||
+ | * trigexpand: | ||
+ | * ratnormal: | ||
+ | |||
+ | TEVAL(func_call()) returns the time it takes to run func_call in seconds in 2.5_s units. Since this format isn't a real, it cannot be assigned to the global REAL variables like A,B,C,etc.. in Home mode. There is an undocumented time() function that just returns a REAL value that can be used in both Home and CAS mode. It's undocumented so it could disappear in a future release of the firmware. Note that due to the timer tick being 1ms, and due to timer functions to get the battery value, LCD refresh, etc, etc, timer values under 100ms should be taken with a grain of salt. You can put the function call in a loop that takes over a second to execute, then you can compare the values returned with a bit more confidence. | ||