[R] How to import simple java/mathematica expression to R

jim holtman jholtman at gmail.com
Sat Jul 24 04:29:11 CEST 2010


Well, I took you equation and put the following at the start:

Power <- function(x,y) x^y
EE <- function(x) x
alp <- 2

x <- 9000000*Power(-0.2030178326474623 + 0.23024073983368956*(1 - alp) +
    0.2807352820970084*(1 - alp)*(1 - alp*(1 + EE(1))) +
0.2145643524071315*(1 - alp)*
    Power(1 - alp*(1 + EE(1)),2) + 0.11519022530097237*(1 -
alp)*Power(1 - alp*(1 + EE(1)),3) +
    0.046127977611990736*(1 - alp)*Power(1 - alp*(1 + EE(1)),4) +
0.014279410543117517*(1 - alp)*
    Power(1 - alp*(1 + EE(1)),5) + 0.2145643524071315*(Power(1 -
alp,2)*alp*(1 + EE(1)) +
    (1 - alp)*alp*(1 + EE(1))*(1 - alp*(1 + EE(1))) + Power(1 -
alp,2)*alp*(1 + EE(2))) +
    0.11519022530097237*(Power(1 - alp,2)*alp*(1 + EE(1))*(1 - alp*(1
+ EE(1))) +
    2*(1 - alp)*alp*(1 + EE(1))*Power(1 - alp*(1 + EE(1)),2) +
    Power(1 - alp,2)*alp*(1 - alp*(1 + EE(1)))*(1 + EE(2))) +
.....................

since there appeared to be functions "Power" and "EE", and the
variable 'alp'. This evaluated as-is to:  32157617213

so what you have appears to be a legal equation that R can parse as
is.  There you can probably put it in a function and use one of the R
routines to minimize it,  It does not look like you will have any
problem importing it to R; just have to make sure you have the
appropriate functions defined.

On Fri, Jul 23, 2010 at 1:29 PM, Andrey Siver <andrey.siver at gmail.com> wrote:
> Hello,
>
> 2010/7/23 jim holtman <jholtman at gmail.com>:
>> It would be nice if you could post what the data looks like that you
>> want to import.  R can import any text file and then you have string
>> manipulation that you can do to parse it.  So the basic answer is
>> probably yes, but we do need to understand the format of the data to
>> give a more precise answer.
>
> I put the target expression to minimize (with some constrains) here:
>
> http://analytic-products4you.com/target.txt
>
> Is it possible to import it as a function to minimize?
>
>>
>> What is the problem that you are trying to solve?
>>
>
> We solve a problem for parameters estimation with ties.
>
> Thank You for the answer.
>
> --
> Regards,
>
>    -Andrey
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?



More information about the R-help mailing list