15 Reputation

One Badge

6 years, 345 days

MaplePrimes Activity

These are replies submitted by savalan

@tomleslie Thanks a lot, I will try to do your suggestions!

@Carl Love Thanks a lot, I will try it!

@tomleslie I tried to use two methods:

1- use (x,g(x)) as a data and try to fit f(x,a,b,c) to this data
2- minimize abs(f(x,a,b,c)-g(x))^2

@Carl Love both f and g are known functions. For each x we have g(x) as a comlex number and f(x) also complex number in terms of parameters (a,b,c).
for example if x=1, g(1)=0.8-1.3*i and f(1)=i*a+b*exp(i*c).
but original functions are complicated.
All optimization and data fit methods work for real-valued functions!!!

@Kitonum I tried to simplify the code. The rhs of each equation is the solution of another function, here is the code
f := (x) -> -I*Pi*sin(1/x)+exp(-i*x):
for i from 1 by 1 to n do
assume(0<d[i], d[i]<1):
assume(-0.01<a[i], a[i]<0):
L[i]:= L[i-1]+ d[i]:
sys[i]:={Re((-80*Pi*I*a[i]/((a[i]+1)^3))*exp(4*Pi*I*L[i])) = Re(f(x[i])), Im((-80*Pi*I*a[i]/((a[i]+1)^3))*exp(4*Pi*I*L[i])) = Im(f(x[i]))}:
solve(sys[i], {a[i],d[i]}, useassumptions = true, AllSolutions=true):
end do;

@Kitonum Eqs are inside the loop, each time the new d[i] is d[i]=d[i-1]+d[i], so I need previous d (d[i-1]) exactly to find new d[i].

Please see again my code!
each time, there is new equation with new "a" and '"d".
At the end, I will have n number of a[i] and d[i]. In this example that I wrote, three "a" and "d".

@Kitonum Thanks a lot!
But I need different values for "d[i]" in each run.
For example: 

d[1] = 0.03689590440 , _Z1=0

d[2] = 0.5000000000,  _Z2=1

d[3] = 0.5000000000,  _Z3=2
I knew that I can determine "_Z" by 
eval(sol,[_Z1= 0,_Z2= 1,_Z3= 2]):
but I want to run this loop for more than 50 times and for each run of the loop there are different "d[i]" and "_Zi"... so I can not do it by hand!

@Preben Alsholm Thank you very much! your comments were very useful.
Sorry! I have another question.

I use these equations inside the loop and after solve the first time and finding "d", in the second run, that loop use the previous "d[i]:=something+d[i]" to solve and find new "d", so I need exact ONE solution for "d" in each run of loop?

For example, first positive "d", because each time the first "_Z" is not determined!


Thank a lot! my maple is 17 and it gives me this answer

"Warning, solutions may have been lost
    {a = 0.0003959101031, d = -3.486909527}, 

      {a = 48.77978328, d = -3.486909527}, 

      {a = -51.78017919, d = -3.486909527}, 

      {a = -1.499802514 + 50.29489551 I, d = -3.334409527}, 

      {a = -0.0003949718625, d = -3.334409527}, 

      {a = -1.499802514 - 50.29489551 I, d = -3.334409527} "

Is it possible because of the edition of maple?

I run the same code!

Page 1 of 1