############ Proc to extract one x; #symm_sol = set of symmetry components from pdsolve in the form {eta_X=...,xh_t=...} #N=Number of free functions/consts to be considered # spec: specification of free constants and functions which are to be taken non-zero, e.g., spec:={_C1=0,_C2=a,_F1=sin} gem_extract_symm:=proc(symm_sol, {N::integer:=100, spec:={}}) local to_subs, ii, jj, const_list,func_list, spec_list, spec_listN, this_found; const_list:=linalg[vector](N); func_list:=linalg[vector](N); for ii from 1 to N do const_list[ii]:=cat('_C',ii); func_list[ii]:=cat('_F',ii); end do: to_subs:={}; spec_list:=convert(spec,list); spec_listN:=linalg[vectdim](spec_list); for ii from 1 to N do #constants this_found:=0; for jj from 1 to spec_listN do if (has(spec_list[jj],const_list[ii])) then this_found:=1; break; end if; end do; if(this_found=0) then to_subs:=to_subs union {const_list[ii]=0}; else to_subs:=to_subs union {spec_list[jj]}; end if; #functions this_found:=0; for jj from 1 to spec_listN do if (has(spec_list[jj],func_list[ii])) then this_found:=1; break; end if; end do; if(this_found=0) then to_subs:=to_subs union {func_list[ii]=0}; else to_subs:=to_subs union {spec_list[jj]}; end if; end; #print(to_subs); return simplify(eval(subs(to_subs,symm_sol))); end: # default global group parameter name: group_param_name='_a' gem_global_group:=proc(symm_sol, {group_param_name:='_a'} ) local ODE_IVP, curr_var, curr_RHS, subs_group_param_dep, g_p_name, ii, jj; ODE_IVP:={}: g_p_name:=eval(group_param_name); subs_group_param_dep:={seq(GEM_DEP_VARS[ii]=GEM_DEP_VARS[ii](g_p_name),ii=1..GEM_N_DEP_V), seq(GEM_INDEP_VARS[ii]=GEM_INDEP_VARS[ii](g_p_name),ii=1..GEM_N_INDEP_V)}; #-Dependent for ii from 1 to GEM_N_DEP_V do curr_var:=GEM_DEP_VARS[ii]; #symbol name only curr_RHS:=subs(symm_sol,GEM_TVF_COMPONENTS:-dep_components[ii]); ODE_IVP:=ODE_IVP union {diff(GEM_DEP_VARS[ii](g_p_name),g_p_name)=eval(subs(subs_group_param_dep, curr_RHS)) }; #Now ICs ODE_IVP:=ODE_IVP union {GEM_DEP_VARS[ii](0)=eval(cat(GEM_DEP_VARS[ii], '_0'))}; end do: #-Independent for ii from 1 to GEM_N_INDEP_V do curr_var:=GEM_INDEP_VARS[ii]; #symbol name only curr_RHS:=subs(symm_sol,GEM_TVF_COMPONENTS:-ind_components[ii]); ODE_IVP:=ODE_IVP union {diff(GEM_INDEP_VARS[ii](g_p_name),g_p_name)=eval(subs(subs_group_param_dep, curr_RHS)) }; #Now ICs ODE_IVP:=ODE_IVP union {GEM_INDEP_VARS[ii](0)=eval(cat(GEM_INDEP_VARS[ii], '_0'))}; end do: end: # Procedure generating extra conditions that differ TVF components for arbitrary func/consts present in given DE system # and dep/indep variables in the system. # # parameter "dependence1" to be given in the form # [ [[Q1],[d1,d2,d3]], [[Q2,Q3],[d1,d3,d7]], ... ] # where Qi are symbols (names) of independent or dependent variables or arbitrary constants/functions, # whose Tangent Vector Field Components are to depend on d's, which are also # symbols (names) of independent or dependent variables or arbitrary constants/functions, #Example:symbols (names) of independent or dependent variables or arbitrary constants/functions, gem_generate_EquivTr_dependence:=proc(dependence1) local cond_EqTr, N_dependence_entries, non_dependence, kk, ii, jj, N1, curr_var; N_dependence_entries:=linalg[vectdim](dependence1); cond_EqTr:={}: for kk from 1 to N_dependence_entries do # vars in dependence1[kk][1] will not depend on these: non_dependence:=convert( convert(GEM_TVF_COMPONENTS:-dependence,set) minus convert(dependence1[kk][2],set) ,list); N1:=linalg[vectdim](non_dependence); #-Dependent for ii from 1 to GEM_N_DEP_V do curr_var:=GEM_DEP_VARS[ii]; #symbol name only if(has(dependence1[kk][1],curr_var)) then for jj from 1 to N1 do cond_EqTr:=cond_EqTr union { diff(eval( cat('eta_',curr_var))(GEM_TVF_COMPONENTS:-dependence[]), non_dependence[jj]) =0 }; end do; end if; end do: #-Independent for ii from 1 to GEM_N_INDEP_V do curr_var:=GEM_INDEP_VARS[ii]; #symbol name only if(has(dependence1[kk][1],curr_var)) then for jj from 1 to N1 do cond_EqTr:=cond_EqTr union { diff(eval( cat('xi_',curr_var))(GEM_TVF_COMPONENTS:-dependence[]), non_dependence[jj]) =0 }; end do; end if; end do: end do: return cond_EqTr; end: