
Error using mupadmex Error in MuPAD command: DOUBLE cannot convert the input expression into a doubl
Publicado por Pablo (3 intervenciones) el 14/11/2015 21:52:02
Hola, soy nuevo en esto y tengo el siguiente error
Error using mupadmex
Error in MuPAD command: DOUBLE cannot convert the input expression into a double array.
If the input expression contains a symbolic variable, use the VPA function instead.
Error in sym/double (line 936)
Xstr = mupadmex('symobj::double', S.s, 0);
Error in sym>privformatscalar (line 2707)
x = double(x);
Error in sym>privformat (line 2692)
s = privformatscalar(x);
Error in sym/subsasgn (line 1462)
[inds{k},refs{k}] = privformat(inds{k});
Error in aitken (line 3)
f(x) = (1/2)*(x + 2/x) ; %The function that find the next element in the sequence
Mi código es para el método delta cuadrado de Aitken, y es el siguiente
Que debo hacer para que funcione??
Error using mupadmex
Error in MuPAD command: DOUBLE cannot convert the input expression into a double array.
If the input expression contains a symbolic variable, use the VPA function instead.
Error in sym/double (line 936)
Xstr = mupadmex('symobj::double', S.s, 0);
Error in sym>privformatscalar (line 2707)
x = double(x);
Error in sym>privformat (line 2692)
s = privformatscalar(x);
Error in sym/subsasgn (line 1462)
[inds{k},refs{k}] = privformat(inds{k});
Error in aitken (line 3)
f(x) = (1/2)*(x + 2/x) ; %The function that find the next element in the sequence
Mi código es para el método delta cuadrado de Aitken, y es el siguiente
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
%These choices depend on the problem being solved
x0=1; %The initial value
f(x) = (1/2)*(x + 2/x) ; %The function that find the next element in the sequence
tolerance = 10^-10 ; %10 digit accuracy is desired
epsilon = 10^-16 ; %Don't want to divide by a number smaller than this
maxIterations = 20 ; %Don't allow the iterations to continue indefinitely
haveWeFoundSolution = false;%Were we able to find the solution to the desired tolerance? not yet.
for i = 1 : maxIterations
x1 = f(x0);
x2 = f(x1);
lambda = absoluteValue((x2 - x1)/(x1 - x0)); %OPTIONAL: computes an approximation of |f'(fixedPoint)|, which is denoted by lambda
denominator = x2 - 2*x1 + x0;
if(absoluteValue(denominator) < epsilon) %Don't want to divide by too small of a number
print('WARNING: denominator is too small')
break; %Leave the loop
end
aitkenX = x2 - ( (x2 - x1)^2 )/(denominator);
if(absoluteValue(aitkenX - x2) < tolerance) %If the result is within tolerance
print('The fixed point is', aitkenX) %Display the result of the Aitken extrapolation
haveWeFoundSolution = true;
break; %Done, so leave the loop
end
x0 = aitkenX; %Update x0 to start again
end
if(haveWeFoundSolution == false) %If we weren't able to find a solution to within the desired tolerance
print('Warning: Not able to find solution to within the desired tolerance of ', tolerance);
print('"The last computed extrapolate was ', aitkenX)
end
Que debo hacer para que funcione??
Valora esta pregunta


0