Expressing a constant in function of other prefixed constants - TI-Nspire CAS - ti-nspire

I'm trying to do the following operation with my TI-Nspire CAS; I have:
x=a+b
y=a-c
I'd like to get:
y=x-b-c
Thank you so much for your time.

Something like this:
i1:=solve(x=a+b,a)
y:=a-c|i1

Related

Swift String into formula

This may be the wrong place to ask this but I am aware of NSExpression, but it seems it can only do primitive mathematics - am I wrong about this? I am able to do something like this: #Value-2/3+9-6 ect easily, but I would like to incorporate Max's, Min's, and possible a few other operations (instead of just multiplication, division, subtraction, and addition. Is that possible in the same equation, does it have to be converted multiple times? Any advice would be appreciated!
You could try to use a "function" expression but that requires a rather unwieldy syntax in the expression string and is probably a stretch of the intended purpose of NSExpression unless you are actually implementing an aggregate type MIN/MAX function for predicates on a dataset.
I figured it out.
For anyone who needs this - you can take any string and use:
functionName(x) for most of the functions like sqrt, multiplyby, trunc, ceiling, ect
And then for the six with multiple variables (max, min, count, average, sum, ect) you use functionName({x,y}).
All can be used in a string with expressionValue(with: nil, context: nil)

Evaluate string as input keyword in matlab

How to evaluate a string which could be changed dynamically in code? for example:
A=rand(60, 60);
RangeC='10:end,:';
B=A(RangeC);
I know this is quite easy for others, but I have struggled for hours! Thanks in advance!
You can use the eval function but I would suggest to seperate RangeC in two variables like the example below. Also end won't be able to be evaluated so you can use size instead.
A=rand(60, 60);
RangeC1='10:size(A,1)';
RangeC2='1:size(A,2)';
B=A(eval(RangeC1), eval(RangeC2));

Scala + Play: how to pass a parameter into a route in a template?

I'm tinkering with Scala and Play as a bit of a weekend learning exercise, and one thing that has got me a bit stymied with the templating system is how to pass parameters into routes.
My template looks like this:
#(wallPosts : Array[models.WallPost], wallPostIndex: Integer)
...
Next
...
I don't seem to be able to pass #wallPostIndex into the route in this href? How would I go about this?
For reference, this is the route:
GET / controllers.Application.index(wallPostIndex: Int ?= 1)
Thanks for your help.
Try removing the # before the wallPostIndex in your href, something like this:
Next

Code formatting when using pointers

Is there any reason why the asterisk is next to the object type in this code? I'm a little confused by the way I see this used. Some times it looks like this:
NSString* stringBefore;
and sometimes like this:
NSString *stringBefore;
Is there a difference? Or a right or wrong way to do this?
Thanks
I use the * near the variable name and not the type, since if you declare something like:
int *i, j;
i will be a pointer to int, and j will be a int.
If you used the other syntax:
int* i, j;
you may think that both i and j are pointers when they are not.
That said, I don't use nor recommend declaring a pointer and a non-pointer variable in the same line, as in this sample.
It makes no difference.
It just just an indicator to how well versed the author is in writing and reading Objective-C. The traditional standard is to write it as:
NSString *stringBefore;
There is no difference.

Newbie Objective C developer question

I have been looking everywhere for an answer to this question - perhaps I'm looking in the wrong places. Also, I'm brand new to Objective C although I have around 10 years of experience as a developer.
for this code:
[receiver makeGroup:group, memberOne, memberTwo, memberThree];
what would the method definition look like?
- (void)makeGroup:(Group *)g, (NSString *)memberOne, ...?
Thanks for any help you can provide. I know this is probably very simple...
Thanks,
R
It looks like you have a method that can take a variable number of arguments. If that's the case, the definition would look something like:
- (void)makeGroup:(Group *)g, ...;
Check out NSString's stringWithFormat: or NSArray's arrayWithObjects: methods for examples.
Edit: Upon further documentation reading, it seems that you are looking at the exact example that's in the Objective-C 2.0 documentation. The declaration you're looking for is right at the bottom of page 36.
You can receive an infinte number of arguments with an ellipsis (...). Check this for further details!
It would make more sense to have the members as a separate array argument, like -(void)makeGroup:(Group *)g members:(NSArray *)members. If you must do varargs (which is a pain), it should be written like -(void)makeGroup:(Group *)g members:(NSString *)firstMember, ....
Since I this is trying to figure out how an example method from the documentation would be declared, it would be like this:
- (void)makeGroup:(id)group, ...
Then you would start up the varags machinery with the group argument and use it to find the other arguments.
either you're looking for MrHen's answer if you're seeking to do your own class method or if you want to do them separately you write the following into your header file:
-(void)makeGroup:(Group *)g;
-(NSString *)memberOne;
EDIT: I answered the wrong question. Ignore this.
The correct way to do this is:
-(void)makeGroup:(Group *)g memberOne:(NSString *)memberOne memberTwo:(NSString *)memberTwo memberThree:(NSString *)memberThree {
...
}
The call will look like this:
[receiver makeGroup:group memberOne:memberOne memberTwo:memberTwo memberThree:memberThree];