PREP 2014 Question Authoring - Archived

Multivariable functions

Re: Multivariable functions

by Gavin LaRose -
Number of replies: 0

Hi Adam,

You can do this by adding an independent variable to the Context and then just defining a formula as you would expect:

Context("Numeric")->variables->add( y => 'Real' );
$f = Compute( "sin(x y)" );
$fx = $f->D('x');
$fy = $f->D('y');
Context()->texStrings;
BEGIN_TEXT
If \(f(x,y) = $f\), then $BR
\(f_x(x,y) = \) \{ $fx->ans_rule() \}$BR
\(f_y(x,y) = \) \{ $fy->ans_rule() \}
END_TEXT
Context()->normalStrings;
ANS( $fx->cmp() );
ANS( $fy->cmp() );

There is some information about this in the problem techniques documentation: http://webwork.maa.org/wiki/DifferentiatingFormulas, http://webwork.maa.org/wiki/VariablesOtherThanX.

Gavin