On Wed, Nov 21, 2018 at 6:22 PM Slawomir Kolodynski <[email protected]> wrote:
>
> lack of a basic form of referential transparency between variables and 
> literals.
> Namely if you assign a literal to a variable and later in code use a variable,
> the result may be different than if you had used the literal instead. For 
> example:

This is not a problem about "referential transparency", this is about a old bug
related with (numeric) evaluation of "erf", e.g. "eval(erf x, x, 1.0)"
returns "erf(1.0)".

https://groups.google.com/forum/#!msg/fricas-devel/Rz5_1iBadAY/B2g9GVibCwAJ


> And another one using the variable which stores that literal
>
> C1(S:F,r:F,T:F,K:F,s:F):F == BS

This usage is wrong, BS is already defined, with a type of Expression,
so this line will never work.

One way can work:
First, use macro '==>' instead of assignment.
Second, use "exp" instead of "%e", so that they are
defined in DFLOAT:

BS1 ==> 
((S*erf(((2*log((S/K))+T*s^2+2*T*r)/(2*s*sqrt(2)*sqrt(T))))-K*exp((-T*r))*erf(((2*log((S/K))-T*s^2+2*T*r)/(2*s*sqrt(2)*sqrt(T))))-K*exp((-T*r))+S)/2)
C1(S:F,r:F,T:F,K:F,s:F):F == BS1
C1(10.0,0.05,0.8,11.0,0.05)
   Compiling function C1 with type (DoubleFloat, DoubleFloat,
DoubleFloat, DoubleFloat, DoubleFloat) -> DoubleFloat

   (18)  0.023903294619544546


I think after the bug I mentioned get fixed, using "numeric" will also work.

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to