mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
[poincare] Improve integral layout
Change-Id: Ie9f10058d856741838f8e34ba30fc6934909581b
This commit is contained in:
@@ -11,6 +11,7 @@ public:
|
||||
Type type() const override;
|
||||
Expression * cloneWithDifferentOperands(Expression ** newOperands,
|
||||
int numberOfOperands, bool cloneOperands = true) const override;
|
||||
ExpressionLayout * createLayout() const override;
|
||||
private:
|
||||
float functionValueAtAbscissa(float x, XContext xcontext) const;
|
||||
};
|
||||
|
||||
@@ -5,7 +5,11 @@
|
||||
extern "C" {
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
}
|
||||
#include "layout/horizontal_layout.h"
|
||||
#include "layout/string_layout.h"
|
||||
#include "layout/integral_layout.h"
|
||||
|
||||
Integral::Integral() :
|
||||
Function("int")
|
||||
@@ -52,6 +56,13 @@ float Integral::approximate(Context& context) const {
|
||||
return result;
|
||||
}
|
||||
|
||||
ExpressionLayout * Integral::createLayout() const {
|
||||
ExpressionLayout ** childrenLayouts = (ExpressionLayout **)malloc(2*sizeof(ExpressionLayout *));
|
||||
childrenLayouts[0] = m_args[0]->createLayout();
|
||||
childrenLayouts[1] = new StringLayout("dx", 2);
|
||||
return new IntegralLayout(m_args[1]->createLayout(), m_args[2]->createLayout(), new HorizontalLayout(childrenLayouts, 2));
|
||||
}
|
||||
|
||||
float Integral::functionValueAtAbscissa(float x, XContext xContext) const {
|
||||
Float e = Float(x);
|
||||
Symbol xSymbol = Symbol('x');
|
||||
|
||||
Reference in New Issue
Block a user