Solve boundary value problem with NDSolve. How to print out approximations to a solution?

I solve particular boundary-value-problem for ODE with NDSolve “Shooting” method. The case is that solution is attained very slow, that seems to mean that boundary-value-problem which is supposed to be well-defined enough, in fact, is ill at some place. So i try figure out. First step is to see concrete values of a produced approximations to a solution. What language constructs should i use for that?

Simple example. Suppose we consider particle motion in vertical plane. We throw our particle from initial point with coordinates {x0,y0} := {0,0} and initial trajectory angle 45 degrees. And try to achieve point with coordinates {x1,y1} := {1,0} by varying particle initial velocity. We don’t know two things here: initial velocity and a duration of a motion. Here is how that toy problem can be presented and solved in mathematica:

gravity = 10; bvpsol = NDSolve[     {      {       (* ODE system (5th order) *)       {x''[u] / c[u]^2 == 0,        y''[u] / c[u]^2 == -gravity,        c'[u] == 0},       (* boundary conditions (5 items) *)       {x[0] == y[0] == 0,        x[1] == 1,        y[1] == 0,        x'[0] == y'[0]}       }      }, {x[u], y[u], c[u]}, u,      Method -> {"Shooting",        "StartingInitialConditions" -> {x[0] == y[0] == 0,          x'[0] == y'[0] == 1, c[0] == 1}}] // Flatten;  {dxdu, dydu} = D[{x[u], y[u]} /. bvpsol, u]; {vx0, vy0} = ({dxdu, dydu} / c[u] /. bvpsol) /. {u -> 0}; duration = c[u] /. bvpsol /. {u -> RandomReal[]};  ivpsol = NDSolve[{     (* ODE system *)     {x''[t] == 0, y''[t] == -gravity},     (* initial values *)     {x[0] == y[0] == 0, x'[0] == vx0, y'[0] == vy0}     }, {x[t], y[t]}, {t, 0, duration}];  ParametricPlot[{x[t], y[t]} /. ivpsol, {t, 0, duration},   GridLines -> Automatic, AspectRatio -> 1/2] 

comprehensive parabolic trajectory

Question: Now what options or language construct should i use to see approximations which are produced NDSolve while solving boundary-value-problem?

Using ScalingFunctions to ListPlot data in specific range and also to print FrameTicks with appropriate precision, gives strange fluctuations

Through the following code, we generate Tp1:

In[1]:= tempPV = (   3 \[Pi]^(2/3) + 6 6^(2/3) P \[Pi] V^(2/3) -     6^(2/3) V^(     2/3) (-3 + Sqrt[       9 + (4 6^(2/3) \[Pi]^(4/3) q^2)/(        V^(4/3) \[Beta]^2)]) \[Beta]^2 +     3 6^(2/3) V^(     2/3) \[Beta]^2 Log[      1/6 (3 + Sqrt[         9 + (4 6^(2/3) \[Pi]^(4/3) q^2)/(V^(4/3) \[Beta]^2)])])/(   6 6^(1/3) \[Pi]^(4/3) V^(1/3));  In[2]:= \[Beta]in = 0.01; \[Beta]fi = 100; \[Beta]st = 0.005; Table[   xlog[\[Beta]] = Log[10, \[Beta]]   , {\[Beta], \[Beta]in, \[Beta]fi, \[Beta]st}];  In[6]:= parap1 = {q -> 0.1, V4 -> 5000}; parap2 = {T2 -> 15, q -> 0.1, V2 -> 10000}; parap4 = {T4 -> 5, q -> 0.1, V4 -> 5000};  In[9]:= Table[    pressp2[\[Beta]] =     P /. Solve[(tempPV - T2 == 0) /. V -> V2 /. parap2, P][[1]];(*p1=   p2*)   pressp4[\[Beta]] =     P /. Solve[(tempPV - T4 == 0) /. V -> V4 /. parap4, P][[1]];(*p3=   p4*)   Tp1[\[Beta]] =     T1 /. Solve[(tempPV - T1 == 0) /. V -> V4 /. parap1 /.         P -> pressp2[\[Beta]], T1][[1]];   , {\[Beta], \[Beta]in, \[Beta]fi, \[Beta]st}];  In[10]:= mi =   Min[Table[Tp1[\[Beta]], {\[Beta], \[Beta]in, \[Beta]fi, \[Beta]st}]] ma = Max[Table[    Tp1[\[Beta]], {\[Beta], \[Beta]in, \[Beta]fi, \[Beta]st}]]  Out[10]= 11.9083  Out[11]= 11.9083  In[12]:= ListPlot[  Table[{xlog[\[Beta]],     Tp1[\[Beta]]}, {\[Beta], \[Beta]in, \[Beta]fi, \[Beta]st}],   ScalingFunctions -> {Rescale[#, {mi, ma}, {0.`, 1.`}] &,     Rescale[#, {0.`, 1.`}, {mi, ma}] &}, Joined -> True, Frame -> True,   FrameStyle -> Black,   BaseStyle -> {FontSize -> 14, PrintPrecision -> 11},   FrameLabel -> {"\!\(\*SubscriptBox[\(log\), \(10\)]\) (\[Beta])",     "\!\(\*SubscriptBox[\(T\), \(1\)]\)"}, RotateLabel -> False,   PlotStyle -> {Blue, Thickness[0.006]},   PlotRange -> {{-2, 2}, {mi, ma}}, Axes -> None, AspectRatio -> 0.8,   ImageSize -> 400, FrameTicks -> {{ticks, None}, {Automatic, None}}]  

The result is the following plot:

enter image description here

As it is clear there is a strange fluctuation for $ log_{10}^{\beta}=1-2$ . As it should be a smooth decreasing plot, what is the origin of these fluctuations? How to fix this possibly numerical error?

Write an algorithm reading some numbers and print the ones with the sum of their digits greater than $35$


Write an algorithm reading some numbers and print the ones with the sum of their digits greater than $ 35$ .

My try:

1) Start

2) $ N\leftarrow 0$

3) $ S \leftarrow 0$

4) $ R \leftarrow N-10\lfloor\frac{n}{10}\rfloor$

5) $ S \leftarrow R+S$

6) $ N\leftarrow\lfloor\frac{n}{10}\rfloor$

7) If $ N>0$ , go to $ 4$ , otherwise print $ S$

