Student Support Forum: 'Function automatically created by a loop' topicStudent Support Forum > General > Archives > "Function automatically created by a loop"

 Next Comment > Help | Reply To Topic
 Author Comment/Response Frederic 03/31/10 08:50am Hi, I have a problem and just can't find a way to solve this in a nice way! What I want to do is to have a function defined with different parameters for different region. I've been doing this with conditionals and it works fine: mode[z_] := (-valuesbeta2[[Length[valuesbeta2] + 1 - i]]/(n1^2))*(A1* Exp[-p[valuesbeta2[[Length[valuesbeta2] + 1 - i]], n1]*(z - 0)] + B1* Exp[p[valuesbeta2[[Length[valuesbeta2] + 1 - i]], n1]*(z - 0)]) /; (-2 <= z && z <= 0); mode[z_] := (-valuesbeta2[[Length[valuesbeta2] + 1 - i]]/(n2^2))*(A2* Exp[-p[valuesbeta2[[Length[valuesbeta2] + 1 - i]], n2]*(z - 0)] + B2* Exp[p[valuesbeta2[[Length[valuesbeta2] + 1 - i]], n2]*(z - 0)]) /; (0 <= z && z <= z1); mode[z_] := (-valuesbeta2[[Length[valuesbeta2] + 1 - i]]/(n3^2))*(A3* Exp[-p[valuesbeta2[[Length[valuesbeta2] + 1 - i]], n3]*(z - z1)] + B3* Exp[p[valuesbeta2[[Length[valuesbeta2] + 1 - i]], n3]*(z - z1)]) /; (z1 <= z && z <= z2); mode[z_] := (-valuesbeta2[[Length[valuesbeta2] + 1 - i]]/(n4^2))*(A4* Exp[-p[valuesbeta2[[Length[valuesbeta2] + 1 - i]], n4]*(z - z2)] + B4* Exp[p[valuesbeta2[[Length[valuesbeta2] + 1 - i]], n4]*(z - z2)]) /; (z2 <= z && z <= z3); But instead of just manually inserting a new line of code f URL: ,

 Subject (listing for 'Function automatically created by a loop') Author Date Posted Function automatically created by a loop Frederic 03/31/10 08:50am Re: Function automatically created by a loop Nasser M. Ab... 04/01/10 10:04pm
 Next Comment > Help | Reply To Topic