f(x,y):=x.y is refused "unauthorized change : the variable type is invalid" (but seems working on many examples I see over the Internet...) - ti-nspire

I erased all the variables of my scratchpad, with ClearAZ,
and attempted to enter the multivariable function f(x,y) := x.y that I see everywhere over the Internet on my TI-nspire CX II-T.
But, myself, I'm receiving the message: "unauthorized change : the variable type is invalid"
(I'm translating the message from French, I've received it verbatim like: "Changement non autorisé : le type de variable est invalide")
Why? And what should I do?
I have no clues.

Epilogue:
I've discovered that I was able to define g(x,y) := x.y, but ClearAZ or DelVar weren't able to really delete my f function, that was, in fact, still linked to a graphical representation.
I had to go on the graph tab, then ensure to do the action "Erase all" to make the function really disappear from nspire memory.
And then defining f(x,y) := x.y became possible.

Related

Trouble with poDoNotEncode option in TRESTRequest.AddParameter() method

I'm having trouble using the poDoNotEncode option in the TRESTRequest.AddParameter() method. I need to be able to post a request with a j_token header with a value that includes the '/' characters or else. For this need, I read everywhere that I can simply add poDoNotEncode to the options of the request parameters.
I tried several methods I found on the Internet to add a j_token header to my request:
var
RESTRequest : TRESTRequest;
RESTClient : TRESTClient;
Response : TRESTResponse;
begin
RESTClient := TRESTClient.Create('http://127.0.0.1:5000/')
RESTRequest := TRESTRequest.Create(nil);
try
RESTRequest.Client := RESTClient;
RESTRequest.Method := rmPOST;
RESTRequest.AddParameter('j_token', 'ga/ga', pkHTTPHEADER, poDoNotEncode);
//RESTRequest.Params.AddHeader('j_token', 'ga/ga').Options := poDoNotEncode;
//RESTRequest.Params.AddItem('j_token', 'ga/ga', pkHTTPHEADER, poDoNotEncode);
RESTRequest.Execute;
Response := RESTRequest.Response;
ShowMessage(Response.Content);
finally
RESTClient.Free;
RESTRequest.Free;
end;
end;
In this example, I used my own API to see the content of my request headers (here just j_token). Each and every method I tried (the commented ones) result with this:
Request headers : ga%2Fga
Meaning that the header I'm sending is url-encoded whether or not poDoNotEncode is specified.
Just to clarify, I'm working currently on a program developed by the company I work for. This software should use Delphi 10.3 Rio as its script language.
Maybe it can help, but when I try something like this:
RESTRequest.AddParameter('j_token', 'ga/ga', pkHTTPHEADER, [poDoNotEncode]);
I get this error:
RUNTIME ERROR : Impossible converting variant of type (Array Variant) to type (Integer) when evaluating instruction PushVar($0,$0,$0,$0, 'Result')...
And when I try something like this:
RESTRequest.AddParameter('j_token', 'ga/ga', pkHTTPHEADER, TRESTRequestParameterOptions.poDoNotEncode);
then I get this error:
Unknown identifier or variable is not declared : 'TRESTRequestParameterOptions'
I tried to be as precise as possible, because I'm completely stuck right now. If you need more precision, I'll try to answer as clearly as possible.
I've solved my problem. To provide a context, I have access to the archives of my company with every script they made. To learn delphi it helps a lot, and as I was looking at an example for the TRESTRequest.AddParameter() method i noticed that the 4th parameter for this method was a 0 like this :
RESTRequest.AddParameter('j_token',mytoken,pkHTTPHEADER,0);
So I looked on the internet to find what that 0 meant and i found out it was supposed to be an option for the parameter such as poDoNotEncode. I was still wondering why they replaced that with a 0 but I simply guessed it was to avoid an error if you don't put anything because our compiler wants the RESTRequest.AddParameter() method to have 4 parameters. So in the end i started doing the same until i needed my parameter to not getting encoded. But the poDoNotEncode option wasn't working. I tried to see what it would show inside a ShowMessage(poDoNotEncode); and it showed me a 0. So I decided as a test to put a 1 instead of poDoNotEncode like this :
RESTRequest.AddParameter('j_token',mytoken,pkHTTPHEADER,1);
And finally it worked, I have no idea why our software prefers using Integers instead of the real options names but if ever you stumble upon this problem, there is a high chance that you had the same weird definition of options.
Thank you all for your help !

