void test_and_set_nparams(unsigned n);
std::string get_name(void) const { return name; }
unsigned get_nparams(void) const { return nparams; }
+ bool has_derivative(void) const { return derivative_f != NULL; }
protected:
std::string name;
friend class remember_table_entry;
// friend class remember_table_list;
// friend class remember_table;
+ friend ex Derivative_eval(const ex &, const ex &);
// member functions
ex evalf(int level=0) const;
unsigned calchash(void) const;
ex series(const relational & r, int order, unsigned options = 0) const;
- bool match(const ex & pattern, lst & repl_lst) const;
ex thisexprseq(const exvector & v) const;
ex thisexprseq(exvector * vp) const;
protected:
ex derivative(const symbol & s) const;
bool is_equal_same_type(const basic & other) const;
+ bool match_same_type(const basic & other) const;
unsigned return_type(void) const;
unsigned return_type_tinfo(void) const;
ex function::expand(unsigned options) const
{
- return this->setflag(status_flags::expanded);
+ // Only expand arguments when asked to do so
+ if (options & expand_options::expand_function_args)
+ return inherited::expand(options);
+ else
+ return (options == 0) ? setflag(status_flags::expanded) : *this;
}
int function::degree(const ex & s) const
throw(std::logic_error("function::series(): invalid nparams"));
}
-bool function::match(const ex & pattern, lst & repl_lst) const
-{
- // Serial number must match
- if (is_ex_of_type(pattern, function) && serial != ex_to<function>(pattern).serial)
- return false;
- return inherited::match(pattern, repl_lst);
-}
-
// protected
-
/** Implementation of ex::diff() for functions. It applies the chain rule,
* except for the Order term function.
* \@see ex::diff */
GINAC_ASSERT(is_of_type(other, function));
const function & o = static_cast<const function &>(other);
- if (serial!=o.serial) {
+ if (serial != o.serial)
return serial < o.serial ? -1 : 1;
- }
- return exprseq::compare_same_type(o);
+ else
+ return exprseq::compare_same_type(o);
}
bool function::is_equal_same_type(const basic & other) const
GINAC_ASSERT(is_of_type(other, function));
const function & o = static_cast<const function &>(other);
- if (serial!=o.serial) return false;
- return exprseq::is_equal_same_type(o);
+ if (serial != o.serial)
+ return false;
+ else
+ return exprseq::is_equal_same_type(o);
+}
+
+bool function::match_same_type(const basic & other) const
+{
+ GINAC_ASSERT(is_of_type(other, function));
+ const function & o = static_cast<const function &>(other);
+
+ return serial == o.serial;
}
unsigned function::return_type(void) const