Issues with ConvexOptimization and SetPrecision

I am completely new to Mathematica (second day), so do not expect things to look polished.

I am trying to perform a ConvexOptimization over a List/Array (dimensionality e-2)with custom (higher) precision. The plain version works just fine:

e=4;

PepGamma[z_, combinedA_] := 1 + z + z^2/2 + Sum[combinedA[[i]] * z^(i + 2), {i, e - 2}];
combinedA = Array[gam, e - 2];
Print[PepGamma[z, combinedA]];

omega = -1;
deltaT = 0.5;
ConvexOptimization[Abs[PepGamma[omega * deltaT, combinedA]] - 1, {}, combinedA]


Now if I want to specify a certain precision of the objective PepGamma, similar as done here

PepGammaPrec[z_, combinedA_] := SetPrecision[PepGamma[z, combinedA], 10];
Print[PepGammaPrec[z, combinedA]];


this seems to work. But then calling the optimizer

ConvexOptimization[
Abs[PepGammaPrec[omega * deltaT, combinedA] - 1], {}, combinedA, WorkingPrecision -> 10]


gives first the (strange) message

ConvexOptimization::precw: The precision (9.778151250383644) of the objective and constraints is less than the specified WorkingPrecision 10..

Alright, then lets try this with a smaller WorkingPrecision, say 9. But then the optimizer reports:

ConvexOptimization::nnobj: The objective does not evaluate to a real numerical value since the value of ObjectiveConstant is Abs[-0.3750000000-0.1250000000 gam[1.000000000]+0.06250000000 gam[2.000000000]].

How can this be? I also tried this with very small (2and very high precision 50), in both cases the optimizing routine reports that it is not able to find a solution, although the default case finds one.

• It seems calling SetPrecision, also changes indices precision, gam[2.000000000] instead of gam[2]. Indexed seems to solve the problem. Just change the combinedA definition to Array[Indexed[gam, #] &, e - 2]. May 10 at 15:23
• Thanks! That indeed seemed to have solved it. I was also worried about this, but when I checked the element access with e.g. combinedA[1.000000] it seemed to work. But probably not within the optimization package. Anyways, thanks again! May 10 at 16:15