Date: Mar 23, 2013 6:00 AM
Author: draasoft
Subject: Need to make VPA based function faster

Hello everyone,

I have the following function in which I use the VPA command to get more precision;
the problem i get is that this command is very time consuming, I need to call is hundreds of thousands of times.

Could anyone please tell how to make it faster? Are there any alternative faster solutions?

My Matlab code:

function [out]=schaff(indiv)

x=indiv.^2;

num=sin(vpa(sqrt(sum(x))))^2-0.5;

den=(1+0.001*(sum(x)))^2;
out=double(0.5 +num./den);


PS: even sym command is very time consuming.

Thank you in advance