summaryrefslogtreecommitdiff
path: root/797/CH1/EX1.5s/1_05_solution.sce
blob: e7952338e808c815ac5fae76e891d797ed97cf40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//Solution 1-5
WD=get_absolute_file_path('1_05_solution.sce');
datafile=WD+filesep()+'1_05_example.sci';
clc;
exec(datafile)
function [Z] =equations(X)
    x = X(1);
    y = X(2);
    Z(1) = x - y - difference;
    Z(2) = x**2 + y**2 - x -y - sum_squares_minus_sum;
endfunction

[X, v, info] = fsolve([1,1], equations);
printf("x = %f\n", X(1));
printf("y = %f\n", X(2));