8) If $ S\le35$ then $ N\leftarrow N+1$ , otherwise print $ N$

9) end


I’m not sure if this algorithm works,so can someone please check that? plus does there exist any algorithm that determines the numbers such that the sum of their digits is greater than $ 35$ , besides determines how many such numbers exist? (I think they are infinity many such numbers)

Is there any difference between original prints and PoD (Print on Demand) source books?

Regarding source books by Onyx Path/White Wolf (for the World of Darkness), is there any difference between original prints and PoD (Print on Demand) source books?

Basically, is there a way to know if a source book is an original print? Are there any differences in paper or print quality? Are there other ways to tell them apart?

Venus RISC-V how to loop, compare, and print?

I am trying to loop through an array and if the number is larger than X then print.

I’ve tried to find tutorials online but I’m just stuck on why it is not working/outputting anything. My comments kind of explain what i tried to do.

.data arrayOfNums: .word 0 .word 1 .word 122 .word 1112 .word 4294967295 .word 22 .word 234234 .word 23332 .word 42 .word 23423  K: .word 2237  .text .globl main  main: ####   *** vv My problem starts here vv ***   #### la t0 K             #set t0 to K la t1 arrayOfNums   #set t1 pointer to array addi a1 t0 0        #add t0 deallocated to a1 addi a2 t1 0        #add t1 deallocated to a2  loop:      addi a0 x0 1        # print_int ecall     addi a1 t1 0        # add t1 value to print     ecall     addi t1, t1, 4      # Increments t1 to move to the next element     jal x0, loop  exit: ####Exit using environmental calls#### addi a1 x0 0         # random exit 0  addi a0 x0 17        # print_int ecall ecall 

Thank you for your help!!