SM3_Basic.IAxisRef.GetAxisRefPointer not working as expected

Running "CODESYS V3.5 SP16" here, does anyone have the same problem with the method in the title?
PROGRAM PLC_PRG
VAR
itfAxisRef : SM3_Basic.IAxisRef;
pAxisRefSm3 : POINTER TO SM3_Basic.AXIS_REF_SM3;
END_VAR
pAxisRefSm3 := itfAxisRef.GetAxisRefPointer;
Trying to compile the above throws the following error
C0032: Cannot convert type 'GETAXISREFPOINTER(sm3_basic, 4.10.0.0 (3s - smart software solutions gmbh))' to type 'POINTER TO SM3_Basic.AXIS_REF_SM3'
which has me really confused because I've never seen the type GETAXISREFPOINTER before and the documentation for .GetAxisRefPointer states that it returns POINTER TO AXIS_REF_SM3
https://help.codesys.com/webapp/3dvrBKsuKjYfmeP1KzrJnylfstc%2FGetAxisRefPointer;product=SM3_Basic;version=4.9.0.0
As for why I'm trying to use this method, I'm trying to loop through the array of axes in SM3_Robotics.AXIS_GROUP_REF_SM3 and pass them to SM3_Basic.MC_ReadStatus in order to get their individual SM3_Basic.SMC_AXIS_STATE (not only the SM3_Robotics.SMC_AXIS_GROUP_STATE) for debugging
Is there a better way to achieve the above without using the axes array?
GetAxisRefPointer is a Method, try:
pAxisRefSm3 := itfAxisRef.GetAxisRefPointer();

How to encode normalized(A,B) properly?

