Dear Friends, I have a problem. Here is a simplified version.
$c =2;
$a=5;
sub myfunc{
$x=shift;
return ( (e ** ($x ** $c)) / ($x + $c ** 2));
}
Why is the following not giving the expected answer, (e^(25))/4?
myfunc($a);
Please help. .. Raghu
Because e is not a predefined constant. Use
return exp($x**$c)/($x+$c**2);instead.
Davide
Thanks, Davide.
(I am sorry for a typo in my earlier note - I should have typed (e^(25))/9. :) )
I followed your suggestion, however, I am getting the error:
(I am sorry for a typo in my earlier note - I should have typed (e^(25))/9. :) )
I followed your suggestion, however, I am getting the error:
Can't convert an Infinity to a Real Number It seems the numbers are too large for WeBWorK to handle. Is this correct assumption? .. Raghu
No, the numbers are not too large. This message is coming from somewhere else in your problem, since it is generated by the MathObjects library, but the code you give above doesn't involve MathObjects. So it must be coming from somewhere else. Perhaps if you give the full problem code we could figure it out.
Davide
Davide
Thanks, Davide.
Now I have another question I have included \begin{picture} \end{picture}
in a problem. It is working well when hardycopy is generated. However, jsmath is complaining that "unknown environment picture". Can you please help?
.. Raghu
Now I have another question I have included \begin{picture} \end{picture}
in a problem. It is working well when hardycopy is generated. However, jsmath is complaining that "unknown environment picture". Can you please help?
.. Raghu
JsMath does not support the picture environment, and it is not likely to any time soon. I would avoid using it if you can. Perhaps you can use a static graphic, or generate one on the fly?
Davide
Davide
Thanks, Davide.
I wanted to do something like this:
sub put_pic{
my $t='$BR \{image("figure$a.png", width=>160, height=>118)\} $BR';
my $s='\[
\begin{picture}(0,0)(1,1)
...
\end{picture}
\]';
if ($displayMode eq "TeX") {
return $s }
else {return $t }
}
Hower put_pic is not placing the picture. Instead it is showing just the statement:
\{image("figure$a.png", width=>160, height=>118)\}
But TeX portion is working great. What am I doing wrong? Thank you for your helpful posts. .. Raghu
I wanted to do something like this:
sub put_pic{
my $t='$BR \{image("figure$a.png", width=>160, height=>118)\} $BR';
my $s='\[
\begin{picture}(0,0)(1,1)
...
\end{picture}
\]';
if ($displayMode eq "TeX") {
return $s }
else {return $t }
}
Hower put_pic is not placing the picture. Instead it is showing just the statement:
\{image("figure$a.png", width=>160, height=>118)\}
But TeX portion is working great. What am I doing wrong? Thank you for your helpful posts. .. Raghu
It probably has to do with how you are using the result of put_pic. You have not said how you are inserting it into the text of the problem. Try
TEXT(EV3(put_pic));If that doesn't work, post the complete code fragment so that we are able to help you better.
Davide
Thank you so much, Davide. It works now. .. Raghu