Simple Java Question: How to print a random int in one class that was generated in another?

Say that I have two classes, A and B, that are in the package Sample.

In class B, I have generated a random int b that is either a 0 or 1. I want to print int b in class A. What code should I use to do this?

Here is class B:

  package Sample;   import java.util.Random;      public class B {         Random random = new Random();         int b = random.nextInt(2); //b is either 0 or 1     } 

And I need code to go in class A here:

package Sample;   public class A {  //How do I print out the int b here?  } 

Trying to contact Red Orca for permission to print an answer in a book [migrated]

I apologize in advance for breaking protocol. I’m just looking to get an official okay on rewriting and publishing Red Orca’s answer in this thread in an upcoming book about Magic Items. I looked for alternative ways to contact them but fell short. It’s an incredible answer and I’d love to make it more widely known to people out there looking to categorize their own items.

They can reach out over reddit to u/griff-mac or Discord to griffmac#9421, if that’s more appropriate. Thanks in advance, and again, I hope I’m not breaking rules too egregiously.

Cheers!

Difficulty understanding Algorithm to print Partitions of a Number [on hold]

Here’s a code I came across, which aims to print the partitions of a given number $ n$

I am unable to understand how the code accomplishes what it does, i.e. I’ve difficulty in understanding the algorithm. How does the code work?

#include <stdio.h> #include <string.h> #include <math.h> // Take a number and print it textually // For non-positive numbers it returns the empty string void itoa(int n, char *str){ if(n <= 0){     str[0] = '';     return; } int i, len = floor(log10(n) + 1); // number of digits in n for(i = len - 1; i >= 0; i--){     str[i] = '0' + (n % 10);     n /= 10; } str[len] = ''; }  // n tell us which number is to be partitioned // next tells us the location in the string where to print next // min tell us the minimum number we must choose next void partition(char *str, int n, int next, int min){ if(n == 0){     str[next] = '';     printf("%s\n", str);     return; } int i; // If this is not the first number in the partition // we need a plus sign before we print the next number if(next)     str[next++] = '+'; // Start from min so that numbers in a partition are always // in a non-decreasing order. This ensures that we will never // repeat a partition twice for(i = min; i <= n; i++){     itoa(i, str + next);     // We have already absorbed i so now partitions of n-i needed     // All future numbers in this partition must be at least i     partition(str, n - i, next + strlen(str + next), i); } }  int main(){ char str[1000]; // This code will output partitions in lexicographically increasing // order. However, lexicographic order means something a bit different // for this code. Nevertheless, no partition will be repeated twice. int n; scanf("%d",&n); // This code can handle any positive number, with any number of digits,  // so long as writing the parition does not take more than 999 chars partition(str,n, 0, 1); return 0; } 

Any and all help will be appreciated. Thank you!

Translating print product catalog (with 5000 products) to digital with good UX: how?

I’m currently working at a large B2B company which operates in a very traditional market (ordering happens mainly by phone, e-mail and even fax).

Since many years we are using a product catalog (print) with over 5000 products in it, but since it costs a lot of money to print and send it to our customers, we slowly want to move to digital.

The big question is: how can we translate this print manual to a digital version?

There are many PDF e-publishing tools, but that doesn’t really work with a 500 page catalog.

There are some examples like IKEA (where you can browse through pages online and download a pdf version): https://onlinecatalogue.ikea.com/PT/en/IKEA_Catalogue/#/pages/1

What are best practices here? What is the purpose of an online version? For reading? For buying (should we link products to a webshop)?

Another question: could a digital product catalog replace a printed version when customers are still ordering by phone / e-mail?

Many thanks in advance, looking forward to your reply.

Print out list item display form (InfoPath)

I have a SharePoint site used for tracking despatches in a warehouse. I think I’m going to use InfoPath to design the form to make it look nice, rather than CSS or JS, and from what I’ve seen elsewhere, different solutions exist for standard and InfoPath forms(?).

I just want to be able to select an item from the list and have the option to print the form.

I’d like the solution to be as simple as possible if anyone has any suggestions.