Added Factorial, added parts of exponents
This commit is contained in:
@@ -62,27 +62,36 @@
|
||||
}];
|
||||
}
|
||||
|
||||
- (instancetype)initWithFactorialOfTerm:(MPTerm *)term
|
||||
{
|
||||
return [self initWithBlock:^NSDecimalNumber *{
|
||||
NSDecimalNumber *termValue = [term evaluate];
|
||||
NSLog(@"Factorial of %@ = %f", termValue, tgamma(termValue.doubleValue + 1));
|
||||
return [[NSDecimalNumber alloc] initWithDouble:tgamma(termValue.doubleValue + 1)];
|
||||
}];
|
||||
}
|
||||
|
||||
- (instancetype)initWithSinOfTerm:(MPTerm *)term
|
||||
{
|
||||
return [self initWithBlock:^NSDecimalNumber *{
|
||||
NSDecimalNumber *sinValue = [term evaluate];
|
||||
return [[NSDecimalNumber alloc] initWithDouble:sin(sinValue.doubleValue)];
|
||||
NSDecimalNumber *termValue = [term evaluate];
|
||||
return [[NSDecimalNumber alloc] initWithDouble:sin(termValue.doubleValue)];
|
||||
}];
|
||||
}
|
||||
|
||||
- (instancetype)initWithCosOfTerm:(MPTerm *)term
|
||||
{
|
||||
return [self initWithBlock:^NSDecimalNumber *{
|
||||
NSDecimalNumber *cosValue = [term evaluate];
|
||||
return [[NSDecimalNumber alloc] initWithDouble:cos(cosValue.doubleValue)];
|
||||
NSDecimalNumber *termValue = [term evaluate];
|
||||
return [[NSDecimalNumber alloc] initWithDouble:cos(termValue.doubleValue)];
|
||||
}];
|
||||
}
|
||||
|
||||
- (instancetype)initWithTanOfTerm:(MPTerm *)term
|
||||
{
|
||||
return [self initWithBlock:^NSDecimalNumber *{
|
||||
NSDecimalNumber *tanValue = [term evaluate];
|
||||
return [[NSDecimalNumber alloc] initWithDouble:tan(tanValue.doubleValue)];
|
||||
NSDecimalNumber *termValue = [term evaluate];
|
||||
return [[NSDecimalNumber alloc] initWithDouble:tan(termValue.doubleValue)];
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user