## Forum archive 2000-2006

### ymarkov - How to do a variable called "p"

by Arnold Pizer -
Number of replies: 0
 How to do a variable called "p" topic started 2/6/2002; 5:17:39 PMlast post 2/7/2002; 11:08:39 AM
 ymarkov - How to do a variable called "p"  2/6/2002; 5:17:39 PM (reads: 1328, responses: 7) Hello, this Yavor Markov from Rutgers writing. I have finally started encoding a few simple problems for Business Calc (marginal analysis) to complement the database that is in place. In some of the problems is rather important the variable to be named p (for price obviously). However, there seems to be a problem, because "p" is a perl comand, or at least a ".pg" command. Is there any quick way around that? Thank you for your help. <| Post or View Comments |>

 Michael Gage - Re: How to do a variable called  2/6/2002; 7:06:55 PM (reads: 1533, responses: 0) Hi Yavor, Can you give an example of the problem you are trying to write? I'll see what I can do to answer your question. (You can just put the problem text between "
tags so that it prints more or less correctly in a web page:) 
The problem you are writing goes here:DOCUMENT();$p = random(1,3,0.1);etc.BEGIN_TEXTStuff that is printed outEND_TEXTANS(str_cmp($foo));ENDDOCUMENT();
-- Mike <| Post or View Comments |>

 ymarkov - Re: How to do a variable called  2/7/2002; 9:52:48 AM (reads: 1462, responses: 0) The problem is attached below. It creates the problem set fine, then it displays it well. When I try to evaluate (submit answers) is where the problem comes. It does not like the "p" being part of the answer.  Body of the problem ##DESCRIPTION##KEYWORDS('derivatives')## Derivatives and the basic functions of economics##ENDDESCRIPTIONDOCUMENT(); # This should be the first executable line in the problem.loadMacros(PG.pl,PGbasicmacros.pl,PGchoicemacros.pl,PGanswermacros.pl, PGauxiliaryFunctions.pl);TEXT(&beginproblem);$showPartialCorrectAnswers = 1;$a1 = random(0.04,0.05,0.001);$b1 = random(700,800,5);$p1 = random(320,420,5);$ep1 =$p1/($b1-$p1); $funct1 = "(-1/$a1)*\p+$b1/$a1";$funct2 = "\p/($b1-\p)";TEXT(EV2(<

 ymarkov - Re: How to do a variable called  2/7/2002; 9:53:22 AM (reads: 1551, responses: 0) The problem is attached below. It creates the problem set fine, then it displays it well. When I try to evaluate (submit answers) is where the problem comes. It does not like the "p" being part of the answer. Body of the problem ##DESCRIPTION ##KEYWORDS('derivatives') ## Derivatives and the basic functions of economics ##ENDDESCRIPTION DOCUMENT(); # This should be the first executable line in the problem. loadMacros( PG.pl, PGbasicmacros.pl, PGchoicemacros.pl, PGanswermacros.pl, PGauxiliaryFunctions.pl ); TEXT(&beginproblem); $showPartialCorrectAnswers = 1;$a1 = random(0.04,0.05,0.001); $b1 = random(700,800,5);$p1 = random(320,420,5); $ep1 =$p1/($b1-$p1); $funct1 = "(-1/$a1)*\p+$b1/$a1"; $funct2 = "\p/($b1-\p)"; TEXT(EV2(<

 Michael Gage - Re: How to do a variable called  2/7/2002; 10:18:21 AM (reads: 1520, responses: 0) Hi, You need to specify that the independent variable is 'p' (as opposed to 'x' which is the default). I suggest that you use a slightly newer version of function_cmp called fun_cmp with the following syntax: $ans = "p/($b1-p)";ANS(fun_cmp(\$ans, var=>['p']) ); Clicking on the link fun_cmp will give you more information about this answer evaluator and the various options --Mike <| Post or View Comments |>

 ymarkov - Re: How to do a variable called  2/7/2002; 11:08:39 AM (reads: 1507, responses: 0) THANK YOU. Your suggestions worked fine. Yavor <| Post or View Comments |>