omkardpd

30 Reputation

One Badge

4 years, 66 days

MaplePrimes Activity


These are questions asked by omkardpd

Hi, 
I am having a difficulty is running a loop with solve command. I am using a command solve(f(x,alpha)=0, x) in a loop for alpha = 1 by 1 to 10. For some reasons, for some values of alpha, the solve command does not give any solution and hence the program keeps running on. When I interrupt the program at such instance, the remainder of the program is not complete. 

I tried using the try-catch command. I face the same issue. 

Is there a way for me to bypass the solve command when it does not find any solution for a particular alpha and continue with the remainder of the program? I can come back and manually obtain the solution for such alpha values where solve command does not provide an answer.

I would appreciate your help. 

Regards,

Omkar

 

 

Hi, 

I am struggling to obtain solutions for two bi-variate euqations numerically. A command line that I am currently using (for a dummy problem) is as follows: 

soln := {solve({f(x,y)=0, g(x,y)=0}, {x,y})}; 

There are mainly two issues:

1. For some reasons, Maple 2017 takes ages to obtain solutions for certain parameter values. At times, it does not provide any solution which should not happen. I am assuming that this is to do with the "solve" command.

2. Also, I am not sure how to limit search procedure within feasible ranges for variables. In this case, how do I incorporate conditions 0 <= x, y <=1? If I can incorporate these constraints in the "solve" (or any better) command, then I can automatically get rid of complex solutions as they are not relevant for me. 

I would appreciate inputs in this regard. Thank you,

Omkar

 

 

Dear Colleagues,

I think I can certainly take your help. I am trying to run a for-loop; a dummy code is provided below.

for i from 1 to 10 do

Sol_set[i] := solve(f(x, a)=0, x)

end do:

In some iterations at times I get an error message "division by zero". In that case, the program stops abruptly without completing the task for the remaining iterations.

Can I record the solution for any iteration, say j, that gives me an error message as Sol_set[j] := 0 and run the loop for i=j+1 to 10?

Likewise, I need to complete the loop for all iterations with stopping in between. Wherever there is an error, record some arbitrary solution that I can handle offline.

I would appreciate any help in this regard. Thank you all in advance.

Regards,

Omkar

Dear Friends, 

I would appreciate your help in resolving some issues. Let me describe my dummy code and the issues I am having. 

1. I have two functions f(x,a) and g(x,a) are well defined. 

2. I need to get roots of f(x,a). I am using the command soln := Roots(f(x,a)) which gives me a list of all possible values of x. 

3. I need to choose only one element -- say x* -- from the list "soln" such that x*=argmax{g(x,a) | g(x,a)>0 for x in soln}.

I am not able to find a technique (i) to evaluate g(x,a) for all elements of the list "soln", (ii) and select x* that maximizes g(x,a). 

Picking and choosing elements of the list one by one is difficult since the number of elements in the list can vary with parameter "a" and it would complicate the matter in numerical studies. 

I would sincerely appreciate any inputs in this regard. 

Thank you,

Omkar

 

 

Dear Colleagues,

 

I am not sure if there exist a simple way to handle the issues I am facing. I am trying to obtain numeric roots for a polynomial f(x,a). I know for sure that there can be many roots depending on the value of parameter a. However, I cannot say for sure how many roots are possible for each value of parameter a. Some of these roots are complex numbers. Also, I need to choose only those roots that have following properties:

1. They are real.

2. f(x*,a) i.e., function value at a root is positive. 

 

How do I solve f(x,a)=0 to store all roots in a set? Furthermore, how do I select and print roots that have the properties mentioned above? Is there a way to do filtering of a set specifying properties of the members of the set? Please suggest. Your help is highly appreciated.

 

Regards,

 

Omkar

 

 

1 2 Page 2 of 2