I am using clingo to solve a homework problem and stumbled upon something I can't explain:
normalized(0,0).
normalized(A,1) :-
A != 0.
normalized(10).
In my opinion, normalized should be 0 when the first parameter is 0 or 1 in every other case.
Running clingo on that, however, produces the following:
test.pl:2:1-3:12: error: unsafe variables in:
normalized(A,1):-[#inc_base];A!=0.
test.pl:2:12-13: note: 'A' is unsafe
Why is A unsafe here?
According to Programming with CLINGO
Some error messages say that the program
has “unsafe variables.” Such a message usually indicates that the head of one of
the rules includes a variable that does not occur in its body; stable models of such
programs may be infinite.
But in this example A is present in the body.
Will clingo produce an infinite set consisting of answers for all numbers here?
I tried adding number(_) around the first parameter and pattern matching on it to avoid this situation but with the same result:
normalized(number(0),0).
normalized(A,1) :-
A=number(B),
B != 0.
normalized(number(10)).
How would I write normalized properly?
With "variables occuring in the body" actually means in a positive literal in the body. I can recommend the official guide: https://github.com/potassco/guide/releases/
The second thing, ASP is not prolog. Your rules get grounded, i.e. each first order variable is replaced with its domain. In your case A has no domain.
What would be the expected outcome of your program ?
normalized(12351,1).
normalized(my_mom,1).
would all be valid replacements for A so you create an infinite program. This is why 'A' has to be bounded by a domain. For example:
dom(a). dom(b). dom(c). dom(100).
normalized(0,0).
normalized(A,1) :- dom(A).
would produce
normalize(0,0).
normalize(a,1).
normalize(b,1).
normalize(c,1).
normalize(100,1).
Also note that there is no such thing as number/1. ASP is a typefree language.
Also,
normalized(10).
is a different predicate with only one parameter, I do not know how this will fit in your program.
Maybe your are looking for something like this:
dom(1..100).
normalize(0,0).
normalize(X,1) :- dom(X).
foo(43).
bar(Y) :- normalize(X,Y), foo(X).

Trying to use dynamic and action parameters

recently I stumbled upon one of the videos of Benjamin Schumann titled: What are dynamic and action parameters and when should you use them in your AnyLogic model.
I tried to further adjust the functions of dynamic and action based parameters for a problem of mine. Just to give a heads up, I am fairly new to Anylogic (only worked through that one book, and some minor projects and tutorials) and been decent in Java (been a few years since I've been actively working in Java but currentlystarting to get back in [still rusty]).
Regarding my actual problem, in the video Mr. Schumann has an agent with three parameters. One static, one dynamic and one action. In addition to that he has a variable (double) all set in his agent. On his main is a button to increment the value of the variable with the help of the parameters and to trace the lines in the console (= giving out a string if a certain threshold of the variable is passed).
I created a similar setting, however I happen to run into a lot of variable errors during time to time while compiling.
Here some example code snippets:
dynamic parameter p_Station of the type String
v_myFahrt < 222 ? "Wiesbaden Hbf" :
v_myFahrt < 442 ? "Wiesbaden-Biebrich Bahnhof Wiesbaden Ost" :
v_myFahrt < 663 ? "Wiesbaden-Mainz-Kastel Bahnhof" :
"Hochheim (Main) Bahnhof"
therefore my variable is called v_myFahrt, a double with the initial value of 0
action parameter p_durchFahrt with the default action:
v_myFahrt = v_myFahrt + 220;
and my Button on the main:
myAgent.p_durchFahrt();
traceln(myAgent.p_Station());
So basically it is a somewhat similar code as in the reference. I tried to than add another instance of the agent with a different set of "code" for the dynamic parameter (different Strings and values) as well as a different "code" for the action parameter (e.g. + 208 instead of + 220). To then wanting to trace the lines in the console with the button again.
I tried to add
myAgent1.p_durchFahrt(); traceln(myAgent1.p_Station());
to it.
But before I coul even run it, I keep getting the error "v_myFahrt cannot be resolved to a variable" for myAgent1. Inspecting the error it keeps referring to myAgent1 with the newly added code for p_Station and I can't seem to find a way around it.
What am I doing majorly wrong here?
it looks like you have created v_myFahrt in main, right? (that would explain your symptoms).
If yes, you should create it in MyAgent instead.

how to stop at an internal Maple proc?

I want to see how Maple determined the type of an ODE. But can't set break point at internal Maple proc:
restart;
ode:=2*sqrt(a*diff(y(x),x))+x*diff(y(x),x)-y(x) = 0;
DEtools:-odeadvisor(ode);
#[[_homogeneous, `class G`], _Clairaut]
But when I do
stopat(DEtools:-odeadvisor);
it gives erorr
Error, invalid input: stopat expects its 1st argument, p, to be of type {`::`, name, string}, but received proc () option `Copyright (c) 1997 Waterloo Maple Inc. All rights reserved.`; `ODEtools/initialized` <> 'true' and `ODEtools/init`() <> 0; `ODEtools/odeadv`(args) end proc
Is it possible to set break point at DEtools:-odeadvisor? showstat does not show much. I thought it was possible to view all Maple library code (other than the builtin ones).
But may be some are not possible to see in addition to the builtin? How does one know then which one can see and which one can't see? How one see the code the DEtools:-odeadvisor?
Maple 2018.1
Try this,
restart;
ode:=2*sqrt(a*diff(y(x),x))+x*diff(y(x),x)-y(x) = 0:
showstat(DEtools[odeadvisor]);
stopat(`ODEtools/odeadv`);
DEtools:-odeadvisor(ode);